KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pcb_edit_frame.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
5 * Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <[email protected]>
6 * Copyright (C) 2013 Wayne Stambaugh <[email protected]>
7 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
8 *
9 * This program is free software: you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation, either version 3 of the License, or (at your
12 * option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program. If not, see <http://www.gnu.org/licenses/>.
21 */
22
23#include <advanced_config.h>
25#include <kiface_base.h>
26#include <kiway.h>
28#include <pgm_base.h>
29#include <pcb_edit_frame.h>
32#include <fp_lib_table.h>
33#include <bitmaps.h>
34#include <confirm.h>
35#include <lset.h>
36#include <trace_helpers.h>
37#include <pcbnew_id.h>
38#include <pcbnew_settings.h>
41#include <dialog_find.h>
44#include <dialog_board_setup.h>
46#include <dialogs/dialog_table_properties.h>
48#include <pcb_target.h>
49#include <layer_pairs.h>
52#include <functional>
53#include <pcb_painter.h>
56#include <python_scripting.h>
59#include <tool/tool_manager.h>
61#include <tool/action_toolbar.h>
62#include <tool/common_control.h>
63#include <tool/common_tools.h>
64#include <tool/embed_tool.h>
66#include <tool/selection.h>
67#include <tool/zoom_tool.h>
68#include <tools/array_tool.h>
73#include <tools/edit_tool.h>
77#include <tools/drc_tool.h>
79#include <tools/convert_tool.h>
80#include <tools/drawing_tool.h>
81#include <tools/pcb_control.h>
89#include <tools/pad_tool.h>
94#include <router/router_tool.h>
98#include <wx/socket.h>
99#include <wx/wupdlock.h>
100#include <dialog_drc.h> // for DIALOG_DRC_WINDOW_NAME definition
105#include <widgets/wx_infobar.h>
109#include <widgets/wx_aui_utils.h>
110#include <kiplatform/app.h>
111#include <core/profile.h>
112#include <math/box2_minmax.h>
116#include <toolbars_pcb_editor.h>
117
118#ifdef KICAD_IPC_API
119#include <api/api_server.h>
120#include <api/api_handler_pcb.h>
122#include <api/api_utils.h>
123#endif
124
125#include <action_plugin.h>
127#include "../scripting/python_scripting.h"
128
129#include <wx/filedlg.h>
130
131using namespace std::placeholders;
132
133
134#define INSPECT_DRC_ERROR_DIALOG_NAME wxT( "InspectDrcErrorDialog" )
135#define INSPECT_CLEARANCE_DIALOG_NAME wxT( "InspectClearanceDialog" )
136#define INSPECT_CONSTRAINTS_DIALOG_NAME wxT( "InspectConstraintsDialog" )
137#define FOOTPRINT_DIFF_DIALOG_NAME wxT( "FootprintDiffDialog" )
138
139
140BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME )
143
146
147 EVT_SIZE( PCB_EDIT_FRAME::OnSize )
148
149 // Menu Files:
152
153 EVT_MENU( wxID_EXIT, PCB_EDIT_FRAME::OnQuit )
154 EVT_MENU( wxID_CLOSE, PCB_EDIT_FRAME::OnQuit )
155
156 // Horizontal toolbar
159
160 // Tracks and vias sizes general options
162 PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event )
163
164 // User interface update event handlers.
165 EVT_UPDATE_UI( ID_AUX_TOOLBAR_PCB_TRACK_WIDTH, PCB_EDIT_FRAME::OnUpdateSelectTrackWidth )
166 EVT_UPDATE_UI( ID_AUX_TOOLBAR_PCB_VIA_SIZE, PCB_EDIT_FRAME::OnUpdateSelectViaSize )
168 PCB_EDIT_FRAME::OnUpdateSelectTrackWidth )
170 PCB_EDIT_FRAME::OnUpdateSelectViaSize )
171 // Drop files event
172 EVT_DROP_FILES( PCB_EDIT_FRAME::OnDropFiles )
173END_EVENT_TABLE()
174
175
176PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
177 PCB_BASE_EDIT_FRAME( aKiway, aParent, FRAME_PCB_EDITOR, _( "PCB Editor" ),
178 wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE,
180 m_exportNetlistAction( nullptr ),
181 m_findDialog( nullptr ),
182 m_inspectDrcErrorDlg( nullptr ),
183 m_inspectClearanceDlg( nullptr ),
184 m_inspectConstraintsDlg( nullptr ),
185 m_footprintDiffDlg( nullptr ),
186 m_boardSetupDlg( nullptr ),
187 m_designBlocksPane( nullptr ),
188 m_importProperties( nullptr ),
189 m_eventCounterTimer( nullptr )
190{
191 m_maximizeByDefault = true;
192 m_showBorderAndTitleBlock = true; // true to display sheet references
193 m_SelTrackWidthBox = nullptr;
194 m_SelViaSizeBox = nullptr;
195 m_show_layer_manager_tools = true;
196 m_supportsAutoSave = true;
197 m_probingSchToPcb = false;
198 m_show_search = false;
199 m_show_net_inspector = false;
200
201 // We don't know what state board was in when it was last saved, so we have to
202 // assume dirty
203 m_ZoneFillsDirty = true;
204
205 m_aboutTitle = _HKI( "KiCad PCB Editor" );
206
207 // Must be created before the menus are created.
208 if( ADVANCED_CFG::GetCfg().m_ShowPcbnewExportNetlist )
209 {
210 m_exportNetlistAction = new TOOL_ACTION( "pcbnew.EditorControl.exportNetlist",
211 AS_GLOBAL, 0, "", _( "Netlist..." ),
212 _( "Export netlist used to update schematics" ) );
213 }
214
215 // Create GAL canvas
216 auto canvas = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_frameSize,
217 GetGalDisplayOptions(),
219
220 SetCanvas( canvas );
221 SetBoard( new BOARD() );
222
223 wxIcon icon;
224 wxIconBundle icon_bundle;
225
226 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_pcbnew, 48 ) );
227 icon_bundle.AddIcon( icon );
228 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_pcbnew, 128 ) );
229 icon_bundle.AddIcon( icon );
230 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_pcbnew, 256 ) );
231 icon_bundle.AddIcon( icon );
232 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_pcbnew_32 ) );
233 icon_bundle.AddIcon( icon );
234 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_pcbnew_16 ) );
235 icon_bundle.AddIcon( icon );
236
237 SetIcons( icon_bundle );
238
239 // LoadSettings() *after* creating m_LayersManager, because LoadSettings()
240 // initialize parameters in m_LayersManager
241 LoadSettings( config() );
242
243 SetScreen( new PCB_SCREEN( GetPageSettings().GetSizeIU( pcbIUScale.IU_PER_MILS ) ) );
244
245 // PCB drawings start in the upper left corner.
246 GetScreen()->m_Center = false;
247
248 setupTools();
249 setupUIConditions();
250
251 m_toolbarSettings = GetToolbarSettings<PCB_EDIT_TOOLBAR_SETTINGS>( "pcbnew-toolbars" );
252 configureToolbars();
253 RecreateToolbars();
254 PrepareLayerIndicator( true );
255
256 ReCreateMenuBar();
257
258#ifdef KICAD_IPC_API
260 &PCB_EDIT_FRAME::onPluginAvailabilityChanged, this );
261#endif
262
263 // Fetch a COPY of the config as a lot of these initializations are going to overwrite our
264 // data.
265 PCBNEW_SETTINGS::AUI_PANELS aui_cfg = GetPcbNewSettings()->m_AuiPanels;
266
267 m_propertiesPanel = new PCB_PROPERTIES_PANEL( this, this );
268 m_propertiesPanel->SetSplitterProportion( aui_cfg.properties_splitter );
269
270 m_selectionFilterPanel = new PANEL_SELECTION_FILTER( this );
271
272 m_appearancePanel = new APPEARANCE_CONTROLS( this, GetCanvas() );
273 m_searchPane = new PCB_SEARCH_PANE( this );
274 m_netInspectorPanel = new PCB_NET_INSPECTOR_PANEL( this, this );
275 m_designBlocksPane = new PCB_DESIGN_BLOCK_PANE( this, nullptr, m_designBlockHistoryList );
276
277 m_auimgr.SetManagedWindow( this );
278
279 CreateInfoBar();
280
281 unsigned int auiFlags = wxAUI_MGR_DEFAULT;
282#if !defined( _WIN32 )
283 // Windows cannot redraw the UI fast enough during a live resize and may lead to all kinds
284 // of graphical glitches.
285 auiFlags |= wxAUI_MGR_LIVE_RESIZE;
286#endif
287 m_auimgr.SetFlags( auiFlags );
288
289 // Rows; layers 4 - 6
290 m_auimgr.AddPane( m_tbTopMain, EDA_PANE().HToolbar().Name( wxS( "TopMainToolbar" ) )
291 .Top().Layer( 6 ) );
292 m_auimgr.AddPane( m_tbTopAux, EDA_PANE().HToolbar().Name( wxS( "TopAuxToolbar" ) )
293 .Top().Layer( 5 ) );
294 m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( wxS( "MsgPanel" ) )
295 .Bottom().Layer( 6 ) );
296
297 // Columns; layers 1 - 3
298 m_auimgr.AddPane( m_tbLeft, EDA_PANE().VToolbar().Name( wxS( "LeftToolbar" ) )
299 .Left().Layer( 3 ) );
300
301 m_auimgr.AddPane( m_tbRight, EDA_PANE().VToolbar().Name( wxS( "RightToolbar" ) )
302 .Right().Layer( 3 ) );
303
304 m_auimgr.AddPane( m_appearancePanel, EDA_PANE().Name( wxS( "LayersManager" ) )
305 .Right().Layer( 4 )
306 .Caption( _( "Appearance" ) ).PaneBorder( false )
307 .MinSize( m_appearancePanel->GetMinSize().x, -1 )
308#ifdef __WXMAC__
309 // Best size for this pane is calculated larger than necessary on wxMac
310 .BestSize( m_appearancePanel->GetMinSize().x, -1 )
311#else
312 .BestSize( m_appearancePanel->GetBestSize().x, -1 )
313#endif
314 .FloatingSize( m_appearancePanel->GetBestSize() )
315 .CloseButton( false ) );
316
317 m_auimgr.AddPane( m_selectionFilterPanel, EDA_PANE().Name( wxS( "SelectionFilter" ) )
318 .Right().Layer( 4 ).Position( 2 )
319 .Caption( _( "Selection Filter" ) ).PaneBorder( false )
320 .MinSize( m_selectionFilterPanel->GetMinSize().x, -1 )
321 .BestSize( m_selectionFilterPanel->GetBestSize().x, -1 )
322 .FloatingSize( m_selectionFilterPanel->GetBestSize() )
323 .CloseButton( false ) );
324
325 m_auimgr.AddPane( m_designBlocksPane, EDA_PANE().Name( DesignBlocksPaneName() )
326 .Right().Layer( 5 )
327 .Caption( _( "Design Blocks" ) )
328 .CaptionVisible( true )
329 .PaneBorder( true )
330 .TopDockable( false )
331 .BottomDockable( false )
332 .CloseButton( true )
333 .MinSize( FromDIP( wxSize( 240, 60 ) ) )
334 .BestSize( FromDIP( wxSize( 300, 200 ) ) )
335 .FloatingSize( FromDIP( wxSize( 800, 600 ) ) )
336 .FloatingPosition( FromDIP( wxPoint( 50, 200 ) ) )
337 .Show( true ) );
338
339 m_auimgr.AddPane( m_propertiesPanel, EDA_PANE().Name( PropertiesPaneName() )
340 .Left().Layer( 5 )
341 .Caption( _( "Properties" ) ).PaneBorder( false )
342 .MinSize( FromDIP( wxSize( 240, 60 ) ) )
343 .BestSize( FromDIP( wxSize( 300, 200 ) ) )
344 .FloatingSize( wxSize( 300, 200 ) )
345 .CloseButton( true ) );
346
347 // Center
348 m_auimgr.AddPane( GetCanvas(), EDA_PANE().Canvas().Name( wxS( "DrawFrame" ) )
349 .Center() );
350
351 m_auimgr.AddPane( m_netInspectorPanel, EDA_PANE().Name( NetInspectorPanelName() )
352 .Bottom()
353 .Caption( _( "Net Inspector" ) )
354 .PaneBorder( false )
355 .MinSize( FromDIP( wxSize( 240, 60 ) ) )
356 .BestSize( FromDIP( wxSize( 300, 200 ) ) )
357 .FloatingSize( wxSize( 300, 200 ) )
358 .CloseButton( true ) );
359
360 m_auimgr.AddPane( m_searchPane, EDA_PANE().Name( SearchPaneName() )
361 .Bottom()
362 .Caption( _( "Search" ) ).PaneBorder( false )
363 .MinSize( FromDIP( wxSize ( 180, 60 ) ) )
364 .BestSize( FromDIP( wxSize ( 180, 100 ) ) )
365 .FloatingSize( FromDIP( wxSize( 480, 200 ) ) )
366 .DestroyOnClose( false )
367 .CloseButton( true ) );
368
369
370 m_auimgr.GetPane( "LayersManager" ).Show( m_show_layer_manager_tools );
371 m_auimgr.GetPane( "SelectionFilter" ).Show( m_show_layer_manager_tools );
372 m_auimgr.GetPane( PropertiesPaneName() ).Show( GetPcbNewSettings()->m_AuiPanels.show_properties );
373 m_auimgr.GetPane( NetInspectorPanelName() ).Show( m_show_net_inspector );
374 m_auimgr.GetPane( SearchPaneName() ).Show( m_show_search );
375 m_auimgr.GetPane( DesignBlocksPaneName() ).Show( GetPcbNewSettings()->m_AuiPanels.design_blocks_show );
376
377 // The selection filter doesn't need to grow in the vertical direction when docked
378 m_auimgr.GetPane( "SelectionFilter" ).dock_proportion = 0;
379
380 FinishAUIInitialization();
381
382 if( aui_cfg.right_panel_width > 0 )
383 {
384 wxAuiPaneInfo& layersManager = m_auimgr.GetPane( wxS( "LayersManager" ) );
385 SetAuiPaneSize( m_auimgr, layersManager, aui_cfg.right_panel_width, -1 );
386
387 wxAuiPaneInfo& designBlocksPane = m_auimgr.GetPane( DesignBlocksPaneName() );
388 SetAuiPaneSize( m_auimgr, designBlocksPane, aui_cfg.design_blocks_panel_docked_width, -1 );
389 }
390
391 if( aui_cfg.properties_panel_width > 0 && m_propertiesPanel )
392 {
393 wxAuiPaneInfo& propertiesPanel = m_auimgr.GetPane( PropertiesPaneName() );
394 SetAuiPaneSize( m_auimgr, propertiesPanel, aui_cfg.properties_panel_width, -1 );
395 }
396
397 if( aui_cfg.search_panel_height > 0
398 && ( aui_cfg.search_panel_dock_direction == wxAUI_DOCK_TOP
399 || aui_cfg.search_panel_dock_direction == wxAUI_DOCK_BOTTOM ) )
400 {
401 wxAuiPaneInfo& searchPane = m_auimgr.GetPane( SearchPaneName() );
402 searchPane.Direction( aui_cfg.search_panel_dock_direction );
403 SetAuiPaneSize( m_auimgr, searchPane, -1, aui_cfg.search_panel_height );
404 }
405 else if( aui_cfg.search_panel_width > 0
406 && ( aui_cfg.search_panel_dock_direction == wxAUI_DOCK_LEFT
407 || aui_cfg.search_panel_dock_direction == wxAUI_DOCK_RIGHT ) )
408 {
409 wxAuiPaneInfo& searchPane = m_auimgr.GetPane( SearchPaneName() );
410 searchPane.Direction( aui_cfg.search_panel_dock_direction );
411 SetAuiPaneSize( m_auimgr, searchPane, aui_cfg.search_panel_width, -1 );
412 }
413
414 m_appearancePanel->SetTabIndex( aui_cfg.appearance_panel_tab );
415
416 {
417 m_layerPairSettings = std::make_unique<LAYER_PAIR_SETTINGS>();
418
419 m_layerPairSettings->Bind( PCB_LAYER_PAIR_PRESETS_CHANGED, [&]( wxCommandEvent& aEvt )
420 {
421 // Update the project file list
422 std::span<const LAYER_PAIR_INFO> newPairInfos = m_layerPairSettings->GetLayerPairs();
424 std::vector<LAYER_PAIR_INFO>{ newPairInfos.begin(), newPairInfos.end() };
425 });
426
427 m_layerPairSettings->Bind( PCB_CURRENT_LAYER_PAIR_CHANGED, [&]( wxCommandEvent& aEvt )
428 {
429 const LAYER_PAIR& layerPair = m_layerPairSettings->GetCurrentLayerPair();
430 PCB_SCREEN& screen = *GetScreen();
431
432 screen.m_Route_Layer_TOP = layerPair.GetLayerA();
433 screen.m_Route_Layer_BOTTOM = layerPair.GetLayerB();
434
435 // Update the toolbar icon
436 PrepareLayerIndicator();
437 });
438 }
439
440 GetToolManager()->PostAction( ACTIONS::zoomFitScreen );
441
442 // This is used temporarily to fix a client size issue on GTK that causes zoom to fit
443 // to calculate the wrong zoom size. See PCB_EDIT_FRAME::onSize().
444 Bind( wxEVT_SIZE, &PCB_EDIT_FRAME::onSize, this );
445
446 Bind( wxEVT_IDLE,
447 [this]( wxIdleEvent& aEvent )
448 {
449 BOX2D viewport = GetCanvas()->GetView()->GetViewport();
450
451 if( viewport != m_lastNetnamesViewport )
452 {
453 redrawNetnames();
454 m_lastNetnamesViewport = viewport;
455 }
456
457 // Do not forget to pass the Idle event to other clients:
458 aEvent.Skip();
459 } );
460
461 resolveCanvasType();
462
463 setupUnits( config() );
464
465 // Ensure the DRC engine is initialized so that constraints can be resolved even before a
466 // board is loaded or saved
467 try
468 {
469 m_toolManager->GetTool<DRC_TOOL>()->GetDRCEngine()->InitEngine( wxFileName() );
470 }
471 catch( PARSE_ERROR& )
472 {
473 }
474
475 // Ensure the Python interpreter is up to date with its environment variables
476 PythonSyncEnvironmentVariables();
477 PythonSyncProjectName();
478
479 // Sync action plugins in case they changed since the last time the frame opened
480 GetToolManager()->RunAction( ACTIONS::pluginsReload );
481
482#ifdef KICAD_IPC_API
483 m_apiHandler = std::make_unique<API_HANDLER_PCB>( this );
484 Pgm().GetApiServer().RegisterHandler( m_apiHandler.get() );
485
486 if( Kiface().IsSingle() )
487 {
488 m_apiHandlerCommon = std::make_unique<API_HANDLER_COMMON>();
489 Pgm().GetApiServer().RegisterHandler( m_apiHandlerCommon.get() );
490 }
491#endif
492
493 GetCanvas()->SwitchBackend( m_canvasType );
494 ActivateGalCanvas();
495
496 // Default shutdown reason until a file is loaded
497 KIPLATFORM::APP::SetShutdownBlockReason( this, _( "New PCB file is unsaved" ) );
498
499 // disable Export STEP item if kicad2step does not exist
500 wxString strK2S = Pgm().GetExecutablePath();
501
502#ifdef __WXMAC__
503 if( strK2S.Find( wxT( "pcbnew.app" ) ) != wxNOT_FOUND )
504 {
505 // On macOS, we have standalone applications inside the main bundle, so we handle that here:
506 strK2S += wxT( "../../" );
507 }
508
509 strK2S += wxT( "Contents/MacOS/" );
510#endif
511
512 wxFileName appK2S( strK2S, wxT( "kicad2step" ) );
513
514#ifdef _WIN32
515 appK2S.SetExt( wxT( "exe" ) );
516#endif
517
518 // Ensure the window is on top
519 Raise();
520
521// if( !appK2S.FileExists() )
522 // GetMenuBar()->FindItem( ID_GEN_EXPORT_FILE_STEP )->Enable( false );
523
524 // AUI doesn't refresh properly on wxMac after changes in eb7dc6dd, so force it to
525#ifdef __WXMAC__
526 if( Kiface().IsSingle() )
527 {
528 CallAfter( [this]()
529 {
530 m_appearancePanel->OnBoardChanged();
531 } );
532 }
533#endif
534
535 // Register a call to update the toolbar sizes. It can't be done immediately because
536 // it seems to require some sizes calculated that aren't yet (at least on GTK).
537 CallAfter( [this]()
538 {
539 // Ensure the controls on the toolbars all are correctly sized
540 UpdateToolbarControlSizes();
541 } );
542
544 {
545 m_eventCounterTimer = new wxTimer( this );
546
547 Bind( wxEVT_TIMER,
548 [&]( wxTimerEvent& aEvent )
549 {
550 GetCanvas()->m_PaintEventCounter->Show();
551 GetCanvas()->m_PaintEventCounter->Reset();
552
554 static_cast<KIGFX::WX_VIEW_CONTROLS*>( GetCanvas()->GetViewControls() );
555 vc->m_MotionEventCounter->Show();
556 vc->m_MotionEventCounter->Reset();
557
558 },
559 m_eventCounterTimer->GetId() );
560
561 m_eventCounterTimer->Start( 1000 );
562 }
563
566 DragAcceptFiles( true );
567
568 Bind( EDA_EVT_CLOSE_DIALOG_BOOK_REPORTER, &PCB_EDIT_FRAME::onCloseModelessBookReporterDialogs, this );
569}
570
571
573{
575
576 if( ADVANCED_CFG::GetCfg().m_ShowEventCounters )
577 {
578 // Stop the timer during destruction early to avoid potential event race conditions (that
579 // do happen on windows)
580 m_eventCounterTimer->Stop();
581 delete m_eventCounterTimer;
582 }
583
584 // Close modeless dialogs
585 wxWindow* open_dlg = wxWindow::FindWindowByName( DIALOG_DRC_WINDOW_NAME );
586
587 if( open_dlg )
588 open_dlg->Close( true );
589
590 // Shutdown all running tools
591 if( m_toolManager )
593
594 if( GetBoard() )
596
597 // We passed ownership of these to wxAuiManager.
598 // delete m_selectionFilterPanel;
599 // delete m_appearancePanel;
600 // delete m_propertiesPanel;
601 // delete m_netInspectorPanel;
602
604}
605
606
607void PCB_EDIT_FRAME::SetBoard( BOARD* aBoard, bool aBuildConnectivity,
608 PROGRESS_REPORTER* aReporter )
609{
610 if( m_pcb )
612
613 PCB_BASE_EDIT_FRAME::SetBoard( aBoard, aReporter );
614
615 aBoard->SetProject( &Prj() );
616
617 if( aBuildConnectivity )
618 aBoard->BuildConnectivity();
619
620 // reload the drawing-sheet
621 SetPageSettings( aBoard->GetPageSettings() );
622}
623
624
626{
627 return m_pcb;
628}
629
630
631std::unique_ptr<GRID_HELPER> PCB_EDIT_FRAME::MakeGridHelper()
632{
633 return std::make_unique<PCB_GRID_HELPER>( m_toolManager, GetMagneticItemsSettings() );
634}
635
636
638{
639 /*
640 * While new items being scrolled into the view will get painted, they will only get
641 * annotated with netname instances currently within the view. Subsequent panning will not
642 * draw newly-visible netname instances because the item has already been drawn.
643 *
644 * This routine, fired on idle if the viewport has changed, looks for visible items that
645 * might have multiple netname instances and redraws them. (It does not need to handle pads
646 * and vias because they only ever have a single netname instance drawn on them.)
647 */
648 PCBNEW_SETTINGS* cfg = dynamic_cast<PCBNEW_SETTINGS*>( Kiface().KifaceSettings() );
649
650 if( !cfg || cfg->m_Display.m_NetNames < 2 )
651 return;
652
653 KIGFX::VIEW* view = GetCanvas()->GetView();
654 BOX2D viewport = view->GetViewport();
655
656 // Inflate to catch most of the track width
657 BOX2I_MINMAX clipbox( BOX2ISafe( viewport.Inflate( pcbIUScale.mmToIU( 2.0 ) ) ) );
658
659 for( PCB_TRACK* track : GetBoard()->Tracks() )
660 {
661 // Don't need to update vias
662 if( track->Type() == PCB_VIA_T )
663 continue;
664
665 // Don't update invisible tracks
666 if( !clipbox.Intersects( BOX2I_MINMAX( track->GetStart(), track->GetEnd() ) ) )
667 continue;
668
669 if( track->ViewGetLOD( GetNetnameLayer( track->GetLayer() ), view ) < view->GetScale() )
670 view->Update( track, KIGFX::REPAINT );
671 }
672}
673
674
675void PCB_EDIT_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings )
676{
677 PCB_BASE_FRAME::SetPageSettings( aPageSettings );
678
679 // Prepare drawing-sheet template
682 m_pcb->GetProject(),
684 &m_pcb->GetProperties() );
685
686 drawingSheet->SetSheetName( std::string( GetScreenDesc().mb_str() ) );
687 drawingSheet->SetSheetPath( std::string( GetFullScreenDesc().mb_str() ) );
688
689 // A board is not like a schematic having a main page and sub sheets.
690 // So for the drawing sheet, use only the first page option to display items
691 drawingSheet->SetIsFirstPage( true );
692
693 BASE_SCREEN* screen = GetScreen();
694
695 if( screen != nullptr )
696 {
697 drawingSheet->SetPageNumber(TO_UTF8( screen->GetPageNumber() ) );
698 drawingSheet->SetSheetCount( screen->GetPageCount() );
699 }
700
701 if( BOARD* board = GetBoard() )
702 drawingSheet->SetFileName( TO_UTF8( board->GetFileName() ) );
703
704 // PCB_DRAW_PANEL_GAL takes ownership of the drawing-sheet
705 GetCanvas()->SetDrawingSheet( drawingSheet );
706}
707
708
710{
711 return GetScreen() && GetScreen()->IsContentModified();
712}
713
714
716{
717 return m_toolManager->GetTool<PCB_SELECTION_TOOL>()->GetSelection();
718}
719
720
722{
723 // Create the manager and dispatcher & route draw panel events to the dispatcher
726 GetCanvas()->GetViewControls(), config(), this );
727 m_actions = new PCB_ACTIONS();
729
730 // Register tools
764
765 for( TOOL_BASE* tool : m_toolManager->Tools() )
766 {
767 if( PCB_TOOL_BASE* pcbTool = dynamic_cast<PCB_TOOL_BASE*>( tool ) )
768 pcbTool->SetIsBoardEditor( true );
769 }
770
771 // Run the selection tool, it is supposed to be always active
772 m_toolManager->InvokeTool( "common.InteractiveSelection" );
773}
774
775
777{
779
781 PCB_EDITOR_CONDITIONS cond( this );
782
783 auto undoCond =
784 [ this ] (const SELECTION& aSel )
785 {
787
788 if( drawingTool && drawingTool->GetDrawingMode() != DRAWING_TOOL::MODE::NONE )
789 return true;
790
792
793 if( routerTool && routerTool->RoutingInProgress() )
794 return true;
795
796 return GetUndoCommandCount() > 0;
797 };
798
799 auto groupWithDesignBlockLink =
800 [] ( const SELECTION& aSel )
801 {
802 if( aSel.Size() != 1 )
803 return false;
804
805 if( aSel[0]->Type() != PCB_GROUP_T )
806 return false;
807
808 PCB_GROUP* group = static_cast<PCB_GROUP*>( aSel.GetItem( 0 ) );
809
810 return group->HasDesignBlockLink();
811 };
812
813 wxASSERT( mgr );
814
815#define ENABLE( x ) ACTION_CONDITIONS().Enable( x )
816#define CHECK( x ) ACTION_CONDITIONS().Check( x )
817// clang-format off
818
820 mgr->SetConditions( ACTIONS::undo, ENABLE( undoCond ) );
822
827 mgr->SetConditions( ACTIONS::millimetersUnits, CHECK( cond.Units( EDA_UNITS::MM ) ) );
828 mgr->SetConditions( ACTIONS::inchesUnits, CHECK( cond.Units( EDA_UNITS::INCH ) ) );
829 mgr->SetConditions( ACTIONS::milsUnits, CHECK( cond.Units( EDA_UNITS::MILS ) ) );
830
831 mgr->SetConditions( ACTIONS::cut, ENABLE( cond.HasItems() ) );
832 mgr->SetConditions( ACTIONS::copy, ENABLE( cond.HasItems() ) );
839
840 static const std::vector<KICAD_T> groupTypes = { PCB_GROUP_T, PCB_GENERATOR_T };
841
846
847 mgr->SetConditions( PCB_ACTIONS::placeLinkedDesignBlock, ENABLE( groupWithDesignBlockLink) );
848 mgr->SetConditions( PCB_ACTIONS::saveToLinkedDesignBlock, ENABLE( groupWithDesignBlockLink) );
849
855
856 if( SCRIPTING::IsWxAvailable() )
858
859 auto enableZoneControlCondition =
860 [this] ( const SELECTION& )
861 {
864 };
865
867 ENABLE( enableZoneControlCondition )
868 .Check( cond.ZoneDisplayMode( ZONE_DISPLAY_MODE::SHOW_FILLED ) ) );
870 ENABLE( enableZoneControlCondition )
871 .Check( cond.ZoneDisplayMode( ZONE_DISPLAY_MODE::SHOW_ZONE_OUTLINE ) ) );
873 ENABLE( enableZoneControlCondition )
874 .Check( cond.ZoneDisplayMode( ZONE_DISPLAY_MODE::SHOW_FRACTURE_BORDERS ) ) );
876 ENABLE( enableZoneControlCondition )
877 .Check( cond.ZoneDisplayMode( ZONE_DISPLAY_MODE::SHOW_TRIANGULATION ) ) );
878
880
881 auto hasElements =
882 [ this ] ( const SELECTION& aSel )
883 {
884 return GetBoard() &&
885 ( !GetBoard()->IsEmpty() || !SELECTION_CONDITIONS::Idle( aSel ) );
886 };
887
888 auto constrainedDrawingModeCond =
889 [this]( const SELECTION& )
890 {
892 };
893
894 auto boardFlippedCond =
895 [this]( const SELECTION& )
896 {
897 return GetCanvas() && GetCanvas()->GetView()->IsMirroredX();
898 };
899
900 auto layerManagerCond =
901 [this] ( const SELECTION& )
902 {
903 return LayerManagerShown();
904 };
905
906 auto propertiesCond =
907 [this] ( const SELECTION& )
908 {
909 return PropertiesShown();
910 };
911
912 auto netInspectorCond =
913 [this] ( const SELECTION& )
914 {
915 return NetInspectorShown();
916 };
917
918 auto searchPaneCond =
919 [this] ( const SELECTION& )
920 {
921 return m_auimgr.GetPane( SearchPaneName() ).IsShown();
922 };
923
924 auto designBlockCond =
925 [ this ] (const SELECTION& aSel )
926 {
927 return m_auimgr.GetPane( DesignBlocksPaneName() ).IsShown();
928 };
929
930 auto highContrastCond =
931 [this] ( const SELECTION& )
932 {
933 return GetDisplayOptions().m_ContrastModeDisplay != HIGH_CONTRAST_MODE::NORMAL;
934 };
935
936 auto globalRatsnestCond =
937 [this] (const SELECTION& )
938 {
940 };
941
942 auto curvedRatsnestCond =
943 [this] (const SELECTION& )
944 {
946 };
947
948 auto netHighlightCond =
949 [this]( const SELECTION& )
950 {
952 return !settings->GetHighlightNetCodes().empty();
953 };
954
955 auto enableNetHighlightCond =
956 [this]( const SELECTION& )
957 {
959 return tool && tool->IsNetHighlightSet();
960 };
961
962 mgr->SetConditions( PCB_ACTIONS::toggleHV45Mode, CHECK( constrainedDrawingModeCond ) );
963 mgr->SetConditions( ACTIONS::highContrastMode, CHECK( highContrastCond ) );
964 mgr->SetConditions( PCB_ACTIONS::flipBoard, CHECK( boardFlippedCond ) );
965 mgr->SetConditions( PCB_ACTIONS::showLayersManager, CHECK( layerManagerCond ) );
966 mgr->SetConditions( PCB_ACTIONS::showRatsnest, CHECK( globalRatsnestCond ) );
967 mgr->SetConditions( PCB_ACTIONS::ratsnestLineMode, CHECK( curvedRatsnestCond ) );
968 mgr->SetConditions( PCB_ACTIONS::toggleNetHighlight, CHECK( netHighlightCond )
969 .Enable( enableNetHighlightCond ) );
970 mgr->SetConditions( ACTIONS::showProperties, CHECK( propertiesCond ) );
971 mgr->SetConditions( PCB_ACTIONS::showNetInspector, CHECK( netInspectorCond ) );
972 mgr->SetConditions( PCB_ACTIONS::showSearch, CHECK( searchPaneCond ) );
973 mgr->SetConditions( PCB_ACTIONS::showDesignBlockPanel, CHECK( designBlockCond ) );
974
977
978 const auto isArcKeepCenterMode =
979 [this]( const SELECTION& )
980 {
981 return GetPcbNewSettings()->m_ArcEditMode == ARC_EDIT_MODE::KEEP_CENTER_ADJUST_ANGLE_RADIUS;
982 };
983
984 const auto isArcKeepEndpointMode =
985 [this]( const SELECTION& )
986 {
987 return GetPcbNewSettings()->m_ArcEditMode == ARC_EDIT_MODE::KEEP_ENDPOINTS_OR_START_DIRECTION;
988 };
989
990 const auto isArcKeepRadiusMode =
991 [this]( const SELECTION& )
992 {
993 return GetPcbNewSettings()->m_ArcEditMode == ARC_EDIT_MODE::KEEP_CENTER_ENDS_ADJUST_ANGLE;
994 };
995
996 mgr->SetConditions( ACTIONS::pointEditorArcKeepCenter, CHECK( isArcKeepCenterMode ) );
997 mgr->SetConditions( ACTIONS::pointEditorArcKeepEndpoint, CHECK( isArcKeepEndpointMode ) );
998 mgr->SetConditions( ACTIONS::pointEditorArcKeepRadius, CHECK( isArcKeepRadiusMode ) );
999
1000 auto isHighlightMode =
1001 [this]( const SELECTION& )
1002 {
1004 return tool && tool->GetRouterMode() == PNS::RM_MarkObstacles;
1005 };
1006
1007 auto isShoveMode =
1008 [this]( const SELECTION& )
1009 {
1011 return tool && tool->GetRouterMode() == PNS::RM_Shove;
1012 };
1013
1014 auto isWalkaroundMode =
1015 [this]( const SELECTION& )
1016 {
1018 return tool && tool->GetRouterMode() == PNS::RM_Walkaround;
1019 };
1020
1021 mgr->SetConditions( PCB_ACTIONS::routerHighlightMode, CHECK( isHighlightMode ) );
1022 mgr->SetConditions( PCB_ACTIONS::routerShoveMode, CHECK( isShoveMode ) );
1023 mgr->SetConditions( PCB_ACTIONS::routerWalkaroundMode, CHECK( isWalkaroundMode ) );
1024
1025 auto isAutoTrackWidth =
1026 [this]( const SELECTION& )
1027 {
1029 };
1030
1031 mgr->SetConditions( PCB_ACTIONS::autoTrackWidth, CHECK( isAutoTrackWidth ) );
1032
1033 auto haveNetCond =
1034 [] ( const SELECTION& aSel )
1035 {
1036 for( EDA_ITEM* item : aSel )
1037 {
1038 if( BOARD_CONNECTED_ITEM* bci = dynamic_cast<BOARD_CONNECTED_ITEM*>( item ) )
1039 {
1040 if( bci->GetNetCode() > 0 )
1041 return true;
1042 }
1043 }
1044
1045 return false;
1046 };
1047
1048 mgr->SetConditions( PCB_ACTIONS::showNetInRatsnest, ENABLE( haveNetCond ) );
1049 mgr->SetConditions( PCB_ACTIONS::hideNetInRatsnest, ENABLE( haveNetCond ) );
1052
1053 static const std::vector<KICAD_T> trackTypes = { PCB_TRACE_T, PCB_ARC_T, PCB_VIA_T };
1054 static const std::vector<KICAD_T> padOwnerTypes = { PCB_FOOTPRINT_T, PCB_PAD_T };
1055 static const std::vector<KICAD_T> footprintTypes = { PCB_FOOTPRINT_T };
1056 static const std::vector<KICAD_T> crossProbeTypes = { PCB_PAD_T, PCB_FOOTPRINT_T, PCB_GROUP_T };
1057 static const std::vector<KICAD_T> zoneTypes = { PCB_ZONE_T };
1058
1064
1065
1067 && SELECTION_CONDITIONS::OnlyTypes( zoneTypes );
1068
1070 && SELECTION_CONDITIONS::OnlyTypes( zoneTypes );
1071
1072 mgr->SetConditions( PCB_ACTIONS::zoneDuplicate, ENABLE( singleZoneCond ) );
1073 mgr->SetConditions( PCB_ACTIONS::drawZoneCutout, ENABLE( singleZoneCond ) );
1074 mgr->SetConditions( PCB_ACTIONS::drawSimilarZone, ENABLE( singleZoneCond ) );
1075 mgr->SetConditions( PCB_ACTIONS::zoneMerge, ENABLE( zoneMergeCond ) );
1076
1078
1079#define CURRENT_TOOL( action ) mgr->SetConditions( action, CHECK( cond.CurrentTool( action ) ) )
1080
1081 // These tools can be used at any time to inspect the board
1086
1087 auto isDRCIdle =
1088 [this] ( const SELECTION& )
1089 {
1091 return !( tool && tool->IsDRCRunning() );
1092 };
1093
1094#define CURRENT_EDIT_TOOL( action ) \
1095 mgr->SetConditions( action, ACTION_CONDITIONS().Check( cond.CurrentTool( action ) ) \
1096 .Enable( isDRCIdle ) )
1097
1098 // These tools edit the board, so they must be disabled during some operations
1129
1135
1136#undef CURRENT_TOOL
1137#undef CURRENT_EDIT_TOOL
1138#undef ENABLE
1139#undef CHECK
1140// clang-format on
1141}
1142
1143
1144void PCB_EDIT_FRAME::OnQuit( wxCommandEvent& event )
1145{
1146 if( event.GetId() == wxID_EXIT )
1147 Kiway().OnKiCadExit();
1148
1149 if( event.GetId() == wxID_CLOSE || Kiface().IsSingle() )
1150 Close( false );
1151}
1152
1153
1154void PCB_EDIT_FRAME::ResolveDRCExclusions( bool aCreateMarkers )
1155{
1156 BOARD_COMMIT commit( this );
1157
1158 for( PCB_MARKER* marker : GetBoard()->ResolveDRCExclusions( aCreateMarkers ) )
1159 {
1160 if( marker->GetMarkerType() == MARKER_BASE::MARKER_DRAWING_SHEET )
1161 marker->GetRCItem()->SetItems( GetCanvas()->GetDrawingSheet() );
1162
1163 commit.Add( marker );
1164 }
1165
1166 commit.Push( wxEmptyString, SKIP_UNDO | SKIP_SET_DIRTY );
1167
1168 for( PCB_MARKER* marker : GetBoard()->Markers() )
1169 {
1170 if( marker->GetSeverity() == RPT_SEVERITY_EXCLUSION )
1171 GetCanvas()->GetView()->Update( marker );
1172 }
1173
1175}
1176
1177
1178bool PCB_EDIT_FRAME::canCloseWindow( wxCloseEvent& aEvent )
1179{
1180 // Shutdown blocks must be determined and vetoed as early as possible
1181 if( KIPLATFORM::APP::SupportsShutdownBlockReason() && aEvent.GetId() == wxEVT_QUERY_END_SESSION
1182 && IsContentModified() )
1183 {
1184 return false;
1185 }
1186
1188
1189 if( zoneFillerTool->IsBusy() )
1190 {
1191 wxBell();
1192
1193 if( wxWindow* reporter = dynamic_cast<wxWindow*>( zoneFillerTool->GetProgressReporter() ) )
1194 reporter->ShowWithEffect( wxSHOW_EFFECT_EXPAND );
1195
1196 return false;
1197 }
1198
1199 if( Kiface().IsSingle() )
1200 {
1201 auto* fpEditor = (FOOTPRINT_EDIT_FRAME*) Kiway().Player( FRAME_FOOTPRINT_EDITOR, false );
1202
1203 if( fpEditor && !fpEditor->Close() ) // Can close footprint editor?
1204 return false;
1205
1206 auto* fpViewer = (FOOTPRINT_VIEWER_FRAME*) Kiway().Player( FRAME_FOOTPRINT_VIEWER, false );
1207
1208 if( fpViewer && !fpViewer->Close() ) // Can close footprint viewer?
1209 return false;
1210
1211 // FOOTPRINT_CHOOSER_FRAME is always modal so this shouldn't come up, but better safe than
1212 // sorry.
1213 auto* chooser = (FOOTPRINT_CHOOSER_FRAME*) Kiway().Player( FRAME_FOOTPRINT_CHOOSER, false );
1214
1215 if( chooser && !chooser->Close() ) // Can close footprint chooser?
1216 return false;
1217 }
1218 else
1219 {
1220 auto* fpEditor = (FOOTPRINT_EDIT_FRAME*) Kiway().Player( FRAME_FOOTPRINT_EDITOR, false );
1221
1222 if( fpEditor && fpEditor->IsCurrentFPFromBoard() )
1223 {
1224 if( !fpEditor->CanCloseFPFromBoard( true ) )
1225 return false;
1226 }
1227 }
1228
1229 if( IsContentModified() )
1230 {
1231 wxFileName fileName = GetBoard()->GetFileName();
1232 wxString msg = _( "Save changes to '%s' before closing?" );
1233
1234 if( !HandleUnsavedChanges( this, wxString::Format( msg, fileName.GetFullName() ),
1235 [&]() -> bool
1236 {
1237 return SaveBoard();
1238 } ) )
1239 {
1240 return false;
1241 }
1242 }
1243
1244 return PCB_BASE_EDIT_FRAME::canCloseWindow( aEvent );
1245}
1246
1247
1249{
1250 // On Windows 7 / 32 bits, on OpenGL mode only, Pcbnew crashes
1251 // when closing this frame if a footprint was selected, and the footprint editor called
1252 // to edit this footprint, and when closing pcbnew if this footprint is still selected
1253 // See https://bugs.launchpad.net/kicad/+bug/1655858
1254 // I think this is certainly a OpenGL event fired after frame deletion, so this workaround
1255 // avoid the crash (JPC)
1256 GetCanvas()->SetEvtHandlerEnabled( false );
1257
1259
1260#ifdef KICAD_IPC_API
1261 Pgm().GetApiServer().DeregisterHandler( m_apiHandler.get() );
1262 wxTheApp->Unbind( EDA_EVT_PLUGIN_AVAILABILITY_CHANGED,
1263 &PCB_EDIT_FRAME::onPluginAvailabilityChanged, this );
1264#endif
1265
1266 // Clean up mode-less dialogs.
1267 Unbind( EDA_EVT_CLOSE_DIALOG_BOOK_REPORTER, &PCB_EDIT_FRAME::onCloseModelessBookReporterDialogs,
1268 this );
1269
1270 wxWindow* open_dlg = wxWindow::FindWindowByName( DIALOG_DRC_WINDOW_NAME );
1271
1272 if( open_dlg )
1273 open_dlg->Close( true );
1274
1275 if( m_findDialog )
1276 {
1277 m_findDialog->Destroy();
1278 m_findDialog = nullptr;
1279 }
1280
1282 {
1283 m_inspectDrcErrorDlg->Destroy();
1284 m_inspectDrcErrorDlg = nullptr;
1285 }
1286
1288 {
1289 m_inspectClearanceDlg->Destroy();
1290 m_inspectClearanceDlg = nullptr;
1291 }
1292
1294 {
1295 m_inspectConstraintsDlg->Destroy();
1296 m_inspectConstraintsDlg = nullptr;
1297 }
1298
1299 if( m_footprintDiffDlg )
1300 {
1301 m_footprintDiffDlg->Destroy();
1302 m_footprintDiffDlg = nullptr;
1303 }
1304
1305 // Delete the auto save file if it exists.
1306 wxFileName fn = GetBoard()->GetFileName();
1307
1308 // Auto save file name is the normal file name prefixed with 'FILEEXT::AutoSaveFilePrefix'.
1309 fn.SetName( FILEEXT::AutoSaveFilePrefix + fn.GetName() );
1310
1311 // When the auto save feature does not have write access to the board file path, it falls
1312 // back to a platform specific user temporary file path.
1313 if( !fn.IsOk() || !fn.IsDirWritable() )
1314 fn.SetPath( wxFileName::GetTempDir() );
1315
1316 wxLogTrace( traceAutoSave, wxT( "Deleting auto save file <" ) + fn.GetFullPath() + wxT( ">" ) );
1317
1318 // Remove the auto save file on a normal close of Pcbnew.
1319 if( fn.FileExists() && !wxRemoveFile( fn.GetFullPath() ) )
1320 {
1321 wxLogTrace( traceAutoSave, wxT( "The auto save file could not be removed!" ) );
1322 }
1323
1324 // Make sure local settings are persisted
1325 if( Prj().GetLocalSettings().ShouldAutoSave() )
1326 {
1329 }
1330 else
1331 {
1332 wxLogTrace( traceAutoSave, wxT( "Skipping auto-save of migrated local settings" ) );
1333 }
1334
1335 // Do not show the layer manager during closing to avoid flicker
1336 // on some platforms (Windows) that generate useless redraw of items in
1337 // the Layer Manager
1339 {
1340 m_auimgr.GetPane( wxS( "LayersManager" ) ).Show( false );
1341 m_auimgr.GetPane( wxS( "TabbedPanel" ) ).Show( false );
1342 }
1343
1344 // Unlink the old project if needed
1346
1347 // Delete board structs and undo/redo lists, to avoid crash on exit
1348 // when deleting some structs (mainly in undo/redo lists) too late
1349 Clear_Pcb( false, true );
1350
1351 // do not show the window because ScreenPcb will be deleted and we do not
1352 // want any paint event
1353 Show( false );
1354
1356}
1357
1358
1360{
1363 GetCanvas()->Refresh();
1364}
1365
1366
1367void PCB_EDIT_FRAME::ShowBoardSetupDialog( const wxString& aInitialPage )
1368{
1369 static std::mutex dialogMutex; // Local static mutex
1370
1371 std::unique_lock<std::mutex> dialogLock( dialogMutex, std::try_to_lock );
1372
1373 // One dialog at a time.
1374 if( !dialogLock.owns_lock() )
1375 {
1376 if( m_boardSetupDlg && m_boardSetupDlg->IsShown() )
1377 {
1378 m_boardSetupDlg->Raise(); // Brings the existing dialog to the front
1379 }
1380
1381 return;
1382 }
1383
1384 // Make sure everything's up-to-date
1386
1387 DIALOG_BOARD_SETUP dlg( this );
1388
1389 if( !aInitialPage.IsEmpty() )
1390 dlg.SetInitialPage( aInitialPage, wxEmptyString );
1391
1392 // Assign dlg to the m_boardSetupDlg pointer to track its status.
1393 m_boardSetupDlg = &dlg;
1394
1395 // QuasiModal required for Scintilla auto-complete
1396 if( dlg.ShowQuasiModal() == wxID_OK )
1397 {
1398 // Note: We must synchronise time domain properties before nets and classes, otherwise the updates
1399 // called by the board listener events are using stale data
1402
1403 if( !GetBoard()->SynchronizeComponentClasses( std::unordered_set<wxString>() ) )
1404 {
1407 m_infoBar->ShowMessage( _( "Could not load component class assignment rules" ),
1408 wxICON_WARNING, WX_INFOBAR::MESSAGE_TYPE::GENERIC );
1409 }
1410
1411 // We don't know if anything was modified, so err on the side of requiring a save
1412 OnModify();
1413
1415
1418
1419 PCBNEW_SETTINGS* settings = GetPcbNewSettings();
1420 static LSET maskAndPasteLayers = LSET( { F_Mask, F_Paste, B_Mask, B_Paste } );
1421
1423 [&]( KIGFX::VIEW_ITEM* aItem ) -> int
1424 {
1425 int flags = 0;
1426
1427 if( !aItem->IsBOARD_ITEM() )
1428 return flags;
1429
1430 BOARD_ITEM* item = static_cast<BOARD_ITEM*>( aItem );
1431
1432 if( item->Type() == PCB_VIA_T || item->Type() == PCB_PAD_T )
1433 {
1434 // Note: KIGFX::REPAINT isn't enough for things that go from invisible
1435 // to visible as they won't be found in the view layer's itemset for
1436 // re-painting.
1437 if( ( GetBoard()->GetVisibleLayers() & maskAndPasteLayers ).any() )
1438 flags |= KIGFX::ALL;
1439 }
1440
1441 if( item->Type() == PCB_TRACE_T || item->Type() == PCB_ARC_T || item->Type() == PCB_VIA_T )
1442 {
1443 if( settings->m_Display.m_TrackClearance == SHOW_WITH_VIA_ALWAYS )
1444 flags |= KIGFX::REPAINT;
1445 }
1446
1447 if( item->Type() == PCB_PAD_T )
1448 {
1449 if( settings->m_Display.m_PadClearance )
1450 flags |= KIGFX::REPAINT;
1451 }
1452
1453 if( EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( aItem ) )
1454 {
1455 if( text->HasTextVars() )
1456 {
1457 text->ClearRenderCache();
1458 text->ClearBoundingBoxCache();
1459 flags |= KIGFX::GEOMETRY | KIGFX::REPAINT;
1460 }
1461 }
1462
1463 return flags;
1464 } );
1465
1466 GetCanvas()->Refresh();
1467
1471
1472 //this event causes the routing tool to reload its design rules information
1474 toolEvent.SetHasPosition( false );
1475 m_toolManager->ProcessEvent( toolEvent );
1476 }
1477
1478 GetCanvas()->SetFocus();
1479
1480 // Reset m_boardSetupDlg after the dialog is closed
1481 m_boardSetupDlg = nullptr;
1482}
1483
1484
1486{
1488}
1489
1490
1492{
1494
1495 PCBNEW_SETTINGS* cfg = dynamic_cast<PCBNEW_SETTINGS*>( aCfg );
1496 wxASSERT( cfg );
1497
1498 if( cfg )
1499 {
1503 }
1504}
1505
1506
1508{
1510
1511 PCBNEW_SETTINGS* cfg = dynamic_cast<PCBNEW_SETTINGS*>( aCfg );
1512 wxASSERT( cfg );
1513
1514 if( cfg )
1515 {
1516 wxAuiPaneInfo& apperancePane = m_auimgr.GetPane( AppearancePanelName() );
1517 cfg->m_AuiPanels.show_layer_manager = apperancePane.IsShown();
1518
1519 if( m_propertiesPanel )
1520 {
1521 cfg->m_AuiPanels.show_properties = m_propertiesPanel->IsShownOnScreen();
1524 }
1525
1526 // ensure m_show_search is up to date (the pane can be closed)
1527 wxAuiPaneInfo& searchPaneInfo = m_auimgr.GetPane( SearchPaneName() );
1528 m_show_search = searchPaneInfo.IsShown();
1530 cfg->m_AuiPanels.search_panel_height = m_searchPane->GetSize().y;
1531 cfg->m_AuiPanels.search_panel_width = m_searchPane->GetSize().x;
1532 cfg->m_AuiPanels.search_panel_dock_direction = searchPaneInfo.dock_direction;
1533
1535 {
1536 wxAuiPaneInfo& netInspectorhPaneInfo = m_auimgr.GetPane( NetInspectorPanelName() );
1537 m_show_net_inspector = netInspectorhPaneInfo.IsShown();
1539 }
1540
1541 if( m_appearancePanel )
1542 {
1547 }
1548
1549 wxAuiPaneInfo& designBlocksPane = m_auimgr.GetPane( DesignBlocksPaneName() );
1550 cfg->m_AuiPanels.design_blocks_show = designBlocksPane.IsShown();
1551
1552 if( designBlocksPane.IsDocked() )
1554 else
1555 {
1556 cfg->m_AuiPanels.design_blocks_panel_float_height = designBlocksPane.floating_size.y;
1557 cfg->m_AuiPanels.design_blocks_panel_float_width = designBlocksPane.floating_size.x;
1558 }
1559
1561 }
1562}
1563
1564
1566{
1567 PCBNEW_SETTINGS* cfg = dynamic_cast<PCBNEW_SETTINGS*>( config() );
1568
1569 return cfg ? cfg->m_RotationAngle : ANGLE_90;
1570}
1571
1572
1574{
1576}
1577
1578
1580{
1581
1582 GetColorSettings()->SetColor( LAYER_GRID, aColor );
1583 GetCanvas()->GetGAL()->SetGridColor( aColor );
1584}
1585
1586
1587void PCB_EDIT_FRAME::SetActiveLayer( PCB_LAYER_ID aLayer, bool aForceRedraw )
1588{
1589 const PCB_LAYER_ID oldLayer = GetActiveLayer();
1590
1591 if( oldLayer == aLayer && !aForceRedraw )
1592 return;
1593
1595
1597
1598 m_toolManager->PostAction( PCB_ACTIONS::layerChanged ); // notify other tools
1599 GetCanvas()->SetFocus(); // allow capture of hotkeys
1600 GetCanvas()->SetHighContrastLayer( aLayer );
1601
1602 /*
1603 * Only show pad, via and track clearances when a copper layer is active
1604 * and then only show the clearance layer for that copper layer. For
1605 * front/back non-copper layers, show the clearance layer for the outer
1606 * layer on that side.
1607 *
1608 * For pads/vias, this is to avoid clutter when there are pad/via layers
1609 * that vary in flash (i.e. clearance from the hole or pad edge), padstack
1610 * shape on each layer or clearances on each layer.
1611 *
1612 * For tracks, this follows the same logic as pads/vias, but in theory could
1613 * have their own set of independent clearance layers to allow track clearance
1614 * to be shown for more layers.
1615 */
1616 const auto getClearanceLayerForActive = []( PCB_LAYER_ID aActiveLayer ) -> std::optional<int>
1617 {
1618 if( IsCopperLayer( aActiveLayer ) )
1619 return CLEARANCE_LAYER_FOR( aActiveLayer );
1620
1621 return std::nullopt;
1622 };
1623
1624 if( std::optional<int> oldClearanceLayer = getClearanceLayerForActive( oldLayer ) )
1625 GetCanvas()->GetView()->SetLayerVisible( *oldClearanceLayer, false );
1626
1627 if( std::optional<int> newClearanceLayer = getClearanceLayerForActive( aLayer ) )
1628 GetCanvas()->GetView()->SetLayerVisible( *newClearanceLayer, true );
1629
1631 [&]( KIGFX::VIEW_ITEM* aItem ) -> int
1632 {
1633 if( !aItem->IsBOARD_ITEM() )
1634 return 0;
1635
1636 BOARD_ITEM* item = static_cast<BOARD_ITEM*>( aItem );
1637
1638 // Note: KIGFX::REPAINT isn't enough for things that go from invisible to visible
1639 // as they won't be found in the view layer's itemset for re-painting.
1640 if( GetDisplayOptions().m_ContrastModeDisplay == HIGH_CONTRAST_MODE::HIDDEN )
1641 {
1642 if( item->IsOnLayer( oldLayer ) || item->IsOnLayer( aLayer ) )
1643 return KIGFX::ALL;
1644 }
1645
1646 if( item->Type() == PCB_VIA_T )
1647 {
1648 PCB_VIA* via = static_cast<PCB_VIA*>( item );
1649
1650 // Vias on a restricted layer set must be redrawn when the active layer
1651 // is changed
1652 if( via->GetViaType() == VIATYPE::BLIND_BURIED
1653 || via->GetViaType() == VIATYPE::MICROVIA )
1654 {
1655 return KIGFX::REPAINT;
1656 }
1657
1658 if( via->GetRemoveUnconnected() )
1659 return KIGFX::ALL;
1660 }
1661 else if( item->Type() == PCB_PAD_T )
1662 {
1663 PAD* pad = static_cast<PAD*>( item );
1664
1665 if( pad->GetRemoveUnconnected() )
1666 return KIGFX::ALL;
1667 }
1668
1669 return 0;
1670 } );
1671
1672 GetCanvas()->Refresh();
1673}
1674
1675
1677{
1679
1680 layerEnum.Choices().Clear();
1681 layerEnum.Undefined( UNDEFINED_LAYER );
1682
1683 for( PCB_LAYER_ID layer : LSET::AllLayersMask() )
1684 {
1685 // Canonical name
1686 layerEnum.Map( layer, LSET::Name( layer ) );
1687
1688 // User name
1689 layerEnum.Map( layer, GetBoard()->GetLayerName( layer ) );
1690 }
1691
1692 DRC_TOOL* drcTool = m_toolManager->GetTool<DRC_TOOL>();
1693
1694 try
1695 {
1696 drcTool->GetDRCEngine()->InitEngine( GetDesignRulesPath() );
1697 }
1698 catch( PARSE_ERROR& )
1699 {
1700 // Not sure this is the best place to tell the user their rules are buggy, so
1701 // we'll stay quiet for now. Feel free to revisit this decision....
1702 }
1703
1704 UpdateTitle();
1705
1706 wxFileName fn = GetBoard()->GetFileName();
1707
1708 // Display a warning that the file is read only
1709 if( fn.FileExists() && !fn.IsFileWritable() )
1710 {
1713 m_infoBar->ShowMessage( _( "Board file is read only." ),
1715 }
1716
1718
1719 // Sync layer and item visibility
1721
1722 SetElementVisibility( LAYER_RATSNEST, GetPcbNewSettings()->m_Display.m_ShowGlobalRatsnest );
1723
1725
1726 // Apply saved display state to the appearance panel after it has been set up
1727 PROJECT_LOCAL_SETTINGS& localSettings = Prj().GetLocalSettings();
1728
1730
1731 if( GetBoard()->GetDesignSettings().IsLayerEnabled( localSettings.m_ActiveLayer ) )
1732 SetActiveLayer( localSettings.m_ActiveLayer, true );
1733 else
1734 SetActiveLayer( GetActiveLayer(), true ); // Make sure to repaint even if not switching
1735
1736 PROJECT_FILE& projectFile = Prj().GetProjectFile();
1737
1738 m_layerPairSettings->SetLayerPairs( projectFile.m_LayerPairInfos );
1739 m_layerPairSettings->SetCurrentLayerPair( LAYER_PAIR{ F_Cu, B_Cu } );
1740
1741 // Updates any auto dimensions and the auxiliary toolbar tracks/via sizes
1743
1744 // Sync the net inspector now we have connectivity calculated
1747
1748 // Display the loaded board:
1749 Zoom_Automatique( false );
1750
1751 // Invalidate painting as loading the DRC engine will cause clearances to become valid
1753
1754 Refresh();
1755
1756 SetMsgPanel( GetBoard() );
1757 SetStatusText( wxEmptyString );
1758
1759 KIPLATFORM::APP::SetShutdownBlockReason( this, _( "PCB file changes are unsaved" ) );
1760}
1761
1762
1764{
1766}
1767
1768
1770{
1771 return GetBoard()->IsElementVisible( aElement );
1772}
1773
1774
1776{
1777 // Force the RATSNEST visible
1778 if( aElement == LAYER_RATSNEST )
1779 GetCanvas()->GetView()->SetLayerVisible( aElement, true );
1780 else
1781 GetCanvas()->GetView()->SetLayerVisible( aElement , aNewState );
1782
1783 GetBoard()->SetElementVisibility( aElement, aNewState );
1784}
1785
1786
1788{
1789 // call my base class
1791
1792 m_auimgr.GetPane( m_appearancePanel ).Caption( _( "Appearance" ) );
1793 m_auimgr.GetPane( m_selectionFilterPanel ).Caption( _( "Selection Filter" ) );
1794 m_auimgr.GetPane( m_propertiesPanel ).Caption( _( "Properties" ) );
1795 m_auimgr.GetPane( m_netInspectorPanel ).Caption( _( "Net Inspector" ) );
1796 m_auimgr.Update();
1797
1798 UpdateTitle();
1799}
1800
1801
1803{
1805
1806 if( project.m_PcbLastPath[ aType ].IsEmpty() )
1807 return wxEmptyString;
1808
1809 wxFileName absoluteFileName = project.m_PcbLastPath[ aType ];
1810 wxFileName pcbFileName = GetBoard()->GetFileName();
1811
1812 absoluteFileName.MakeAbsolute( pcbFileName.GetPath() );
1813 return absoluteFileName.GetFullPath();
1814}
1815
1816
1817void PCB_EDIT_FRAME::SetLastPath( LAST_PATH_TYPE aType, const wxString& aLastPath )
1818{
1820
1821 wxFileName relativeFileName = aLastPath;
1822 wxFileName pcbFileName = GetBoard()->GetFileName();
1823
1824 relativeFileName.MakeRelativeTo( pcbFileName.GetPath() );
1825
1826 if( relativeFileName.GetFullPath() != project.m_PcbLastPath[ aType ] )
1827 {
1828 project.m_PcbLastPath[ aType ] = relativeFileName.GetFullPath();
1829 OnModify();
1830 }
1831}
1832
1833
1835{
1837 m_ZoneFillsDirty = true;
1838
1839 if( m_isClosing )
1840 return;
1841
1842 Update3DView( true, GetPcbNewSettings()->m_Display.m_Live3DRefresh );
1843
1844 if( !GetTitle().StartsWith( wxT( "*" ) ) )
1845 UpdateTitle();
1846
1847}
1848
1849
1851{
1852 Update3DView( true, true );
1853
1854 std::shared_ptr<CONNECTIVITY_DATA> connectivity = GetBoard()->GetConnectivity();
1855 connectivity->RecalculateRatsnest( nullptr );
1857
1858 std::vector<MSG_PANEL_ITEM> msg_list;
1859 GetBoard()->GetMsgPanelInfo( this, msg_list );
1860 SetMsgPanel( msg_list );
1861}
1862
1863
1865{
1866 wxFileName fn = GetBoard()->GetFileName();
1867 bool readOnly = false;
1868 bool unsaved = false;
1869
1870 if( fn.IsOk() && fn.FileExists() )
1871 readOnly = !fn.IsFileWritable();
1872 else
1873 unsaved = true;
1874
1875 wxString title;
1876
1877 if( IsContentModified() )
1878 title = wxT( "*" );
1879
1880 title += fn.GetName();
1881
1882 if( readOnly )
1883 title += wxS( " " ) + _( "[Read Only]" );
1884
1885 if( unsaved )
1886 title += wxS( " " ) + _( "[Unsaved]" );
1887
1888 title += wxT( " \u2014 " ) + _( "PCB Editor" );
1889
1890 SetTitle( title );
1891}
1892
1893
1895{
1896 // Update the layer manager and other widgets from the board setup
1897 // (layer and items visibility, colors ...)
1898
1899 // Rebuild list of nets (full ratsnest rebuild)
1901
1902 // Update info shown by the horizontal toolbars
1904
1905 LSET activeLayers = GetBoard()->GetEnabledLayers();
1906
1907 if( !activeLayers.test( GetActiveLayer() ) )
1908 SetActiveLayer( activeLayers.Seq().front() );
1909
1911
1913
1914 layerEnum.Choices().Clear();
1915 layerEnum.Undefined( UNDEFINED_LAYER );
1916
1917 for( PCB_LAYER_ID layer : LSET::AllLayersMask() )
1918 {
1919 // Canonical name
1920 layerEnum.Map( layer, LSET::Name( layer ) );
1921
1922 // User name
1923 layerEnum.Map( layer, GetBoard()->GetLayerName( layer ) );
1924 }
1925
1926 // Sync visibility with canvas
1927 for( PCB_LAYER_ID layer : LSET::AllLayersMask() )
1928 GetCanvas()->GetView()->SetLayerVisible( layer, GetBoard()->IsLayerVisible( layer ) );
1929
1930 // Stackup and/or color theme may have changed
1933}
1934
1935
1937{
1938 // switches currently used canvas (Cairo / OpenGL).
1939 PCB_BASE_FRAME::SwitchCanvas( aCanvasType );
1940}
1941
1942
1944{
1945 if( !m_findDialog )
1946 {
1947 m_findDialog = new DIALOG_FIND( this );
1950 }
1951
1952 wxString findString;
1953
1954 PCB_SELECTION& selection = m_toolManager->GetTool<PCB_SELECTION_TOOL>()->GetSelection();
1955
1956 if( selection.Size() == 1 )
1957 {
1958 EDA_ITEM* front = selection.Front();
1959
1960 switch( front->Type() )
1961 {
1962 case PCB_FOOTPRINT_T:
1963 findString = UnescapeString( static_cast<FOOTPRINT*>( front )->GetValue() );
1964 break;
1965
1966 case PCB_FIELD_T:
1967 case PCB_TEXT_T:
1968 findString = UnescapeString( static_cast<PCB_TEXT*>( front )->GetText() );
1969
1970 if( findString.Contains( wxT( "\n" ) ) )
1971 findString = findString.Before( '\n' );
1972
1973 break;
1974
1975 default:
1976 break;
1977 }
1978 }
1979
1980 m_findDialog->Preload( findString );
1981
1982 m_findDialog->Show( true );
1983}
1984
1985
1986void PCB_EDIT_FRAME::FindNext( bool reverse )
1987{
1988 if( !m_findDialog )
1990
1991 m_findDialog->FindNext( reverse );
1992}
1993
1994
1996{
1997 if( Kiface().IsSingle() )
1998 return 0;
1999
2000 // Update PCB requires a netlist. Therefore the schematic editor must be running
2001 // If this is not the case, open the schematic editor
2002 KIWAY_PLAYER* frame = Kiway().Player( FRAME_SCH, true );
2003
2004 // If Kiway() cannot create the eeschema frame, it shows a error message, and
2005 // frame is null
2006 if( !frame )
2007 return -1;
2008
2009 if( !frame->IsShownOnScreen() )
2010 {
2011 wxEventBlocker blocker( this );
2012 wxFileName fn( Prj().GetProjectPath(), Prj().GetProjectName(),
2014
2015 // Maybe the file hasn't been converted to the new s-expression file format so
2016 // see if the legacy schematic file is still in play.
2017 if( !fn.FileExists() )
2018 {
2020
2021 if( !fn.FileExists() )
2022 {
2023 DisplayErrorMessage( this, _( "The schematic for this board cannot be found." ) );
2024 return -2;
2025 }
2026 }
2027
2028 frame->OpenProjectFiles( std::vector<wxString>( 1, fn.GetFullPath() ) );
2029
2030 // we show the schematic editor frame, because do not show is seen as
2031 // a not yet opened schematic by Kicad manager, which is not the case
2032 frame->Show( true );
2033
2034 // bring ourselves back to the front
2035 Raise();
2036 }
2037
2038 return 1; //Success!
2039}
2040
2041
2043 const wxString& aAnnotateMessage )
2044{
2045 int standalone = TestStandalone();
2046
2047 if( standalone == 0 )
2048 {
2049 DisplayErrorMessage( this, _( "Cannot update the PCB because PCB editor is opened in "
2050 "stand-alone mode. In order to create or update PCBs from "
2051 "schematics, you must launch the KiCad project manager and "
2052 "create a project." ) );
2053 return false; // Not in standalone mode
2054 }
2055
2056 if( standalone < 0 ) // Problem with Eeschema or the schematic
2057 return false;
2058
2059 Raise(); // Show
2060
2061 std::string payload( aAnnotateMessage );
2062
2063 Kiway().ExpressMail( FRAME_SCH, MAIL_SCH_GET_NETLIST, payload, this );
2064
2065 if( payload == aAnnotateMessage )
2066 {
2067 Raise();
2068 DisplayErrorMessage( this, aAnnotateMessage );
2069 return false;
2070 }
2071
2072 try
2073 {
2074 auto lineReader = new STRING_LINE_READER( payload, _( "Eeschema netlist" ) );
2075 KICAD_NETLIST_READER netlistReader( lineReader, &aNetlist );
2076 netlistReader.LoadNetlist();
2077 }
2078 catch( const IO_ERROR& e )
2079 {
2080 Raise();
2081
2082 // Do not translate extra_info strings. These are for developers
2083 wxString extra_info = e.Problem() + wxT( " : " ) + e.What() + wxT( " at " ) + e.Where();
2084
2085 DisplayErrorMessage( this, _( "Received an error while reading netlist. Please "
2086 "report this issue to the KiCad team using the menu "
2087 "Help->Report Bug."), extra_info );
2088 return false;
2089 }
2090
2091 return true;
2092}
2093
2094
2096{
2097 const ENV_VAR_MAP& vars = Pgm().GetLocalEnvVariables();
2098
2099 // Set the environment variables for python scripts
2100 // note: the string will be encoded UTF8 for python env
2101 for( const std::pair<const wxString, ENV_VAR_ITEM>& var : vars )
2102 UpdatePythonEnvVar( var.first, var.second.GetValue() );
2103
2104 // Because the env vars can be modified by the python scripts (rewritten in UTF8),
2105 // regenerate them (in Unicode) for our normal environment
2106 for( const std::pair<const wxString, ENV_VAR_ITEM>& var : vars )
2107 wxSetEnv( var.first, var.second.GetValue() );
2108}
2109
2110
2112{
2113 wxString evValue;
2114 wxGetEnv( PROJECT_VAR_NAME, &evValue );
2115 UpdatePythonEnvVar( wxString( PROJECT_VAR_NAME ).ToStdString(), evValue );
2116
2117 // Because PROJECT_VAR_NAME can be modified by the python scripts (rewritten in UTF8),
2118 // regenerate it (in Unicode) for our normal environment
2119 wxSetEnv( PROJECT_VAR_NAME, evValue );
2120}
2121
2122
2124{
2125 if( aFootprint == nullptr )
2126 return;
2127
2129
2130 /*
2131 * Make sure dlg is destroyed before GetCanvas->Refresh is called
2132 * later or the refresh will try to modify its properties since
2133 * they share a GL context.
2134 */
2135 {
2136 DIALOG_FOOTPRINT_PROPERTIES dlg( this, aFootprint );
2137
2138 dlg.ShowQuasiModal();
2139 retvalue = dlg.GetReturnValue();
2140 }
2141
2142 /*
2143 * retvalue =
2144 * FP_PROPS_UPDATE_FP to show Update Footprints dialog
2145 * FP_PROPS_CHANGE_FP to show Change Footprints dialog
2146 * FP_PROPS_OK for normal edit
2147 * FP_PROPS_CANCEL if aborted
2148 * FP_PROPS_EDIT_BOARD_FP to load board footprint into Footprint Editor
2149 * FP_PROPS_EDIT_LIBRARY_FP to load library footprint into Footprint Editor
2150 */
2151
2153 {
2154 // If something edited, push a refresh request
2155 GetCanvas()->Refresh();
2156 }
2158 {
2159 if( KIWAY_PLAYER* frame = Kiway().Player( FRAME_FOOTPRINT_EDITOR, true ) )
2160 {
2161 FOOTPRINT_EDIT_FRAME* fp_editor = static_cast<FOOTPRINT_EDIT_FRAME*>( frame );
2162
2163 fp_editor->LoadFootprintFromBoard( aFootprint );
2164 fp_editor->Show( true );
2165 fp_editor->Raise(); // Iconize( false );
2166 }
2167 }
2169 {
2170 if( KIWAY_PLAYER* frame = Kiway().Player( FRAME_FOOTPRINT_EDITOR, true ) )
2171 {
2172 FOOTPRINT_EDIT_FRAME* fp_editor = static_cast<FOOTPRINT_EDIT_FRAME*>( frame );
2173
2174 fp_editor->LoadFootprintFromLibrary( aFootprint->GetFPID() );
2175 fp_editor->Show( true );
2176 fp_editor->Raise(); // Iconize( false );
2177 }
2178 }
2180 {
2181 ShowExchangeFootprintsDialog( aFootprint, true, true );
2182 }
2184 {
2185 ShowExchangeFootprintsDialog( aFootprint, false, true );
2186 }
2187}
2188
2189
2191 bool aSelectedMode )
2192{
2193 DIALOG_EXCHANGE_FOOTPRINTS dialog( this, aFootprint, aUpdateMode, aSelectedMode );
2194
2195 return dialog.ShowQuasiModal();
2196}
2197
2198
2210static void processTextItem( const PCB_TEXT& aSrc, PCB_TEXT& aDest,
2211 bool aResetText, bool aResetTextLayers, bool aResetTextEffects,
2212 bool* aUpdated )
2213{
2214 if( aResetText )
2215 *aUpdated |= aSrc.GetText() != aDest.GetText();
2216 else
2217 aDest.SetText( aSrc.GetText() );
2218
2219 if( aResetTextLayers )
2220 {
2221 *aUpdated |= aSrc.GetLayer() != aDest.GetLayer();
2222 *aUpdated |= aSrc.IsVisible() != aDest.IsVisible();
2223 }
2224 else
2225 {
2226 aDest.SetLayer( aSrc.GetLayer() );
2227 aDest.SetVisible( aSrc.IsVisible() );
2228 }
2229
2230 if( aResetTextEffects )
2231 {
2232 *aUpdated |= aSrc.GetHorizJustify() != aDest.GetHorizJustify();
2233 *aUpdated |= aSrc.GetVertJustify() != aDest.GetVertJustify();
2234 *aUpdated |= aSrc.GetTextSize() != aDest.GetTextSize();
2235 *aUpdated |= aSrc.GetTextThickness() != aDest.GetTextThickness();
2236 *aUpdated |= aSrc.GetTextAngle() != aDest.GetTextAngle();
2237 *aUpdated |= aSrc.GetFPRelativePosition() != aDest.GetFPRelativePosition();
2238 }
2239 else
2240 {
2241 // Careful: SetAttributes() will clobber the position
2242 aDest.SetAttributes( aSrc );
2244 }
2245
2246 aDest.SetLocked( aSrc.IsLocked() );
2247 const_cast<KIID&>( aDest.m_Uuid ) = aSrc.m_Uuid;
2248}
2249
2250
2251static PCB_TEXT* getMatchingTextItem( PCB_TEXT* aRefItem, FOOTPRINT* aFootprint )
2252{
2253 std::vector<PCB_TEXT*> candidates;
2254
2255 for( BOARD_ITEM* item : aFootprint->GraphicalItems() )
2256 {
2257 PCB_TEXT* candidate = dynamic_cast<PCB_TEXT*>( item );
2258
2259 if( candidate && candidate->GetText() == aRefItem->GetText() )
2260 candidates.push_back( candidate );
2261 }
2262
2263 if( candidates.size() == 0 )
2264 return nullptr;
2265
2266 if( candidates.size() == 1 )
2267 return candidates[0];
2268
2269 // Try refining the match by layer
2270 std::vector<PCB_TEXT*> candidatesOnSameLayer;
2271
2272 for( PCB_TEXT* candidate : candidates )
2273 {
2274 if( candidate->GetLayer() == aRefItem->GetLayer() )
2275 candidatesOnSameLayer.push_back( candidate );
2276 }
2277
2278 if( candidatesOnSameLayer.size() == 1 )
2279 return candidatesOnSameLayer[0];
2280
2281 // Last ditch effort: refine by position
2282 std::vector<PCB_TEXT*> candidatesAtSamePos;
2283
2284 for( PCB_TEXT* candidate : candidatesOnSameLayer.size() ? candidatesOnSameLayer : candidates )
2285 {
2286 if( candidate->GetFPRelativePosition() == aRefItem->GetFPRelativePosition() )
2287 candidatesAtSamePos.push_back( candidate );
2288 }
2289
2290 if( candidatesAtSamePos.size() > 0 )
2291 return candidatesAtSamePos[0];
2292 else if( candidatesOnSameLayer.size() > 0 )
2293 return candidatesOnSameLayer[0];
2294 else
2295 return candidates[0];
2296}
2297
2298
2300 BOARD_COMMIT& aCommit,
2301 bool deleteExtraTexts,
2302 bool resetTextLayers,
2303 bool resetTextEffects,
2304 bool resetTextContent,
2305 bool resetFabricationAttrs,
2306 bool resetClearanceOverrides,
2307 bool reset3DModels,
2308 bool* aUpdated )
2309{
2310 EDA_GROUP* parentGroup = aExisting->GetParentGroup();
2311 bool dummyBool = false;
2312
2313 if( !aUpdated )
2314 aUpdated = &dummyBool;
2315
2316 if( parentGroup )
2317 {
2318 aCommit.Modify( parentGroup->AsEdaItem(), nullptr, RECURSE_MODE::NO_RECURSE );
2319 parentGroup->RemoveItem( aExisting );
2320 parentGroup->AddItem( aNew );
2321 }
2322
2323 aNew->SetParent( GetBoard() );
2324
2325 PlaceFootprint( aNew, false );
2326
2327 // PlaceFootprint will move the footprint to the cursor position, which we don't want. Copy
2328 // the original position across.
2329 aNew->SetPosition( aExisting->GetPosition() );
2330
2331 if( aNew->GetLayer() != aExisting->GetLayer() )
2332 aNew->Flip( aNew->GetPosition(), GetPcbNewSettings()->m_FlipDirection );
2333
2334 if( aNew->GetOrientation() != aExisting->GetOrientation() )
2335 aNew->SetOrientation( aExisting->GetOrientation() );
2336
2337 aNew->SetLocked( aExisting->IsLocked() );
2338
2339 // Now transfer the net info from "old" pads to the new footprint
2340 for( PAD* newPad : aNew->Pads() )
2341 {
2342 PAD* oldPad = nullptr;
2343
2344 // Pads with no numbers can't be matched. (Then again, they're never connected to a
2345 // net either, so it's just the UUID retention that we can't perform.)
2346 if( newPad->GetNumber().IsEmpty() )
2347 {
2349 continue;
2350 }
2351
2352 // Search for a similar pad to reuse UUID and net info
2353 PAD* last_pad = nullptr;
2354
2355 while( true )
2356 {
2357 oldPad = aExisting->FindPadByNumber( newPad->GetNumber(), last_pad );
2358
2359 if( !oldPad )
2360 break;
2361
2362 if( newPad->IsOnCopperLayer() == oldPad->IsOnCopperLayer() ) // a candidate is found
2363 break;
2364
2365 last_pad = oldPad;
2366 }
2367
2368 if( oldPad )
2369 {
2370 const_cast<KIID&>( newPad->m_Uuid ) = oldPad->m_Uuid;
2371 newPad->SetLocalRatsnestVisible( oldPad->GetLocalRatsnestVisible() );
2372 newPad->SetPinFunction( oldPad->GetPinFunction() );
2373 newPad->SetPinType( oldPad->GetPinType() );
2374 }
2375
2376 if( newPad->IsOnCopperLayer() )
2377 newPad->SetNetCode( oldPad ? oldPad->GetNetCode() : NETINFO_LIST::UNCONNECTED );
2378 else
2379 newPad->SetNetCode( NETINFO_LIST::UNCONNECTED );
2380 }
2381
2382 std::set<PCB_TEXT*> handledTextItems;
2383
2384 for( BOARD_ITEM* oldItem : aExisting->GraphicalItems() )
2385 {
2386 PCB_TEXT* oldTextItem = dynamic_cast<PCB_TEXT*>( oldItem );
2387
2388 if( oldTextItem )
2389 {
2390 // Dimensions have PCB_TEXT base but are not treated like texts in the updater
2391 if( dynamic_cast<PCB_DIMENSION_BASE*>( oldTextItem ) )
2392 continue;
2393
2394 PCB_TEXT* newTextItem = getMatchingTextItem( oldTextItem, aNew );
2395
2396 if( newTextItem )
2397 {
2398 handledTextItems.insert( newTextItem );
2399 processTextItem( *oldTextItem, *newTextItem, resetTextContent, resetTextLayers,
2400 resetTextEffects, aUpdated );
2401 }
2402 else if( deleteExtraTexts )
2403 {
2404 *aUpdated = true;
2405 }
2406 else
2407 {
2408 newTextItem = static_cast<PCB_TEXT*>( oldTextItem->Clone() );
2409 handledTextItems.insert( newTextItem );
2410 aNew->Add( newTextItem );
2411 }
2412 }
2413 }
2414
2415 // Check for any newly-added text items and set the update flag as appropriate
2416 for( BOARD_ITEM* newItem : aNew->GraphicalItems() )
2417 {
2418 PCB_TEXT* newTextItem = dynamic_cast<PCB_TEXT*>( newItem );
2419
2420 if( newTextItem )
2421 {
2422 // Dimensions have PCB_TEXT base but are not treated like texts in the updater
2423 if( dynamic_cast<PCB_DIMENSION_BASE*>( newTextItem ) )
2424 continue;
2425
2426 if( !handledTextItems.contains( newTextItem ) )
2427 {
2428 *aUpdated = true;
2429 break;
2430 }
2431 }
2432 }
2433
2434 // Copy reference. The initial text is always used, never resetted
2435 processTextItem( aExisting->Reference(), aNew->Reference(), false, resetTextLayers,
2436 resetTextEffects, aUpdated );
2437
2438 // Copy value
2439 processTextItem( aExisting->Value(), aNew->Value(),
2440 // reset value text only when it is a proxy for the footprint ID
2441 // (cf replacing value "MountingHole-2.5mm" with "MountingHole-4.0mm")
2442 aExisting->GetValue() == aExisting->GetFPID().GetLibItemName().wx_str(),
2443 resetTextLayers, resetTextEffects, aUpdated );
2444
2445 std::set<PCB_FIELD*> handledFields;
2446
2447 // Copy fields in accordance with the reset* flags
2448 for( PCB_FIELD* oldField : aExisting->GetFields() )
2449 {
2450 // Reference and value are already handled
2451 if( oldField->IsReference() || oldField->IsValue() )
2452 continue;
2453
2454 PCB_FIELD* newField = aNew->GetField( oldField->GetName() );
2455
2456 if( newField )
2457 {
2458 handledFields.insert( newField );
2459 processTextItem( *oldField, *newField, resetTextContent, resetTextLayers,
2460 resetTextEffects, aUpdated );
2461 }
2462 else if( deleteExtraTexts )
2463 {
2464 *aUpdated = true;
2465 }
2466 else
2467 {
2468 newField = new PCB_FIELD( *oldField );
2469 handledFields.insert( newField );
2470 aNew->Add( newField );
2471 }
2472 }
2473
2474 // Check for any newly-added fields and set the update flag as appropriate
2475 for( PCB_FIELD* newField : aNew->GetFields() )
2476 {
2477 // Reference and value are already handled
2478 if( newField->IsReference() || newField->IsValue() )
2479 continue;
2480
2481 if( !handledFields.contains( newField ) )
2482 {
2483 *aUpdated = true;
2484 break;
2485 }
2486 }
2487
2488 if( resetFabricationAttrs )
2489 {
2490 // We've replaced the existing footprint with the library one, so the fabrication attrs
2491 // are already reset. Just set the aUpdated flag if appropriate.
2492 if( aNew->GetAttributes() != aExisting->GetAttributes() )
2493 *aUpdated = true;
2494 }
2495 else
2496 {
2497 aNew->SetAttributes( aExisting->GetAttributes() );
2498 }
2499
2500 if( resetClearanceOverrides )
2501 {
2502 if( aExisting->AllowSolderMaskBridges() != aNew->AllowSolderMaskBridges() )
2503 *aUpdated = true;
2504
2505 if( ( aExisting->GetLocalClearance() != aNew->GetLocalClearance() )
2506 || ( aExisting->GetLocalSolderMaskMargin() != aNew->GetLocalSolderMaskMargin() )
2507 || ( aExisting->GetLocalSolderPasteMargin() != aNew->GetLocalSolderPasteMargin() )
2509 || ( aExisting->GetLocalZoneConnection() != aNew->GetLocalZoneConnection() ) )
2510 {
2511 *aUpdated = true;
2512 }
2513 }
2514 else
2515 {
2516 aNew->SetLocalClearance( aExisting->GetLocalClearance() );
2520 aNew->SetLocalZoneConnection( aExisting->GetLocalZoneConnection() );
2522 }
2523
2524 if( reset3DModels )
2525 {
2526 // We've replaced the existing footprint with the library one, so the 3D models are
2527 // already reset. Just set the aUpdated flag if appropriate.
2528 if( aNew->Models().size() != aExisting->Models().size() )
2529 {
2530 *aUpdated = true;
2531 }
2532 else
2533 {
2534 for( size_t ii = 0; ii < aNew->Models().size(); ++ii )
2535 {
2536 if( aNew->Models()[ii] != aExisting->Models()[ii] )
2537 {
2538 *aUpdated = true;
2539 break;
2540 }
2541 }
2542 }
2543 }
2544 else
2545 {
2546 aNew->Models() = aExisting->Models(); // Linked list of 3D models.
2547 }
2548
2549 // Updating other parameters
2550 const_cast<KIID&>( aNew->m_Uuid ) = aExisting->m_Uuid;
2551 aNew->SetPath( aExisting->GetPath() );
2552 aNew->SetSheetfile( aExisting->GetSheetfile() );
2553 aNew->SetSheetname( aExisting->GetSheetname() );
2554 aNew->SetFilters( aExisting->GetFilters() );
2555 aNew->SetStaticComponentClass( aExisting->GetComponentClass() );
2556
2557 if( *aUpdated == false )
2558 {
2559 // Check pad shapes, graphics, zones, etc. for changes
2561 *aUpdated = true;
2562 }
2563
2564 aCommit.Remove( aExisting );
2565 aCommit.Add( aNew );
2566
2567 aNew->ClearFlags();
2568}
2569
2570
2572{
2574
2576
2577 SetElementVisibility( LAYER_RATSNEST, GetPcbNewSettings()->m_Display.m_ShowGlobalRatsnest );
2578
2580
2581 // Netclass definitions could have changed, either by us or by Eeschema, so we need to
2582 // recompile the implicit rules
2583 DRC_TOOL* drcTool = m_toolManager->GetTool<DRC_TOOL>();
2584 WX_INFOBAR* infobar = GetInfoBar();
2585
2586 try
2587 {
2588 drcTool->GetDRCEngine()->InitEngine( GetDesignRulesPath() );
2589
2590 if( infobar->GetMessageType() == WX_INFOBAR::MESSAGE_TYPE::DRC_RULES_ERROR )
2591 infobar->Dismiss();
2592 }
2593 catch( PARSE_ERROR& )
2594 {
2595 wxHyperlinkCtrl* button = new wxHyperlinkCtrl( infobar, wxID_ANY, _( "Edit design rules" ),
2596 wxEmptyString );
2597
2598 button->Bind( wxEVT_COMMAND_HYPERLINK, std::function<void( wxHyperlinkEvent& aEvent )>(
2599 [&]( wxHyperlinkEvent& aEvent )
2600 {
2601 ShowBoardSetupDialog( _( "Custom Rules" ) );
2602 } ) );
2603
2604 infobar->RemoveAllButtons();
2605 infobar->AddButton( button );
2606 infobar->AddCloseButton();
2607 infobar->ShowMessage( _( "Could not compile custom design rules." ), wxICON_ERROR,
2609 }
2610
2613
2614 // Update the environment variables in the Python interpreter
2615 if( aFlags & ENVVARS_CHANGED )
2617
2618 Layout();
2619 SendSizeEvent();
2620}
2621
2622
2624{
2626}
2627
2628
2630{
2632}
2633
2634
2636{
2637 // For now, be conservative: Don't allow any API use while the user is changing things
2638 if( GetToolManager()->GetCurrentTool() != GetToolManager()->GetTool<PCB_SELECTION_TOOL>() )
2639 return false;
2640
2642
2643 if( zoneFillerTool->IsBusy() )
2644 return false;
2645
2646 ROUTER_TOOL* routerTool = m_toolManager->GetTool<ROUTER_TOOL>();
2647
2648 if( routerTool && routerTool->RoutingInProgress() )
2649 return false;
2650
2652}
2653
2654
2655
2657{
2658 return GetBoard()->GetFileName();
2659}
2660
2661
2663{
2664 return m_auimgr.GetPane( wxS( "LayersManager" ) ).IsShown();
2665}
2666
2667
2669{
2670 return m_auimgr.GetPane( PropertiesPaneName() ).IsShown();
2671}
2672
2673
2675{
2676 return m_auimgr.GetPane( NetInspectorPanelName() ).IsShown();
2677}
2678
2679
2680void PCB_EDIT_FRAME::onSize( wxSizeEvent& aEvent )
2681{
2682 if( IsShownOnScreen() )
2683 {
2684 // We only need this until the frame is done resizing and the final client size is
2685 // established.
2686 Unbind( wxEVT_SIZE, &PCB_EDIT_FRAME::onSize, this );
2688 }
2689
2690 // Skip() is called in the base class.
2691 EDA_DRAW_FRAME::OnSize( aEvent );
2692}
2693
2694
2696{
2698 {
2700 _( "Violation Report" ) );
2701 }
2702
2703 return m_inspectDrcErrorDlg;
2704}
2705
2706
2708{
2710 {
2712 _( "Clearance Report" ) );
2713 }
2714
2715 return m_inspectClearanceDlg;
2716}
2717
2718
2720{
2722 {
2724 _( "Constraints Report" ) );
2725 }
2726
2728}
2729
2730
2732{
2733 if( !m_footprintDiffDlg )
2734 {
2736 _( "Compare Footprint with Library" ) );
2737 }
2738
2739 return m_footprintDiffDlg;
2740}
2741
2742
2744{
2745 if( m_inspectDrcErrorDlg && aEvent.GetString() == INSPECT_DRC_ERROR_DIALOG_NAME )
2746 {
2747 m_inspectDrcErrorDlg->Destroy();
2748 m_inspectDrcErrorDlg = nullptr;
2749 }
2750 else if( m_inspectClearanceDlg && aEvent.GetString() == INSPECT_CLEARANCE_DIALOG_NAME )
2751 {
2752 m_inspectClearanceDlg->Destroy();
2753 m_inspectClearanceDlg = nullptr;
2754 }
2755 else if( m_inspectConstraintsDlg && aEvent.GetString() == INSPECT_CONSTRAINTS_DIALOG_NAME )
2756 {
2757 m_inspectConstraintsDlg->Destroy();
2758 m_inspectConstraintsDlg = nullptr;
2759 }
2760 else if( m_footprintDiffDlg && aEvent.GetString() == INSPECT_CONSTRAINTS_DIALOG_NAME )
2761 {
2762 m_footprintDiffDlg->Destroy();
2763 m_footprintDiffDlg = nullptr;
2764 }
2765}
2766
2767#ifdef KICAD_IPC_API
2768void PCB_EDIT_FRAME::onPluginAvailabilityChanged( wxCommandEvent& aEvt )
2769{
2770 wxLogTrace( traceApi, "PCB frame: EDA_EVT_PLUGIN_AVAILABILITY_CHANGED" );
2772 aEvt.Skip();
2773}
2774#endif
2775
2776
2778{
2779 PCB_LAYER_ID curLayer = GetActiveLayer();
2780 const PCB_DISPLAY_OPTIONS& displ_opts = GetDisplayOptions();
2781
2782 // Check if the specified layer matches the present layer
2783 if( layer == curLayer )
2784 return;
2785
2786 // Copper layers cannot be selected unconditionally; how many of those layers are currently
2787 // enabled needs to be checked.
2788 if( IsCopperLayer( layer ) )
2789 {
2790 if( layer > GetBoard()->GetCopperLayerStackMaxId() )
2791 return;
2792 }
2793
2794 // Is yet more checking required? E.g. when the layer to be selected is a non-copper layer,
2795 // or when switching between a copper layer and a non-copper layer, or vice-versa?
2796
2797 SetActiveLayer( layer );
2798
2799 if( displ_opts.m_ContrastModeDisplay != HIGH_CONTRAST_MODE::NORMAL )
2800 GetCanvas()->Refresh();
2801}
2802
2803
2805{
2806 switch( aItem->Type() )
2807 {
2810 break;
2811
2812 case PCB_FIELD_T:
2813 case PCB_TEXT_T:
2814 ShowTextPropertiesDialog( static_cast<PCB_TEXT*>( aItem ) );
2815 break;
2816
2817 case PCB_TEXTBOX_T:
2818 ShowTextBoxPropertiesDialog( static_cast<PCB_TEXTBOX*>( aItem ) );
2819 break;
2820
2821 case PCB_TABLE_T:
2822 {
2823 DIALOG_TABLE_PROPERTIES dlg( this, static_cast<PCB_TABLE*>( aItem ) );
2824
2825 //QuasiModal required for Scintilla auto-complete
2826 dlg.ShowQuasiModal();
2827 break;
2828 }
2829
2830 case PCB_PAD_T:
2831 ShowPadPropertiesDialog( static_cast<PAD*>( aItem ) );
2832 break;
2833
2834 case PCB_FOOTPRINT_T:
2835 ShowFootprintPropertiesDialog( static_cast<FOOTPRINT*>( aItem ) );
2836 break;
2837
2838 case PCB_TARGET_T:
2839 ShowTargetOptionsDialog( static_cast<PCB_TARGET*>( aItem ) );
2840 break;
2841
2842 case PCB_DIM_ALIGNED_T:
2843 case PCB_DIM_CENTER_T:
2844 case PCB_DIM_RADIAL_T:
2846 case PCB_DIM_LEADER_T:
2847 {
2848 DIALOG_DIMENSION_PROPERTIES dlg( this, static_cast<PCB_DIMENSION_BASE*>( aItem ) );
2849
2850 // TODO: why is this QuasiModal?
2851 dlg.ShowQuasiModal();
2852 break;
2853 }
2854
2855 case PCB_SHAPE_T:
2856 ShowGraphicItemPropertiesDialog( static_cast<PCB_SHAPE*>( aItem ) );
2857 break;
2858
2859 case PCB_ZONE_T:
2860 Edit_Zone_Params( static_cast<ZONE*>( aItem ) );
2861 break;
2862
2863 case PCB_GROUP_T:
2865 static_cast<EDA_GROUP*>( static_cast<PCB_GROUP*>( aItem ) ) );
2866 break;
2867
2868 case PCB_GENERATOR_T:
2869 static_cast<PCB_GENERATOR*>( aItem )->ShowPropertiesDialog( this );
2870 break;
2871
2872 case PCB_MARKER_T:
2873 m_toolManager->GetTool<DRC_TOOL>()->CrossProbe( static_cast<PCB_MARKER*>( aItem ) );
2874 break;
2875
2876 default:
2877 break;
2878 }
2879}
2880
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:112
KIFACE_BASE & Kiface()
Global KIFACE_BASE "get" accessor.
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
Definition: bitmap.cpp:104
@ icon_pcbnew_32
@ icon_pcbnew_16
constexpr BOX2I BOX2ISafe(const BOX2D &aInput)
Definition: box2.h:929
static TOOL_ACTION toggleGrid
Definition: actions.h:195
static TOOL_ACTION paste
Definition: actions.h:80
static TOOL_ACTION millimetersUnits
Definition: actions.h:203
static TOOL_ACTION unselectAll
Definition: actions.h:83
static TOOL_ACTION togglePolarCoords
Definition: actions.h:206
static TOOL_ACTION copy
Definition: actions.h:78
static TOOL_ACTION pluginsReload
Definition: actions.h:291
static TOOL_ACTION group
Definition: actions.h:236
static TOOL_ACTION pasteSpecial
Definition: actions.h:81
static TOOL_ACTION groupProperties
Definition: actions.h:244
static TOOL_ACTION pointEditorArcKeepCenter
Definition: actions.h:270
static TOOL_ACTION milsUnits
Definition: actions.h:202
static TOOL_ACTION ungroup
Definition: actions.h:237
static TOOL_ACTION toggleBoundingBoxes
Definition: actions.h:154
static TOOL_ACTION pointEditorArcKeepRadius
Definition: actions.h:272
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:201
static TOOL_ACTION highContrastMode
Definition: actions.h:152
static TOOL_ACTION embeddedFiles
Definition: actions.h:294
static TOOL_ACTION toggleCursorStyle
Definition: actions.h:151
static TOOL_ACTION measureTool
Definition: actions.h:249
static TOOL_ACTION doDelete
Definition: actions.h:85
static TOOL_ACTION selectionTool
Definition: actions.h:248
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:263
static TOOL_ACTION cut
Definition: actions.h:77
static TOOL_ACTION gridSetOrigin
Definition: actions.h:192
static TOOL_ACTION toggleGridOverrides
Definition: actions.h:196
static TOOL_ACTION selectAll
Definition: actions.h:82
static TOOL_ACTION pointEditorArcKeepEndpoint
Definition: actions.h:271
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:108
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:79
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition: board_item.h:232
void SetLocked(bool aLocked) override
Definition: board_item.h:323
bool IsLocked() const override
Definition: board_item.cpp:103
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:346
@ INSTANCE_TO_INSTANCE
Definition: board_item.h:436
void SetFPRelativePosition(const VECTOR2I &aPos)
Definition: board_item.cpp:360
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:317
void BuildListOfNets()
Definition: board.h:897
bool IsElementVisible(GAL_LAYER_ID aLayer) const
Test whether a given element category is visible.
Definition: board.cpp:973
void RemoveAllListeners()
Remove all listeners.
Definition: board.cpp:2800
const PAGE_INFO & GetPageSettings() const
Definition: board.h:742
GAL_SET GetVisibleElements() const
Return a set of all the element categories that are visible.
Definition: board.cpp:967
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:186
void SynchronizeNetsAndNetClasses(bool aResetTrackAndViaSizes)
Copy NETCLASS info to each NET, based on NET membership in a NETCLASS.
Definition: board.cpp:2234
void SynchronizeTimeDomainProperties()
Ensure that all time domain properties providers are in sync with current settings.
Definition: board.cpp:2228
TITLE_BLOCK & GetTitleBlock()
Definition: board.h:748
const std::map< wxString, wxString > & GetProperties() const
Definition: board.h:393
void SetProject(PROJECT *aProject, bool aReferenceOnly=false)
Link a board to a given project.
Definition: board.cpp:196
const wxString & GetFileName() const
Definition: board.h:354
void SetElementVisibility(GAL_LAYER_ID aLayer, bool aNewState)
Change the visibility of an element category.
Definition: board.cpp:979
void ClearProject()
Definition: board.cpp:234
PROJECT * GetProject() const
Definition: board.h:538
bool IsEmpty() const
Definition: board.h:417
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:1912
const LSET & GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
Definition: board.cpp:907
void UpdateRatsnestExclusions()
Update the visibility flags on the current unconnected ratsnest lines.
Definition: board.cpp:298
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Return a list of missing connections between components/tracks.
Definition: board.h:522
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:91
COMMIT & Modify(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr, RECURSE_MODE aRecurse=RECURSE_MODE::NO_RECURSE)
Modify a given item in the model.
Definition: commit.h:107
COMMIT & Add(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Add a new item to the model.
Definition: commit.h:79
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:65
bool Show(bool show=true) override
The Show method is overridden to make the search combobox focused by default.
void Preload(const wxString &aFindString)
Definition: dialog_find.cpp:96
void FindNext(bool reverse)
Finds the next item.
Definition: dialog_find.h:73
enum FP_PROPS_RETVALUE GetReturnValue()
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:46
void RemoveItem(EDA_ITEM *aItem)
Remove item from group.
Definition: eda_group.cpp:40
void AddItem(EDA_ITEM *aItem)
Add item to group.
Definition: eda_group.cpp:27
virtual EDA_ITEM * AsEdaItem()=0
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:98
const KIID m_Uuid
Definition: eda_item.h:516
virtual EDA_GROUP * GetParentGroup() const
Definition: eda_item.h:116
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:110
void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: eda_item.h:144
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:113
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:79
const EDA_ANGLE & GetTextAngle() const
Definition: eda_text.h:144
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:97
virtual bool IsVisible() const
Definition: eda_text.h:184
void SetAttributes(const EDA_TEXT &aSrc, bool aSetPosition=true)
Set the text attributes from another instance.
Definition: eda_text.cpp:433
GR_TEXT_H_ALIGN_T GetHorizJustify() const
Definition: eda_text.h:197
virtual void SetVisible(bool aVisible)
Definition: eda_text.cpp:386
GR_TEXT_V_ALIGN_T GetVertJustify() const
Definition: eda_text.h:200
virtual void SetText(const wxString &aText)
Definition: eda_text.cpp:270
int GetTextThickness() const
Definition: eda_text.h:125
VECTOR2I GetTextSize() const
Definition: eda_text.h:258
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:703
static ENUM_MAP< T > & Instance()
Definition: property.h:697
ENUM_MAP & Undefined(T aValue)
Definition: property.h:710
wxPGChoices & Choices()
Definition: property.h:746
void LoadFootprintFromLibrary(LIB_ID aFPID)
bool LoadFootprintFromBoard(FOOTPRINT *aFootprint)
Load a footprint from the main board into the Footprint Editor.
Component library viewer main window.
bool AllowSolderMaskBridges() const
Definition: footprint.h:299
void SetPosition(const VECTOR2I &aPos) override
Definition: footprint.cpp:2513
ZONE_CONNECTION GetLocalZoneConnection() const
Definition: footprint.h:291
void SetLocked(bool isLocked) override
Set the #MODULE_is_LOCKED bit in the m_ModuleStatus.
Definition: footprint.h:430
EDA_ANGLE GetOrientation() const
Definition: footprint.h:230
void SetOrientation(const EDA_ANGLE &aNewAngle)
Definition: footprint.cpp:2595
void SetAllowSolderMaskBridges(bool aAllow)
Definition: footprint.h:300
void SetLocalSolderPasteMarginRatio(std::optional< double > aRatio)
Definition: footprint.h:288
wxString GetSheetname() const
Definition: footprint.h:269
void SetPath(const KIID_PATH &aPath)
Definition: footprint.h:267
void SetFilters(const wxString &aFilters)
Definition: footprint.h:276
void SetStaticComponentClass(const COMPONENT_CLASS *aClass) const
Sets the component class object pointer for this footprint.
Definition: footprint.cpp:4104
bool FootprintNeedsUpdate(const FOOTPRINT *aLibFP, int aCompareFlags=0, REPORTER *aReporter=nullptr)
Return true if a board footprint differs from the library version.
void SetAttributes(int aAttributes)
Definition: footprint.h:294
void SetSheetfile(const wxString &aSheetfile)
Definition: footprint.h:273
std::optional< int > GetLocalSolderPasteMargin() const
Definition: footprint.h:284
PCB_FIELD & Value()
read/write accessors:
Definition: footprint.h:663
std::optional< int > GetLocalClearance() const
Definition: footprint.h:278
PCB_FIELD * GetField(FIELD_T aFieldType)
Return a mandatory field in this footprint.
Definition: footprint.cpp:593
std::deque< PAD * > & Pads()
Definition: footprint.h:209
int GetAttributes() const
Definition: footprint.h:293
const COMPONENT_CLASS * GetComponentClass() const
Returns the component class for this footprint.
Definition: footprint.cpp:4122
void SetLocalZoneConnection(ZONE_CONNECTION aType)
Definition: footprint.h:290
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
Definition: footprint.h:239
wxString GetSheetfile() const
Definition: footprint.h:272
const LIB_ID & GetFPID() const
Definition: footprint.h:251
bool IsLocked() const override
Definition: footprint.h:420
PCB_FIELD & Reference()
Definition: footprint.h:664
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
Definition: footprint.cpp:1080
std::optional< double > GetLocalSolderPasteMarginRatio() const
Definition: footprint.h:287
void Flip(const VECTOR2I &aCentre, FLIP_DIRECTION aFlipDirection) override
Flip this object, i.e.
Definition: footprint.cpp:2454
wxString GetFilters() const
Definition: footprint.h:275
void SetSheetname(const wxString &aSheetname)
Definition: footprint.h:270
void GetFields(std::vector< PCB_FIELD * > &aVector, bool aVisibleOnly) const
Populate a std::vector with PCB_TEXTs.
Definition: footprint.cpp:638
std::vector< FP_3DMODEL > & Models()
Definition: footprint.h:223
const wxString & GetValue() const
Definition: footprint.h:649
void SetLocalSolderMaskMargin(std::optional< int > aMargin)
Definition: footprint.h:282
void SetLocalClearance(std::optional< int > aClearance)
Definition: footprint.h:279
const KIID_PATH & GetPath() const
Definition: footprint.h:266
std::optional< int > GetLocalSolderMaskMargin() const
Definition: footprint.h:281
void SetLocalSolderPasteMargin(std::optional< int > aMargin)
Definition: footprint.h:285
VECTOR2I GetPosition() const override
Definition: footprint.h:227
DRAWINGS & GraphicalItems()
Definition: footprint.h:212
PAD * FindPadByNumber(const wxString &aPadNumber, PAD *aSearchAfterMe=nullptr) const
Return a PAD with a matching number.
Definition: footprint.cpp:2009
void ReadWindowSettings(WINDOW_SETTINGS &aCfg)
Read GAL config options from application-level config.
bool Contains(GAL_LAYER_ID aPos)
Definition: layer_ids.h:427
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:66
double GetScale() const
Definition: view.h:276
BOX2D GetViewport() const
Return the current viewport visible area rectangle.
Definition: view.cpp:530
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:1685
void SetLayerVisible(int aLayer, bool aVisible=true)
Control the visibility of a particular layer.
Definition: view.h:400
bool IsMirroredX() const
Return true if view is flipped across the X axis.
Definition: view.h:250
void UpdateAllItems(int aUpdateFlags)
Update all items in the view according to the given flags.
Definition: view.cpp:1561
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
Definition: view.h:220
void MarkTargetDirty(int aTarget)
Set or clear target 'dirty' flag.
Definition: view.h:639
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:1571
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:286
void OnKiCadExit()
Definition: kiway.cpp:694
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
Definition: kiway.cpp:395
virtual void ExpressMail(FRAME_T aDestination, MAIL_T aCommand, std::string &aPayload, wxWindow *aSource=nullptr)
Send aPayload to aDestination from aSource.
Definition: kiway.cpp:499
virtual void CommonSettingsChanged(int aFlags=0)
Call CommonSettingsChanged() on all KIWAY_PLAYERs.
Definition: kiway.cpp:589
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:296
static const LSET & AllLayersMask()
Definition: lset.cpp:624
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:274
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.
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:1083
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:539
static TOOL_ACTION drawRuleArea
Definition: pcb_actions.h:211
static TOOL_ACTION microwaveCreateGap
Definition: pcb_actions.h:528
static TOOL_ACTION drawBezier
Definition: pcb_actions.h:194
static TOOL_ACTION placeText
Definition: pcb_actions.h:196
static TOOL_ACTION drawOrthogonalDimension
Definition: pcb_actions.h:207
static TOOL_ACTION drawRectangle
Definition: pcb_actions.h:191
static TOOL_ACTION padDisplayMode
Definition: pcb_actions.h:319
static TOOL_ACTION placeReferenceImage
Definition: pcb_actions.h:195
static TOOL_ACTION showRatsnest
Definition: pcb_actions.h:314
static TOOL_ACTION showLayersManager
Definition: pcb_actions.h:451
static TOOL_ACTION toggleNetHighlight
Definition: pcb_actions.h:568
static TOOL_ACTION saveSelectionAsDesignBlock
Definition: pcb_actions.h:462
static TOOL_ACTION drawCircle
Definition: pcb_actions.h:192
static TOOL_ACTION routeDiffPair
Activation of the Push and Shove router (differential pair mode)
Definition: pcb_actions.h:245
static TOOL_ACTION tuneDiffPair
Definition: pcb_actions.h:248
static TOOL_ACTION saveToLinkedDesignBlock
Definition: pcb_actions.h:459
static TOOL_ACTION layerChanged
Definition: pcb_actions.h:372
static TOOL_ACTION ddAppendBoard
Drag and drop.
Definition: pcb_actions.h:597
static TOOL_ACTION highlightNet
Definition: pcb_actions.h:566
static TOOL_ACTION autoTrackWidth
Definition: pcb_actions.h:384
static TOOL_ACTION drawTable
Definition: pcb_actions.h:198
static TOOL_ACTION drawTextBox
Definition: pcb_actions.h:197
static TOOL_ACTION routerHighlightMode
Actions to enable switching modes via hotkey assignments.
Definition: pcb_actions.h:264
static TOOL_ACTION routerWalkaroundMode
Definition: pcb_actions.h:266
static TOOL_ACTION routerShoveMode
Definition: pcb_actions.h:265
static TOOL_ACTION drawZoneCutout
Definition: pcb_actions.h:212
static TOOL_ACTION drawPolygon
Definition: pcb_actions.h:190
static TOOL_ACTION hideNetInRatsnest
Definition: pcb_actions.h:573
static TOOL_ACTION zoneDisplayFilled
Definition: pcb_actions.h:321
static TOOL_ACTION showNetInRatsnest
Definition: pcb_actions.h:574
static TOOL_ACTION drawRadialDimension
Definition: pcb_actions.h:206
static TOOL_ACTION tuneSingleTrack
Definition: pcb_actions.h:247
static TOOL_ACTION viaDisplayMode
Definition: pcb_actions.h:320
static TOOL_ACTION drawLeader
Definition: pcb_actions.h:208
static TOOL_ACTION saveBoardAsDesignBlock
Definition: pcb_actions.h:461
static TOOL_ACTION drillOrigin
Definition: pcb_actions.h:550
static TOOL_ACTION tuneSkew
Definition: pcb_actions.h:249
static TOOL_ACTION trackDisplayMode
Definition: pcb_actions.h:318
static TOOL_ACTION showNetInspector
Definition: pcb_actions.h:452
static TOOL_ACTION microwaveCreateStubArc
Definition: pcb_actions.h:532
static TOOL_ACTION zoneDisplayTriangulated
Definition: pcb_actions.h:324
static TOOL_ACTION placeDesignBlock
Definition: pcb_actions.h:457
static TOOL_ACTION selectUnconnected
Select unconnected footprints from ratsnest of selection.
Definition: pcb_actions.h:88
static TOOL_ACTION zoneDisplayFractured
Definition: pcb_actions.h:323
static TOOL_ACTION drawVia
Definition: pcb_actions.h:210
static TOOL_ACTION drawArc
Definition: pcb_actions.h:193
static TOOL_ACTION zoneDuplicate
Duplicate zone onto another layer.
Definition: pcb_actions.h:399
static TOOL_ACTION graphicsOutlines
Display footprint graphics as outlines.
Definition: pcb_actions.h:511
static TOOL_ACTION drawSimilarZone
Definition: pcb_actions.h:213
static TOOL_ACTION showDesignBlockPanel
Definition: pcb_actions.h:460
static TOOL_ACTION drawCenterDimension
Definition: pcb_actions.h:205
static TOOL_ACTION selectSameSheet
Select all components on the same sheet as the selected footprint.
Definition: pcb_actions.h:97
static TOOL_ACTION microwaveCreateStub
Definition: pcb_actions.h:530
static TOOL_ACTION selectNet
Select all connections belonging to a single net.
Definition: pcb_actions.h:82
static TOOL_ACTION microwaveCreateLine
Definition: pcb_actions.h:536
static TOOL_ACTION flipBoard
Definition: pcb_actions.h:374
static TOOL_ACTION zoneDisplayOutline
Definition: pcb_actions.h:322
static TOOL_ACTION ratsnestLineMode
Definition: pcb_actions.h:315
static TOOL_ACTION textOutlines
Display texts as lines.
Definition: pcb_actions.h:514
static TOOL_ACTION highlightNetSelection
Definition: pcb_actions.h:569
static TOOL_ACTION microwaveCreateFunctionShape
Definition: pcb_actions.h:534
static TOOL_ACTION zoneMerge
Definition: pcb_actions.h:396
static TOOL_ACTION unlock
Definition: pcb_actions.h:544
static TOOL_ACTION placeFootprint
Definition: pcb_actions.h:216
static TOOL_ACTION routeSingleTrack
Activation of the Push and Shove router.
Definition: pcb_actions.h:242
static TOOL_ACTION createArray
Tool for creating an array of objects.
Definition: pcb_actions.h:508
static TOOL_ACTION deselectNet
Remove all connections belonging to a single net from the active selection.
Definition: pcb_actions.h:85
static TOOL_ACTION showPythonConsole
Definition: pcb_actions.h:453
static TOOL_ACTION drawLine
Definition: pcb_actions.h:189
static TOOL_ACTION placeLinkedDesignBlock
Definition: pcb_actions.h:458
static TOOL_ACTION localRatsnestTool
Definition: pcb_actions.h:575
static TOOL_ACTION drawAlignedDimension
Definition: pcb_actions.h:204
static TOOL_ACTION drawZone
Definition: pcb_actions.h:209
static TOOL_ACTION selectOnSchematic
Select symbols/pins on schematic corresponding to selected footprints/pads.
Definition: pcb_actions.h:100
static TOOL_ACTION lock
Definition: pcb_actions.h:543
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
int ShowTextBoxPropertiesDialog(PCB_TEXTBOX *aTextBox)
void unitsChangeRefresh() override
Called when when the units setting has changed to allow for any derived classes to handle refreshing ...
PCB_LAYER_BOX_SELECTOR * m_SelLayerBox
virtual void SetBoard(BOARD *aBoard, PROGRESS_REPORTER *aReporter=nullptr) override
Set the #m_Pcb member in such as way as to ensure deleting any previous BOARD.
std::unique_ptr< LAYER_PAIR_SETTINGS > m_layerPairSettings
APPEARANCE_CONTROLS * GetAppearancePanel()
APPEARANCE_CONTROLS * m_appearancePanel
void ShowReferenceImagePropertiesDialog(BOARD_ITEM *aBitmap)
Set the angle used for rotate operations.
PANEL_SELECTION_FILTER * m_selectionFilterPanel
void ShowGraphicItemPropertiesDialog(PCB_SHAPE *aShape)
void ActivateGalCanvas() override
Set the #m_Pcb member in such as way as to ensure deleting any previous BOARD.
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
void ShowPadPropertiesDialog(PAD *aPad)
const PCB_DISPLAY_OPTIONS & GetDisplayOptions() const
Display options control the way tracks, vias, outlines and other things are shown (for instance solid...
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
PCBNEW_SETTINGS * GetPcbNewSettings() const
virtual 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.
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 OnEditItemRequest(BOARD_ITEM *aItem) override
Install the corresponding dialog editor for the given item.
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 SwitchLayer(PCB_LAYER_ID layer) override
Change the active layer in the editor.
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 ShowTargetOptionsDialog(PCB_TARGET *aTarget)
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 resetClearanceOverrides=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 SetGridColor(const COLOR4D &aColor) override
void ProjectChanged() override
Notification event that the project has changed.
wxString GetLastPath(LAST_PATH_TYPE aType)
Get the last path for a particular type.
void ShowChangedLanguage() override
Redraw the menus and what not in current language.
void doCloseWindow() override
void ReCreateLayerBox(bool aForceResizeToolbar=true)
Recreate the layer box by clearing the old list and building a new one from the new layer names and c...
void SaveProjectLocalSettings() override
Save changes to the project local settings.
void PythonSyncProjectName()
Synchronize the project name from KiCad's environment into the Python interpreter.
bool m_show_layer_manager_tools
void ShowFindDialog()
Show the Find dialog.
void onSize(wxSizeEvent &aEvent)
int ShowExchangeFootprintsDialog(FOOTPRINT *aFootprint, bool aUpdateMode, bool aSelectedMode)
int TestStandalone()
Test if standalone mode.
void ShowFootprintPropertiesDialog(FOOTPRINT *aFootprint)
bool IsContentModified() const override
Get if the current board has been modified but not saved.
void PythonSyncEnvironmentVariables()
Synchronize the environment variables from KiCad's environment into the Python interpreter.
bool Clear_Pcb(bool doAskAboutUnsavedChanges, bool aFinal=false)
Delete all and reinitialize the current board.
Definition: initpcb.cpp:42
TOOL_ACTION * m_exportNetlistAction
The export board netlist tool action object.
void OnBoardLoaded()
Update the state of the GUI after a new board is loaded or created.
void Edit_Zone_Params(ZONE *zone_container)
Edit params (layer, clearance, ...) for a zone outline.
bool FetchNetlistFromSchematic(NETLIST &aNetlist, const wxString &aAnnotateMessage)
wxString GetCurrentFileName() const override
Get the full filename + path of the currently opened file in the frame.
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
DIALOG_BOOK_REPORTER * GetFootprintDiffDialog()
EDA_ANGLE GetRotationAngle() const override
Return the angle used for rotate operations.
COLOR4D GetGridColor() override
void UpdateTitle()
Set the main window title bar text.
DIALOG_BOOK_REPORTER * m_footprintDiffDlg
void ActivateGalCanvas() override
Set the #m_Pcb member in such as way as to ensure deleting any previous BOARD.
SELECTION & GetCurrentSelection() override
Get the current selection from the canvas area.
void OnQuit(wxCommandEvent &event)
void onCloseModelessBookReporterDialogs(wxCommandEvent &aEvent)
PCB_DESIGN_BLOCK_PANE * m_designBlocksPane
bool canCloseWindow(wxCloseEvent &aCloseEvent) override
DIALOG_BOARD_SETUP * m_boardSetupDlg
DIALOG_BOOK_REPORTER * GetInspectClearanceDialog()
wxTimer * m_eventCounterTimer
void Tracks_and_Vias_Size_Event(wxCommandEvent &event)
void SaveSettings(APP_SETTINGS_BASE *aCfg) override
Save common frame parameters to a configuration data file.
static const wxString SearchPaneName()
DIALOG_BOOK_REPORTER * m_inspectClearanceDlg
void OnFileHistory(wxCommandEvent &event)
DIALOG_BOOK_REPORTER * GetInspectConstraintsDialog()
A set of BOARD_ITEMs (i.e., without duplicates).
Definition: pcb_group.h:53
PCB net inspection panel.
Generic tool for picking an item.
Tool that displays edit points allowing to modify items by dragging the points.
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:475
Tool useful for viewing footprints.
virtual ENV_VAR_MAP & GetLocalEnvVariables() const
Definition: pgm_base.cpp:811
virtual const wxString & GetExecutablePath() const
Definition: pgm_base.cpp:879
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:68
std::vector< LAYER_PAIR_INFO > m_LayerPairInfos
List of stored 3D viewports (view matrixes)
Definition: project_file.h:206
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:210
void IncrementNetclassesTicker()
Definition: project.h:122
virtual PROJECT_FILE & GetProjectFile() const
Definition: project.h:204
void IncrementTextVarsTicker()
Definition: project.h:119
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:177
int Size() const
Returns the number of selected parts.
Definition: selection.h:121
Is a LINE_READER that reads from a multiline 8 bit wide std::string.
Definition: richio.h: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:371
@ 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:361
void ShowMessage(const wxString &aMessage, int aFlags=wxICON_INFORMATION) override
Show the info bar with the provided message and icon.
Definition: wx_infobar.cpp:156
Handle actions specific to filling copper zones.
PROGRESS_REPORTER * GetProgressReporter()
Handle a list of polygons defining a copper zone.
Definition: zone.h:74
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:129
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:41
#define _HKI(x)
#define _(s)
Declaration of the eda_3d_viewer class.
static constexpr EDA_ANGLE ANGLE_90
Definition: eda_angle.h:413
#define KICAD_DEFAULT_DRAWFRAME_STYLE
#define PCB_EDIT_FRAME_NAME
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
#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
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:27
@ ID_ON_GRID_SELECT
Definition: id.h:114
@ ID_FILE_LIST_CLEAR
Definition: id.h:62
@ ID_EDA_SOCKET_EVENT
Definition: id.h:132
@ ID_EDA_SOCKET_EVENT_SERV
Definition: id.h:131
@ ID_ON_ZOOM_SELECT
Definition: id.h:112
@ ID_FILEMAX
Definition: id.h:60
@ ID_FILE1
Definition: id.h:59
std::map< wxString, ENV_VAR_ITEM > ENV_VAR_MAP
PROJECT & Prj()
Definition: kicad.cpp:608
int GetNetnameLayer(int aLayer)
Return a netname layer corresponding to the given layer.
Definition: layer_ids.h:841
bool IsCopperLayer(int aLayerId)
Test whether a layer is a copper layer.
Definition: layer_ids.h:665
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:362
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
#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:19
@ ID_POPUP_PCB_SELECT_WIDTH1
Definition: pcbnew_id.h:23
@ ID_POPUP_PCB_SELECT_VIASIZE8
Definition: pcbnew_id.h:46
@ ID_AUX_TOOLBAR_PCB_VIA_SIZE
Definition: pcbnew_id.h:17
@ ID_POPUP_PCB_SELECT_WIDTH_END_RANGE
Definition: pcbnew_id.h:73
@ ID_POPUP_PCB_SELECT_VIASIZE1
Definition: pcbnew_id.h:39
@ ID_AUX_TOOLBAR_PCB_TRACK_WIDTH
Definition: pcbnew_id.h:18
void ScriptingOnDestructPcbEditFrame(PCB_EDIT_FRAME *aPcbEditFrame)
void Refresh()
Update the board display after modifying it by a python script (note: it is automatically called by a...
PGM_BASE & Pgm()
The global program "get" accessor.
Definition: pgm_base.cpp:902
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:429
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:92
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_SHAPE_T
class PCB_SHAPE, a segment not on copper layers
Definition: typeinfo.h:88
@ PCB_DIM_ORTHOGONAL_T
class PCB_DIM_ORTHOGONAL, a linear dimension constrained to x/y
Definition: typeinfo.h:105
@ PCB_DIM_LEADER_T
class PCB_DIM_LEADER, a leader dimension (graphic item)
Definition: typeinfo.h:102
@ PCB_GENERATOR_T
class PCB_GENERATOR, generator on a layer
Definition: typeinfo.h:91
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:97
@ PCB_DIM_CENTER_T
class PCB_DIM_CENTER, a center point marking (graphic item)
Definition: typeinfo.h:103
@ PCB_GROUP_T
class PCB_GROUP, a set of BOARD_ITEMs
Definition: typeinfo.h:110
@ PCB_TEXTBOX_T
class PCB_TEXTBOX, wrapped text on a layer
Definition: typeinfo.h:93
@ PCB_ZONE_T
class ZONE, a copper pour area
Definition: typeinfo.h:107
@ PCB_TEXT_T
class PCB_TEXT, text on a layer
Definition: typeinfo.h:92
@ PCB_REFERENCE_IMAGE_T
class PCB_REFERENCE_IMAGE, bitmap on a layer
Definition: typeinfo.h:89
@ PCB_FIELD_T
class PCB_FIELD, text associated with a footprint property
Definition: typeinfo.h:90
@ PCB_MARKER_T
class PCB_MARKER, a marker used to show something
Definition: typeinfo.h:99
@ PCB_TARGET_T
class PCB_TARGET, a target (graphic item)
Definition: typeinfo.h:106
@ PCB_FOOTPRINT_T
class FOOTPRINT, a footprint
Definition: typeinfo.h:86
@ PCB_DIM_ALIGNED_T
class PCB_DIM_ALIGNED, a linear dimension (graphic item)
Definition: typeinfo.h:101
@ PCB_PAD_T
class PAD, a pad in a footprint
Definition: typeinfo.h:87
@ PCB_ARC_T
class PCB_ARC, an arc track segment on a copper layer
Definition: typeinfo.h:98
@ PCB_TABLE_T
class PCB_TABLE, table of PCB_TABLECELLs
Definition: typeinfo.h:94
@ PCB_TRACE_T
class PCB_TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:96
@ PCB_DIM_RADIAL_T
class PCB_DIM_RADIAL, a radius or diameter dimension
Definition: typeinfo.h:104
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.