KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pcb_edit_frame.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
5 * Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <[email protected]>
6 * Copyright (C) 2013 Wayne Stambaugh <[email protected]>
7 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
8 *
9 * This program is free software: you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation, either version 3 of the License, or (at your
12 * option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program. If not, see <http://www.gnu.org/licenses/>.
21 */
22
23#include <advanced_config.h>
24#include <kiface_base.h>
25#include <kiway.h>
26#include <pgm_base.h>
27#include <pcb_edit_frame.h>
30#include <fp_lib_table.h>
31#include <bitmaps.h>
32#include <confirm.h>
33#include <lset.h>
34#include <trace_helpers.h>
35#include <pcbnew_id.h>
36#include <pcbnew_settings.h>
39#include <dialog_plot.h>
40#include <dialog_find.h>
43#include <dialog_board_setup.h>
44#include <invoke_pcb_dialog.h>
46#include <board.h>
48#include <footprint.h>
49#include <layer_pairs.h>
53#include <pcb_draw_panel_gal.h>
54#include <functional>
55#include <pcb_painter.h>
58#include <python_scripting.h>
61#include <tool/tool_manager.h>
63#include <tool/action_toolbar.h>
64#include <tool/common_control.h>
65#include <tool/common_tools.h>
66#include <tool/embed_tool.h>
68#include <tool/selection.h>
69#include <tool/zoom_tool.h>
70#include <tools/array_tool.h>
75#include <tools/edit_tool.h>
77#include <tools/group_tool.h>
79#include <tools/drc_tool.h>
81#include <tools/convert_tool.h>
82#include <tools/drawing_tool.h>
83#include <tools/pcb_control.h>
90#include <tools/pad_tool.h>
94#include <tools/pcb_actions.h>
96#include <router/router_tool.h>
99#include <gestfich.h>
100#include <executable_names.h>
102#include <wx/socket.h>
103#include <wx/wupdlock.h>
104#include <dialog_drc.h> // for DIALOG_DRC_WINDOW_NAME definition
108#include <widgets/wx_infobar.h>
112#include <widgets/wx_aui_utils.h>
113#include <kiplatform/app.h>
114#include <core/profile.h>
115#include <math/box2_minmax.h>
119
120#ifdef KICAD_IPC_API
121#include <api/api_server.h>
122#include <api/api_handler_pcb.h>
124#include <api/api_utils.h>
125#endif
126
127#include <action_plugin.h>
129#include "../scripting/python_scripting.h"
130
131#include <wx/filedlg.h>
132
133using namespace std::placeholders;
134
135
136#define INSPECT_DRC_ERROR_DIALOG_NAME wxT( "InspectDrcErrorDialog" )
137#define INSPECT_CLEARANCE_DIALOG_NAME wxT( "InspectClearanceDialog" )
138#define INSPECT_CONSTRAINTS_DIALOG_NAME wxT( "InspectConstraintsDialog" )
139#define FOOTPRINT_DIFF_DIALOG_NAME wxT( "FootprintDiffDialog" )
140
141
142BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME )
145
146
149
150 EVT_SIZE( PCB_EDIT_FRAME::OnSize )
151
153
154 // Menu Files:
156
160
166
169
170 EVT_MENU( wxID_EXIT, PCB_EDIT_FRAME::OnQuit )
171 EVT_MENU( wxID_CLOSE, PCB_EDIT_FRAME::OnQuit )
172
173 // menu Postprocess
175
176 // Horizontal toolbar
181
182 // Tracks and vias sizes general options
184 PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event )
185
186 // User interface update event handlers.
192 PCB_EDIT_FRAME::OnUpdateSelectTrackWidth )
194 PCB_EDIT_FRAME::OnUpdateSelectViaSize )
195 // Drop files event
196 EVT_DROP_FILES( PCB_EDIT_FRAME::OnDropFiles )
197END_EVENT_TABLE()
198
199
200PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
201 PCB_BASE_EDIT_FRAME( aKiway, aParent, FRAME_PCB_EDITOR, _( "PCB Editor" ),
202 wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE,
204 m_exportNetlistAction( nullptr ),
205 m_findDialog( nullptr ),
206 m_inspectDrcErrorDlg( nullptr ),
207 m_inspectClearanceDlg( nullptr ),
208 m_inspectConstraintsDlg( nullptr ),
209 m_footprintDiffDlg( nullptr ),
210 m_boardSetupDlg( nullptr ),
211 m_importProperties( nullptr ),
212 m_eventCounterTimer( nullptr )
213{
214 m_maximizeByDefault = true;
215 m_showBorderAndTitleBlock = true; // true to display sheet references
216 m_SelTrackWidthBox = nullptr;
217 m_SelViaSizeBox = nullptr;
218 m_SelLayerBox = nullptr;
219 m_show_layer_manager_tools = true;
220 m_supportsAutoSave = true;
221 m_probingSchToPcb = false;
222 m_show_search = false;
223 m_show_net_inspector = false;
224
225 // We don't know what state board was in when it was last saved, so we have to
226 // assume dirty
227 m_ZoneFillsDirty = true;
228
229 m_aboutTitle = _HKI( "KiCad PCB Editor" );
230
231 // Must be created before the menus are created.
232 if( ADVANCED_CFG::GetCfg().m_ShowPcbnewExportNetlist )
233 {
234 m_exportNetlistAction = new TOOL_ACTION( "pcbnew.EditorControl.exportNetlist",
235 AS_GLOBAL, 0, "", _( "Netlist..." ),
236 _( "Export netlist used to update schematics" ) );
237 }
238
239 // Create GAL canvas
240 auto canvas = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_frameSize,
241 GetGalDisplayOptions(),
243
244 SetCanvas( canvas );
245 SetBoard( new BOARD() );
246
247 wxIcon icon;
248 wxIconBundle icon_bundle;
249
250 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_pcbnew, 48 ) );
251 icon_bundle.AddIcon( icon );
252 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_pcbnew, 128 ) );
253 icon_bundle.AddIcon( icon );
254 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_pcbnew, 256 ) );
255 icon_bundle.AddIcon( icon );
256 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_pcbnew_32 ) );
257 icon_bundle.AddIcon( icon );
258 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_pcbnew_16 ) );
259 icon_bundle.AddIcon( icon );
260
261 SetIcons( icon_bundle );
262
263 // LoadSettings() *after* creating m_LayersManager, because LoadSettings()
264 // initialize parameters in m_LayersManager
265 LoadSettings( config() );
266
267 SetScreen( new PCB_SCREEN( GetPageSettings().GetSizeIU( pcbIUScale.IU_PER_MILS ) ) );
268
269 // PCB drawings start in the upper left corner.
270 GetScreen()->m_Center = false;
271
272 setupTools();
273 setupUIConditions();
274
275 ReCreateMenuBar();
276 ReCreateHToolbar();
277 ReCreateAuxiliaryToolbar();
278 ReCreateVToolbar();
279 ReCreateOptToolbar();
280
281#ifdef KICAD_IPC_API
283 &PCB_EDIT_FRAME::onPluginAvailabilityChanged, this );
284#endif
285
286 m_propertiesPanel = new PCB_PROPERTIES_PANEL( this, this );
287
288 float proportion = GetPcbNewSettings()->m_AuiPanels.properties_splitter;
289 m_propertiesPanel->SetSplitterProportion( proportion );
290
291 m_selectionFilterPanel = new PANEL_SELECTION_FILTER( this );
292
293 m_appearancePanel = new APPEARANCE_CONTROLS( this, GetCanvas() );
294 m_searchPane = new PCB_SEARCH_PANE( this );
295 m_netInspectorPanel = new PCB_NET_INSPECTOR_PANEL( this, this );
296
297 m_auimgr.SetManagedWindow( this );
298
299 CreateInfoBar();
300
301 unsigned int auiFlags = wxAUI_MGR_DEFAULT;
302#if !defined( _WIN32 )
303 // Windows cannot redraw the UI fast enough during a live resize and may lead to all kinds
304 // of graphical glitches.
305 auiFlags |= wxAUI_MGR_LIVE_RESIZE;
306#endif
307 m_auimgr.SetFlags( auiFlags );
308
309 // Rows; layers 4 - 6
310 m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( wxS( "MainToolbar" ) )
311 .Top().Layer( 6 ) );
312 m_auimgr.AddPane( m_auxiliaryToolBar, EDA_PANE().HToolbar().Name( wxS( "AuxToolbar" ) )
313 .Top().Layer( 5 ) );
314 m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( wxS( "MsgPanel" ) )
315 .Bottom().Layer( 6 ) );
316
317 // Columns; layers 1 - 3
318 m_auimgr.AddPane( m_optionsToolBar, EDA_PANE().VToolbar().Name( wxS( "OptToolbar" ) )
319 .Left().Layer( 3 ) );
320
321 m_auimgr.AddPane( m_drawToolBar, EDA_PANE().VToolbar().Name( wxS( "ToolsToolbar" ) )
322 .Right().Layer( 3 ) );
323
324 m_auimgr.AddPane( m_appearancePanel, EDA_PANE().Name( wxS( "LayersManager" ) )
325 .Right().Layer( 4 )
326 .Caption( _( "Appearance" ) ).PaneBorder( false )
327 .MinSize( FromDIP( 180 ), -1 )
328 .BestSize( FromDIP( 180 ), -1 )
329 .FloatingSize( FromDIP( 180 ), -1 )
330 .CloseButton( false ) );
331
332 m_auimgr.AddPane( m_selectionFilterPanel, EDA_PANE().Name( wxS( "SelectionFilter" ) )
333 .Right().Layer( 4 ).Position( 2 )
334 .Caption( _( "Selection Filter" ) ).PaneBorder( false )
335 .MinSize( FromDIP( 180 ), -1 )
336 .BestSize( FromDIP( 180 ), -1 )
337 .FloatingSize( FromDIP( 180 ), -1 )
338 .CloseButton( false ) );
339
340 m_auimgr.AddPane( m_propertiesPanel, EDA_PANE().Name( PropertiesPaneName() )
341 .Left().Layer( 5 )
342 .Caption( _( "Properties" ) ).PaneBorder( false )
343 .MinSize( FromDIP( wxSize( 240, 60 ) ) )
344 .BestSize( FromDIP( wxSize( 300, 200 ) ) )
345 .FloatingSize( wxSize( 300, 200 ) )
346 .CloseButton( true ) );
347
348 // Center
349 m_auimgr.AddPane( GetCanvas(), EDA_PANE().Canvas().Name( wxS( "DrawFrame" ) )
350 .Center() );
351
352 m_auimgr.AddPane( m_netInspectorPanel, EDA_PANE()
353 .Name( NetInspectorPanelName() )
354 .Bottom()
355 .Caption( _( "Net Inspector" ) )
356 .PaneBorder( false )
357 .MinSize( FromDIP( wxSize( 240, 60 ) ) )
358 .BestSize( FromDIP( wxSize( 300, 200 ) ) )
359 .FloatingSize( wxSize( 300, 200 ) )
360 .CloseButton( true ) );
361
362 m_auimgr.AddPane( m_searchPane, EDA_PANE().Name( SearchPaneName() )
363 .Bottom()
364 .Caption( _( "Search" ) ).PaneBorder( false )
365 .MinSize( FromDIP( wxSize ( 180, 60 ) ) )
366 .BestSize( FromDIP( wxSize ( 180, 100 ) ) )
367 .FloatingSize( FromDIP( wxSize( 480, 200 ) ) )
368 .DestroyOnClose( false )
369 .CloseButton( true ) );
370
371
372 m_auimgr.GetPane( "LayersManager" ).Show( m_show_layer_manager_tools );
373 m_auimgr.GetPane( "SelectionFilter" ).Show( m_show_layer_manager_tools );
374 m_auimgr.GetPane( PropertiesPaneName() ).Show( GetPcbNewSettings()->m_AuiPanels.show_properties );
375 m_auimgr.GetPane( NetInspectorPanelName() ).Show( m_show_net_inspector );
376 m_auimgr.GetPane( SearchPaneName() ).Show( m_show_search );
377
378 // The selection filter doesn't need to grow in the vertical direction when docked
379 m_auimgr.GetPane( "SelectionFilter" ).dock_proportion = 0;
380
381 FinishAUIInitialization();
382
383 if( PCBNEW_SETTINGS* settings = dynamic_cast<PCBNEW_SETTINGS*>( config() ) )
384 {
385 if( settings->m_AuiPanels.right_panel_width > 0 )
386 {
387 wxAuiPaneInfo& layersManager = m_auimgr.GetPane( wxS( "LayersManager" ) );
388 SetAuiPaneSize( m_auimgr, layersManager, settings->m_AuiPanels.right_panel_width, -1 );
389 }
390
391 if( settings->m_AuiPanels.properties_panel_width > 0 && m_propertiesPanel )
392 {
393 wxAuiPaneInfo& propertiesPanel = m_auimgr.GetPane( PropertiesPaneName() );
394 SetAuiPaneSize( m_auimgr, propertiesPanel,
395 settings->m_AuiPanels.properties_panel_width, -1 );
396 }
397
398 if( settings->m_AuiPanels.search_panel_height > 0
399 && ( settings->m_AuiPanels.search_panel_dock_direction == wxAUI_DOCK_TOP
400 || settings->m_AuiPanels.search_panel_dock_direction == wxAUI_DOCK_BOTTOM ) )
401 {
402 wxAuiPaneInfo& searchPane = m_auimgr.GetPane( SearchPaneName() );
403 searchPane.Direction( settings->m_AuiPanels.search_panel_dock_direction );
404 SetAuiPaneSize( m_auimgr, searchPane, -1, settings->m_AuiPanels.search_panel_height );
405 }
406 else if( settings->m_AuiPanels.search_panel_width > 0
407 && ( settings->m_AuiPanels.search_panel_dock_direction == wxAUI_DOCK_LEFT
408 || settings->m_AuiPanels.search_panel_dock_direction == wxAUI_DOCK_RIGHT ) )
409 {
410 wxAuiPaneInfo& searchPane = m_auimgr.GetPane( SearchPaneName() );
411 searchPane.Direction( settings->m_AuiPanels.search_panel_dock_direction );
412 SetAuiPaneSize( m_auimgr, searchPane, settings->m_AuiPanels.search_panel_width, -1 );
413 }
414
415 m_appearancePanel->SetTabIndex( settings->m_AuiPanels.appearance_panel_tab );
416 }
417
418 {
419 m_layerPairSettings = std::make_unique<LAYER_PAIR_SETTINGS>();
420
421 m_layerPairSettings->Bind( PCB_LAYER_PAIR_PRESETS_CHANGED, [&]( wxCommandEvent& aEvt )
422 {
423 // Update the project file list
424 std::span<const LAYER_PAIR_INFO> newPairInfos = m_layerPairSettings->GetLayerPairs();
426 std::vector<LAYER_PAIR_INFO>{ newPairInfos.begin(), newPairInfos.end() };
427 });
428
429 m_layerPairSettings->Bind( PCB_CURRENT_LAYER_PAIR_CHANGED, [&]( wxCommandEvent& aEvt )
430 {
431 const LAYER_PAIR& layerPair = m_layerPairSettings->GetCurrentLayerPair();
432 PCB_SCREEN& screen = *GetScreen();
433
434 screen.m_Route_Layer_TOP = layerPair.GetLayerA();
435 screen.m_Route_Layer_BOTTOM = layerPair.GetLayerB();
436
437 // Update the toolbar icon
438 PrepareLayerIndicator();
439 });
440 }
441
442 GetToolManager()->PostAction( ACTIONS::zoomFitScreen );
443
444 // This is used temporarily to fix a client size issue on GTK that causes zoom to fit
445 // to calculate the wrong zoom size. See PCB_EDIT_FRAME::onSize().
446 Bind( wxEVT_SIZE, &PCB_EDIT_FRAME::onSize, this );
447
448 Bind( wxEVT_IDLE,
449 [this]( wxIdleEvent& aEvent )
450 {
451 BOX2D viewport = GetCanvas()->GetView()->GetViewport();
452
453 if( viewport != m_lastNetnamesViewport )
454 {
455 redrawNetnames();
456 m_lastNetnamesViewport = viewport;
457 }
458
459 // Do not forget to pass the Idle event to other clients:
460 aEvent.Skip();
461 } );
462
463 resolveCanvasType();
464
465 setupUnits( config() );
466
467 // Ensure the DRC engine is initialized so that constraints can be resolved even before a
468 // board is loaded or saved
469 try
470 {
471 m_toolManager->GetTool<DRC_TOOL>()->GetDRCEngine()->InitEngine( wxFileName() );
472 }
473 catch( PARSE_ERROR& )
474 {
475 }
476
477 // Ensure the Python interpreter is up to date with its environment variables
478 PythonSyncEnvironmentVariables();
479 PythonSyncProjectName();
480
481 // Sync action plugins in case they changed since the last time the frame opened
482 GetToolManager()->RunAction( ACTIONS::pluginsReload );
483
484#ifdef KICAD_IPC_API
485 m_apiHandler = std::make_unique<API_HANDLER_PCB>( this );
486 Pgm().GetApiServer().RegisterHandler( m_apiHandler.get() );
487
488 if( Kiface().IsSingle() )
489 {
490 m_apiHandlerCommon = std::make_unique<API_HANDLER_COMMON>();
491 Pgm().GetApiServer().RegisterHandler( m_apiHandlerCommon.get() );
492 }
493#endif
494
495 GetCanvas()->SwitchBackend( m_canvasType );
496 ActivateGalCanvas();
497
498 // Default shutdown reason until a file is loaded
499 KIPLATFORM::APP::SetShutdownBlockReason( this, _( "New PCB file is unsaved" ) );
500
501 // disable Export STEP item if kicad2step does not exist
502 wxString strK2S = Pgm().GetExecutablePath();
503
504#ifdef __WXMAC__
505 if( strK2S.Find( wxT( "pcbnew.app" ) ) != wxNOT_FOUND )
506 {
507 // On macOS, we have standalone applications inside the main bundle, so we handle that here:
508 strK2S += wxT( "../../" );
509 }
510
511 strK2S += wxT( "Contents/MacOS/" );
512#endif
513
514 wxFileName appK2S( strK2S, wxT( "kicad2step" ) );
515
516#ifdef _WIN32
517 appK2S.SetExt( wxT( "exe" ) );
518#endif
519
520 // Ensure the window is on top
521 Raise();
522
523// if( !appK2S.FileExists() )
524 // GetMenuBar()->FindItem( ID_GEN_EXPORT_FILE_STEP )->Enable( false );
525
526 // AUI doesn't refresh properly on wxMac after changes in eb7dc6dd, so force it to
527#ifdef __WXMAC__
528 if( Kiface().IsSingle() )
529 {
530 CallAfter( [this]()
531 {
532 m_appearancePanel->OnBoardChanged();
533 } );
534 }
535#endif
536
537 // Register a call to update the toolbar sizes. It can't be done immediately because
538 // it seems to require some sizes calculated that aren't yet (at least on GTK).
539 CallAfter( [this]()
540 {
541 // Ensure the controls on the toolbars all are correctly sized
542 UpdateToolbarControlSizes();
543 } );
544
546 {
547 m_eventCounterTimer = new wxTimer( this );
548
549 Bind( wxEVT_TIMER,
550 [&]( wxTimerEvent& aEvent )
551 {
552 GetCanvas()->m_PaintEventCounter->Show();
553 GetCanvas()->m_PaintEventCounter->Reset();
554
556 static_cast<KIGFX::WX_VIEW_CONTROLS*>( GetCanvas()->GetViewControls() );
557 vc->m_MotionEventCounter->Show();
558 vc->m_MotionEventCounter->Reset();
559
560 },
561 m_eventCounterTimer->GetId() );
562
563 m_eventCounterTimer->Start( 1000 );
564 }
565
566 Bind( EDA_EVT_CLOSE_DIALOG_BOOK_REPORTER, &PCB_EDIT_FRAME::onCloseModelessBookReporterDialogs,
567 this );
570 DragAcceptFiles( true );
571}
572
573
575{
577
578 if( ADVANCED_CFG::GetCfg().m_ShowEventCounters )
579 {
580 // Stop the timer during destruction early to avoid potential event race conditions (that
581 // do happen on windows)
582 m_eventCounterTimer->Stop();
583 delete m_eventCounterTimer;
584 }
585
586 // Close modeless dialogs
587 wxWindow* open_dlg = wxWindow::FindWindowByName( DIALOG_DRC_WINDOW_NAME );
588
589 if( open_dlg )
590 open_dlg->Close( true );
591
592 // Shutdown all running tools
593 if( m_toolManager )
595
596 if( GetBoard() )
598
600 delete m_appearancePanel;
602 delete m_propertiesPanel;
603 delete m_netInspectorPanel;
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
763
764 for( TOOL_BASE* tool : m_toolManager->Tools() )
765 {
766 if( PCB_TOOL_BASE* pcbTool = dynamic_cast<PCB_TOOL_BASE*>( tool ) )
767 pcbTool->SetIsBoardEditor( true );
768 }
769
770 // Run the selection tool, it is supposed to be always active
771 m_toolManager->InvokeTool( "pcbnew.InteractiveSelection" );
772}
773
774
776{
778
780 PCB_EDITOR_CONDITIONS cond( this );
781
782 auto undoCond =
783 [ this ] (const SELECTION& aSel )
784 {
786
787 if( drawingTool && drawingTool->GetDrawingMode() != DRAWING_TOOL::MODE::NONE )
788 return true;
789
791
792 if( routerTool && routerTool->RoutingInProgress() )
793 return true;
794
795 return GetUndoCommandCount() > 0;
796 };
797
798 wxASSERT( mgr );
799
800#define ENABLE( x ) ACTION_CONDITIONS().Enable( x )
801#define CHECK( x ) ACTION_CONDITIONS().Check( x )
802// clang-format off
803
805 mgr->SetConditions( ACTIONS::undo, ENABLE( undoCond ) );
807
812 mgr->SetConditions( ACTIONS::millimetersUnits, CHECK( cond.Units( EDA_UNITS::MILLIMETRES ) ) );
813 mgr->SetConditions( ACTIONS::inchesUnits, CHECK( cond.Units( EDA_UNITS::INCHES ) ) );
814 mgr->SetConditions( ACTIONS::milsUnits, CHECK( cond.Units( EDA_UNITS::MILS ) ) );
815
816 mgr->SetConditions( ACTIONS::cut, ENABLE( cond.HasItems() ) );
817 mgr->SetConditions( ACTIONS::copy, ENABLE( cond.HasItems() ) );
824
825 static const std::vector<KICAD_T> groupTypes = { PCB_GROUP_T, PCB_GENERATOR_T };
826
831
837
838 if( SCRIPTING::IsWxAvailable() )
840
841 auto enableZoneControlCondition =
842 [this] ( const SELECTION& )
843 {
846 };
847
849 ENABLE( enableZoneControlCondition )
850 .Check( cond.ZoneDisplayMode( ZONE_DISPLAY_MODE::SHOW_FILLED ) ) );
852 ENABLE( enableZoneControlCondition )
853 .Check( cond.ZoneDisplayMode( ZONE_DISPLAY_MODE::SHOW_ZONE_OUTLINE ) ) );
855 ENABLE( enableZoneControlCondition )
856 .Check( cond.ZoneDisplayMode( ZONE_DISPLAY_MODE::SHOW_FRACTURE_BORDERS ) ) );
858 ENABLE( enableZoneControlCondition )
859 .Check( cond.ZoneDisplayMode( ZONE_DISPLAY_MODE::SHOW_TRIANGULATION ) ) );
860
862
863 auto constrainedDrawingModeCond =
864 [this]( const SELECTION& )
865 {
867 };
868
869 auto boardFlippedCond =
870 [this]( const SELECTION& )
871 {
872 return GetCanvas() && GetCanvas()->GetView()->IsMirroredX();
873 };
874
875 auto layerManagerCond =
876 [this] ( const SELECTION& )
877 {
878 return LayerManagerShown();
879 };
880
881 auto propertiesCond =
882 [this] ( const SELECTION& )
883 {
884 return PropertiesShown();
885 };
886
887 auto netInspectorCond =
888 [this] ( const SELECTION& )
889 {
890 return NetInspectorShown();
891 };
892
893 auto searchPaneCond =
894 [this] ( const SELECTION& )
895 {
896 return m_auimgr.GetPane( SearchPaneName() ).IsShown();
897 };
898
899 auto highContrastCond =
900 [this] ( const SELECTION& )
901 {
902 return GetDisplayOptions().m_ContrastModeDisplay != HIGH_CONTRAST_MODE::NORMAL;
903 };
904
905 auto globalRatsnestCond =
906 [this] (const SELECTION& )
907 {
909 };
910
911 auto curvedRatsnestCond =
912 [this] (const SELECTION& )
913 {
915 };
916
917 auto netHighlightCond =
918 [this]( const SELECTION& )
919 {
921 return !settings->GetHighlightNetCodes().empty();
922 };
923
924 auto enableNetHighlightCond =
925 [this]( const SELECTION& )
926 {
928 return tool && tool->IsNetHighlightSet();
929 };
930
931 mgr->SetConditions( PCB_ACTIONS::toggleHV45Mode, CHECK( constrainedDrawingModeCond ) );
932 mgr->SetConditions( ACTIONS::highContrastMode, CHECK( highContrastCond ) );
933 mgr->SetConditions( PCB_ACTIONS::flipBoard, CHECK( boardFlippedCond ) );
934 mgr->SetConditions( PCB_ACTIONS::showLayersManager, CHECK( layerManagerCond ) );
935 mgr->SetConditions( PCB_ACTIONS::showRatsnest, CHECK( globalRatsnestCond ) );
936 mgr->SetConditions( PCB_ACTIONS::ratsnestLineMode, CHECK( curvedRatsnestCond ) );
937 mgr->SetConditions( PCB_ACTIONS::toggleNetHighlight, CHECK( netHighlightCond )
938 .Enable( enableNetHighlightCond ) );
939 mgr->SetConditions( PCB_ACTIONS::showProperties, CHECK( propertiesCond ) );
940 mgr->SetConditions( PCB_ACTIONS::showNetInspector, CHECK( netInspectorCond ) );
941 mgr->SetConditions( PCB_ACTIONS::showSearch, CHECK( searchPaneCond ) );
942
943 auto isArcKeepCenterMode =
944 [this]( const SELECTION& )
945 {
946 return GetPcbNewSettings()->m_ArcEditMode == ARC_EDIT_MODE::KEEP_CENTER_ADJUST_ANGLE_RADIUS;
947 };
948
949 auto isArcKeepEndpointMode =
950 [this]( const SELECTION& )
951 {
952 return GetPcbNewSettings()->m_ArcEditMode == ARC_EDIT_MODE::KEEP_ENDPOINTS_OR_START_DIRECTION;
953 };
954
955 mgr->SetConditions( PCB_ACTIONS::pointEditorArcKeepCenter, CHECK( isArcKeepCenterMode ) );
956 mgr->SetConditions( PCB_ACTIONS::pointEditorArcKeepEndpoint, CHECK( isArcKeepEndpointMode ) );
957
958 auto isHighlightMode =
959 [this]( const SELECTION& )
960 {
962 return tool && tool->GetRouterMode() == PNS::RM_MarkObstacles;
963 };
964
965 auto isShoveMode =
966 [this]( const SELECTION& )
967 {
969 return tool && tool->GetRouterMode() == PNS::RM_Shove;
970 };
971
972 auto isWalkaroundMode =
973 [this]( const SELECTION& )
974 {
976 return tool && tool->GetRouterMode() == PNS::RM_Walkaround;
977 };
978
979 mgr->SetConditions( PCB_ACTIONS::routerHighlightMode, CHECK( isHighlightMode ) );
980 mgr->SetConditions( PCB_ACTIONS::routerShoveMode, CHECK( isShoveMode ) );
981 mgr->SetConditions( PCB_ACTIONS::routerWalkaroundMode, CHECK( isWalkaroundMode ) );
982
983 auto haveNetCond =
984 [] ( const SELECTION& aSel )
985 {
986 for( EDA_ITEM* item : aSel )
987 {
988 if( BOARD_CONNECTED_ITEM* bci = dynamic_cast<BOARD_CONNECTED_ITEM*>( item ) )
989 {
990 if( bci->GetNetCode() > 0 )
991 return true;
992 }
993 }
994
995 return false;
996 };
997
1002
1003 static const std::vector<KICAD_T> trackTypes = { PCB_TRACE_T, PCB_ARC_T, PCB_VIA_T };
1004 static const std::vector<KICAD_T> padOwnerTypes = { PCB_FOOTPRINT_T, PCB_PAD_T };
1005 static const std::vector<KICAD_T> footprintTypes = { PCB_FOOTPRINT_T };
1006 static const std::vector<KICAD_T> crossProbeTypes = { PCB_PAD_T, PCB_FOOTPRINT_T, PCB_GROUP_T };
1007 static const std::vector<KICAD_T> zoneTypes = { PCB_ZONE_T };
1008
1014
1015
1017 && SELECTION_CONDITIONS::OnlyTypes( zoneTypes );
1018
1020 && SELECTION_CONDITIONS::OnlyTypes( zoneTypes );
1021
1022 mgr->SetConditions( PCB_ACTIONS::zoneDuplicate, ENABLE( singleZoneCond ) );
1023 mgr->SetConditions( PCB_ACTIONS::drawZoneCutout, ENABLE( singleZoneCond ) );
1024 mgr->SetConditions( PCB_ACTIONS::drawSimilarZone, ENABLE( singleZoneCond ) );
1025 mgr->SetConditions( PCB_ACTIONS::zoneMerge, ENABLE( zoneMergeCond ) );
1026
1028
1029#define CURRENT_TOOL( action ) mgr->SetConditions( action, CHECK( cond.CurrentTool( action ) ) )
1030
1031 // These tools can be used at any time to inspect the board
1036
1037 auto isDRCIdle =
1038 [this] ( const SELECTION& )
1039 {
1041 return !( tool && tool->IsDRCRunning() );
1042 };
1043
1044#define CURRENT_EDIT_TOOL( action ) \
1045 mgr->SetConditions( action, ACTION_CONDITIONS().Check( cond.CurrentTool( action ) ) \
1046 .Enable( isDRCIdle ) )
1047
1048 // These tools edit the board, so they must be disabled during some operations
1078
1084
1085#undef CURRENT_TOOL
1086#undef CURRENT_EDIT_TOOL
1087#undef ENABLE
1088#undef CHECK
1089// clang-format on
1090}
1091
1092
1093void PCB_EDIT_FRAME::OnQuit( wxCommandEvent& event )
1094{
1095 if( event.GetId() == wxID_EXIT )
1096 Kiway().OnKiCadExit();
1097
1098 if( event.GetId() == wxID_CLOSE || Kiface().IsSingle() )
1099 Close( false );
1100}
1101
1102
1103void PCB_EDIT_FRAME::ResolveDRCExclusions( bool aCreateMarkers )
1104{
1105 BOARD_COMMIT commit( this );
1106
1107 for( PCB_MARKER* marker : GetBoard()->ResolveDRCExclusions( aCreateMarkers ) )
1108 {
1109 if( marker->GetMarkerType() == MARKER_BASE::MARKER_DRAWING_SHEET )
1110 marker->GetRCItem()->SetItems( GetCanvas()->GetDrawingSheet() );
1111
1112 commit.Add( marker );
1113 }
1114
1115 commit.Push( wxEmptyString, SKIP_UNDO | SKIP_SET_DIRTY );
1116
1117 for( PCB_MARKER* marker : GetBoard()->Markers() )
1118 {
1119 if( marker->GetSeverity() == RPT_SEVERITY_EXCLUSION )
1120 GetCanvas()->GetView()->Update( marker );
1121 }
1122
1124}
1125
1126
1127bool PCB_EDIT_FRAME::canCloseWindow( wxCloseEvent& aEvent )
1128{
1129 // Shutdown blocks must be determined and vetoed as early as possible
1130 if( KIPLATFORM::APP::SupportsShutdownBlockReason() && aEvent.GetId() == wxEVT_QUERY_END_SESSION
1131 && IsContentModified() )
1132 {
1133 return false;
1134 }
1135
1137
1138 if( zoneFillerTool->IsBusy() )
1139 {
1140 wxBell();
1141
1142 if( wxWindow* reporter = dynamic_cast<wxWindow*>( zoneFillerTool->GetProgressReporter() ) )
1143 reporter->ShowWithEffect( wxSHOW_EFFECT_EXPAND );
1144
1145 return false;
1146 }
1147
1148 if( Kiface().IsSingle() )
1149 {
1150 auto* fpEditor = (FOOTPRINT_EDIT_FRAME*) Kiway().Player( FRAME_FOOTPRINT_EDITOR, false );
1151
1152 if( fpEditor && !fpEditor->Close() ) // Can close footprint editor?
1153 return false;
1154
1155 auto* fpViewer = (FOOTPRINT_VIEWER_FRAME*) Kiway().Player( FRAME_FOOTPRINT_VIEWER, false );
1156
1157 if( fpViewer && !fpViewer->Close() ) // Can close footprint viewer?
1158 return false;
1159
1160 // FOOTPRINT_CHOOSER_FRAME is always modal so this shouldn't come up, but better safe than
1161 // sorry.
1162 auto* chooser = (FOOTPRINT_CHOOSER_FRAME*) Kiway().Player( FRAME_FOOTPRINT_CHOOSER, false );
1163
1164 if( chooser && !chooser->Close() ) // Can close footprint chooser?
1165 return false;
1166 }
1167 else
1168 {
1169 auto* fpEditor = (FOOTPRINT_EDIT_FRAME*) Kiway().Player( FRAME_FOOTPRINT_EDITOR, false );
1170
1171 if( fpEditor && fpEditor->IsCurrentFPFromBoard() )
1172 {
1173 if( !fpEditor->CanCloseFPFromBoard( true ) )
1174 return false;
1175 }
1176 }
1177
1178 if( IsContentModified() )
1179 {
1180 wxFileName fileName = GetBoard()->GetFileName();
1181 wxString msg = _( "Save changes to '%s' before closing?" );
1182
1183 if( !HandleUnsavedChanges( this, wxString::Format( msg, fileName.GetFullName() ),
1184 [&]() -> bool
1185 {
1186 return Files_io_from_id( ID_SAVE_BOARD );
1187 } ) )
1188 {
1189 return false;
1190 }
1191 }
1192
1193 return PCB_BASE_EDIT_FRAME::canCloseWindow( aEvent );
1194}
1195
1196
1198{
1199 // On Windows 7 / 32 bits, on OpenGL mode only, Pcbnew crashes
1200 // when closing this frame if a footprint was selected, and the footprint editor called
1201 // to edit this footprint, and when closing pcbnew if this footprint is still selected
1202 // See https://bugs.launchpad.net/kicad/+bug/1655858
1203 // I think this is certainly a OpenGL event fired after frame deletion, so this workaround
1204 // avoid the crash (JPC)
1205 GetCanvas()->SetEvtHandlerEnabled( false );
1206
1208
1209#ifdef KICAD_IPC_API
1210 Pgm().GetApiServer().DeregisterHandler( m_apiHandler.get() );
1211 wxTheApp->Unbind( EDA_EVT_PLUGIN_AVAILABILITY_CHANGED,
1212 &PCB_EDIT_FRAME::onPluginAvailabilityChanged, this );
1213#endif
1214
1215 // Clean up mode-less dialogs.
1216 Unbind( EDA_EVT_CLOSE_DIALOG_BOOK_REPORTER, &PCB_EDIT_FRAME::onCloseModelessBookReporterDialogs,
1217 this );
1218
1219 wxWindow* open_dlg = wxWindow::FindWindowByName( DIALOG_DRC_WINDOW_NAME );
1220
1221 if( open_dlg )
1222 open_dlg->Close( true );
1223
1224 if( m_findDialog )
1225 {
1226 m_findDialog->Destroy();
1227 m_findDialog = nullptr;
1228 }
1229
1231 {
1232 m_inspectDrcErrorDlg->Destroy();
1233 m_inspectDrcErrorDlg = nullptr;
1234 }
1235
1237 {
1238 m_inspectClearanceDlg->Destroy();
1239 m_inspectClearanceDlg = nullptr;
1240 }
1241
1243 {
1244 m_inspectConstraintsDlg->Destroy();
1245 m_inspectConstraintsDlg = nullptr;
1246 }
1247
1248 if( m_footprintDiffDlg )
1249 {
1250 m_footprintDiffDlg->Destroy();
1251 m_footprintDiffDlg = nullptr;
1252 }
1253
1254 // Delete the auto save file if it exists.
1255 wxFileName fn = GetBoard()->GetFileName();
1256
1257 // Auto save file name is the normal file name prefixed with 'FILEEXT::AutoSaveFilePrefix'.
1258 fn.SetName( FILEEXT::AutoSaveFilePrefix + fn.GetName() );
1259
1260 // When the auto save feature does not have write access to the board file path, it falls
1261 // back to a platform specific user temporary file path.
1262 if( !fn.IsOk() || !fn.IsDirWritable() )
1263 fn.SetPath( wxFileName::GetTempDir() );
1264
1265 wxLogTrace( traceAutoSave, wxT( "Deleting auto save file <" ) + fn.GetFullPath() + wxT( ">" ) );
1266
1267 // Remove the auto save file on a normal close of Pcbnew.
1268 if( fn.FileExists() && !wxRemoveFile( fn.GetFullPath() ) )
1269 {
1270 wxLogTrace( traceAutoSave, wxT( "The auto save file could not be removed!" ) );
1271 }
1272
1273 // Make sure local settings are persisted
1274 if( !Prj().GetLocalSettings().WasMigrated() )
1275 {
1278 }
1279 else
1280 {
1281 wxLogTrace( traceAutoSave, wxT( "Skipping auto-save of migrated local settings" ) );
1282 }
1283
1284 // Do not show the layer manager during closing to avoid flicker
1285 // on some platforms (Windows) that generate useless redraw of items in
1286 // the Layer Manager
1288 {
1289 m_auimgr.GetPane( wxS( "LayersManager" ) ).Show( false );
1290 m_auimgr.GetPane( wxS( "TabbedPanel" ) ).Show( false );
1291 }
1292
1293 // Unlink the old project if needed
1295
1296 // Delete board structs and undo/redo lists, to avoid crash on exit
1297 // when deleting some structs (mainly in undo/redo lists) too late
1298 Clear_Pcb( false, true );
1299
1300 // do not show the window because ScreenPcb will be deleted and we do not
1301 // want any paint event
1302 Show( false );
1303
1305}
1306
1307
1309{
1312 GetCanvas()->Refresh();
1313}
1314
1315
1316void PCB_EDIT_FRAME::ShowBoardSetupDialog( const wxString& aInitialPage )
1317{
1318 static std::mutex dialogMutex; // Local static mutex
1319
1320 std::unique_lock<std::mutex> dialogLock( dialogMutex, std::try_to_lock );
1321
1322 // One dialog at a time.
1323 if( !dialogLock.owns_lock() )
1324 {
1325 if( m_boardSetupDlg && m_boardSetupDlg->IsShown() )
1326 {
1327 m_boardSetupDlg->Raise(); // Brings the existing dialog to the front
1328 }
1329
1330 return;
1331 }
1332
1333 // Make sure everything's up-to-date
1335
1336 DIALOG_BOARD_SETUP dlg( this );
1337
1338 if( !aInitialPage.IsEmpty() )
1339 dlg.SetInitialPage( aInitialPage, wxEmptyString );
1340
1341 // Assign dlg to the m_boardSetupDlg pointer to track its status.
1342 m_boardSetupDlg = &dlg;
1343
1344 // QuasiModal required for Scintilla auto-complete
1345 if( dlg.ShowQuasiModal() == wxID_OK )
1346 {
1348 // We don't know if anything was modified, so err on the side of requiring a save
1349 OnModify();
1350
1351 Kiway().CommonSettingsChanged( false, true );
1352
1355
1356 PCBNEW_SETTINGS* settings = GetPcbNewSettings();
1357 static LSET maskAndPasteLayers = LSET( { F_Mask, F_Paste, B_Mask, B_Paste } );
1358
1360 [&]( KIGFX::VIEW_ITEM* aItem ) -> int
1361 {
1362 int flags = 0;
1363
1364 if( !aItem->IsBOARD_ITEM() )
1365 return flags;
1366
1367 BOARD_ITEM* item = static_cast<BOARD_ITEM*>( aItem );
1368
1369 if( item->Type() == PCB_VIA_T || item->Type() == PCB_PAD_T )
1370 {
1371 // Note: KIGFX::REPAINT isn't enough for things that go from invisible
1372 // to visible as they won't be found in the view layer's itemset for
1373 // re-painting.
1374 if( ( GetBoard()->GetVisibleLayers() & maskAndPasteLayers ).any() )
1375 flags |= KIGFX::ALL;
1376 }
1377
1378 if( item->Type() == PCB_TRACE_T || item->Type() == PCB_ARC_T || item->Type() == PCB_VIA_T )
1379 {
1380 if( settings->m_Display.m_TrackClearance == SHOW_WITH_VIA_ALWAYS )
1381 flags |= KIGFX::REPAINT;
1382 }
1383
1384 if( item->Type() == PCB_PAD_T )
1385 {
1386 if( settings->m_Display.m_PadClearance )
1387 flags |= KIGFX::REPAINT;
1388 }
1389
1390 if( EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( aItem ) )
1391 {
1392 if( text->HasTextVars() )
1393 {
1394 text->ClearRenderCache();
1395 text->ClearBoundingBoxCache();
1396 flags |= KIGFX::GEOMETRY | KIGFX::REPAINT;
1397 }
1398 }
1399
1400 return flags;
1401 } );
1402
1403 GetCanvas()->Refresh();
1404
1408
1409 //this event causes the routing tool to reload its design rules information
1411 toolEvent.SetHasPosition( false );
1412 m_toolManager->ProcessEvent( toolEvent );
1413 }
1414
1415 GetCanvas()->SetFocus();
1416
1417 // Reset m_boardSetupDlg after the dialog is closed
1418 m_boardSetupDlg = nullptr;
1419}
1420
1421
1423{
1425
1426 PCBNEW_SETTINGS* cfg = dynamic_cast<PCBNEW_SETTINGS*>( aCfg );
1427 wxASSERT( cfg );
1428
1429 if( cfg )
1430 {
1434 }
1435}
1436
1437
1439{
1441
1442 PCBNEW_SETTINGS* cfg = dynamic_cast<PCBNEW_SETTINGS*>( aCfg );
1443 wxASSERT( cfg );
1444
1445 if( cfg )
1446 {
1447 wxAuiPaneInfo& apperancePane = m_auimgr.GetPane( AppearancePanelName() );
1448 cfg->m_AuiPanels.show_layer_manager = apperancePane.IsShown();
1449
1450 if( m_propertiesPanel )
1451 {
1452 cfg->m_AuiPanels.show_properties = m_propertiesPanel->IsShownOnScreen();
1455 }
1456
1457 // ensure m_show_search is up to date (the pane can be closed)
1458 wxAuiPaneInfo& searchPaneInfo = m_auimgr.GetPane( SearchPaneName() );
1459 m_show_search = searchPaneInfo.IsShown();
1461 cfg->m_AuiPanels.search_panel_height = m_searchPane->GetSize().y;
1462 cfg->m_AuiPanels.search_panel_width = m_searchPane->GetSize().x;
1463 cfg->m_AuiPanels.search_panel_dock_direction = searchPaneInfo.dock_direction;
1464
1466 {
1467 wxAuiPaneInfo& netInspectorhPaneInfo = m_auimgr.GetPane( NetInspectorPanelName() );
1468 m_show_net_inspector = netInspectorhPaneInfo.IsShown();
1470 }
1471
1472 if( m_appearancePanel )
1473 {
1478 }
1479 }
1480}
1481
1482
1484{
1485 PCBNEW_SETTINGS* cfg = dynamic_cast<PCBNEW_SETTINGS*>( config() );
1486
1487 return cfg ? cfg->m_RotationAngle : ANGLE_90;
1488}
1489
1490
1492{
1494}
1495
1496
1498{
1499
1500 GetColorSettings()->SetColor( LAYER_GRID, aColor );
1501 GetCanvas()->GetGAL()->SetGridColor( aColor );
1502}
1503
1504
1506{
1507 const PCB_LAYER_ID oldLayer = GetActiveLayer();
1508
1509 if( oldLayer == aLayer )
1510 return;
1511
1513
1515
1516 m_toolManager->PostAction( PCB_ACTIONS::layerChanged ); // notify other tools
1517 GetCanvas()->SetFocus(); // allow capture of hotkeys
1518 GetCanvas()->SetHighContrastLayer( aLayer );
1519
1520 /*
1521 * Only show pad, via and track clearances when a copper layer is active
1522 * and then only show the clearance layer for that copper layer. For
1523 * front/back non-copper layers, show the clearance layer for the outer
1524 * layer on that side.
1525 *
1526 * For pads/vias, this is to avoid clutter when there are pad/via layers
1527 * that vary in flash (i.e. clearance from the hole or pad edge), padstack
1528 * shape on eahc layer or clearances on each layer.
1529 *
1530 * For tracks, this follows the same logic as pads/vias, but in theory could
1531 * have their own set of independent clearance layers to allow track clearance
1532 * to be shown for more layers.
1533 */
1534 const auto getClearanceLayerForActive = []( PCB_LAYER_ID aActiveLayer ) -> std::optional<int>
1535 {
1536 if( IsCopperLayer( aActiveLayer ) )
1537 return CLEARANCE_LAYER_FOR( aActiveLayer );
1538
1539 return std::nullopt;
1540 };
1541
1542 if( std::optional<int> oldClearanceLayer = getClearanceLayerForActive( oldLayer ) )
1543 GetCanvas()->GetView()->SetLayerVisible( *oldClearanceLayer, false );
1544
1545 if( std::optional<int> newClearanceLayer = getClearanceLayerForActive( aLayer ) )
1546 GetCanvas()->GetView()->SetLayerVisible( *newClearanceLayer, true );
1547
1549 [&]( KIGFX::VIEW_ITEM* aItem ) -> int
1550 {
1551 if( !aItem->IsBOARD_ITEM() )
1552 return 0;
1553
1554 BOARD_ITEM* item = static_cast<BOARD_ITEM*>( aItem );
1555
1556 // Note: KIGFX::REPAINT isn't enough for things that go from invisible to visible
1557 // as they won't be found in the view layer's itemset for re-painting.
1558 if( GetDisplayOptions().m_ContrastModeDisplay == HIGH_CONTRAST_MODE::HIDDEN )
1559 {
1560 if( item->IsOnLayer( oldLayer ) || item->IsOnLayer( aLayer ) )
1561 return KIGFX::ALL;
1562 }
1563
1564 if( item->Type() == PCB_VIA_T )
1565 {
1566 PCB_VIA* via = static_cast<PCB_VIA*>( item );
1567
1568 // Vias on a restricted layer set must be redrawn when the active layer
1569 // is changed
1570 if( via->GetViaType() == VIATYPE::BLIND_BURIED
1571 || via->GetViaType() == VIATYPE::MICROVIA )
1572 {
1573 return KIGFX::REPAINT;
1574 }
1575
1576 if( via->GetRemoveUnconnected() )
1577 return KIGFX::ALL;
1578 }
1579 else if( item->Type() == PCB_PAD_T )
1580 {
1581 PAD* pad = static_cast<PAD*>( item );
1582
1583 if( pad->GetRemoveUnconnected() )
1584 return KIGFX::ALL;
1585 }
1586
1587 return 0;
1588 } );
1589
1590 GetCanvas()->Refresh();
1591}
1592
1593
1595{
1597
1598 layerEnum.Choices().Clear();
1599 layerEnum.Undefined( UNDEFINED_LAYER );
1600
1601 for( PCB_LAYER_ID layer : LSET::AllLayersMask().Seq() )
1602 {
1603 // Canonical name
1604 layerEnum.Map( layer, LSET::Name( layer ) );
1605
1606 // User name
1607 layerEnum.Map( layer, GetBoard()->GetLayerName( layer ) );
1608 }
1609
1610 DRC_TOOL* drcTool = m_toolManager->GetTool<DRC_TOOL>();
1611
1612 try
1613 {
1614 drcTool->GetDRCEngine()->InitEngine( GetDesignRulesPath() );
1615 }
1616 catch( PARSE_ERROR& )
1617 {
1618 // Not sure this is the best place to tell the user their rules are buggy, so
1619 // we'll stay quiet for now. Feel free to revisit this decision....
1620 }
1621
1622 UpdateTitle();
1623
1624 wxFileName fn = GetBoard()->GetFileName();
1625
1626 // Display a warning that the file is read only
1627 if( fn.FileExists() && !fn.IsFileWritable() )
1628 {
1631 m_infoBar->ShowMessage( _( "Board file is read only." ),
1633 }
1634
1636
1637 // Sync layer and item visibility
1639
1640 SetElementVisibility( LAYER_RATSNEST, GetPcbNewSettings()->m_Display.m_ShowGlobalRatsnest );
1641
1643
1644 // Apply saved display state to the appearance panel after it has been set up
1645 PROJECT_LOCAL_SETTINGS& localSettings = Prj().GetLocalSettings();
1646
1648
1649 if( GetBoard()->GetDesignSettings().IsLayerEnabled( localSettings.m_ActiveLayer ) )
1650 SetActiveLayer( localSettings.m_ActiveLayer );
1651
1652 PROJECT_FILE& projectFile = Prj().GetProjectFile();
1653
1654 m_layerPairSettings->SetLayerPairs( projectFile.m_LayerPairInfos );
1655 m_layerPairSettings->SetCurrentLayerPair( LAYER_PAIR{ F_Cu, B_Cu } );
1656
1657 // Updates any auto dimensions and the auxiliary toolbar tracks/via sizes
1659
1660 // Sync the net inspector now we have connectivity calculated
1663
1664 // Display the loaded board:
1665 Zoom_Automatique( false );
1666
1667 // Invalidate painting as loading the DRC engine will cause clearances to become valid
1669
1670 Refresh();
1671
1672 SetMsgPanel( GetBoard() );
1673 SetStatusText( wxEmptyString );
1674
1675 KIPLATFORM::APP::SetShutdownBlockReason( this, _( "PCB file changes are unsaved" ) );
1676}
1677
1678
1680{
1682}
1683
1684
1686{
1687 return GetBoard()->IsElementVisible( aElement );
1688}
1689
1690
1692{
1693 // Force the RATSNEST visible
1694 if( aElement == LAYER_RATSNEST )
1695 GetCanvas()->GetView()->SetLayerVisible( aElement, true );
1696 else
1697 GetCanvas()->GetView()->SetLayerVisible( aElement , aNewState );
1698
1699 GetBoard()->SetElementVisibility( aElement, aNewState );
1700}
1701
1702
1704{
1705 // call my base class
1707
1708 m_auimgr.GetPane( m_appearancePanel ).Caption( _( "Appearance" ) );
1709 m_auimgr.GetPane( m_selectionFilterPanel ).Caption( _( "Selection Filter" ) );
1710 m_auimgr.GetPane( m_propertiesPanel ).Caption( _( "Properties" ) );
1711 m_auimgr.GetPane( m_netInspectorPanel ).Caption( _( "Net Inspector" ) );
1712 m_auimgr.Update();
1713
1714 UpdateTitle();
1715}
1716
1717
1719{
1721
1722 if( project.m_PcbLastPath[ aType ].IsEmpty() )
1723 return wxEmptyString;
1724
1725 wxFileName absoluteFileName = project.m_PcbLastPath[ aType ];
1726 wxFileName pcbFileName = GetBoard()->GetFileName();
1727
1728 absoluteFileName.MakeAbsolute( pcbFileName.GetPath() );
1729 return absoluteFileName.GetFullPath();
1730}
1731
1732
1733void PCB_EDIT_FRAME::SetLastPath( LAST_PATH_TYPE aType, const wxString& aLastPath )
1734{
1736
1737 wxFileName relativeFileName = aLastPath;
1738 wxFileName pcbFileName = GetBoard()->GetFileName();
1739
1740 relativeFileName.MakeRelativeTo( pcbFileName.GetPath() );
1741
1742 if( relativeFileName.GetFullPath() != project.m_PcbLastPath[ aType ] )
1743 {
1744 project.m_PcbLastPath[ aType ] = relativeFileName.GetFullPath();
1745 OnModify();
1746 }
1747}
1748
1749
1751{
1753
1754 Update3DView( true, GetPcbNewSettings()->m_Display.m_Live3DRefresh );
1755
1756 if( !GetTitle().StartsWith( wxT( "*" ) ) )
1757 UpdateTitle();
1758
1759 m_ZoneFillsDirty = true;
1760}
1761
1762
1764{
1765 Update3DView( true, true );
1766
1767 std::shared_ptr<CONNECTIVITY_DATA> connectivity = GetBoard()->GetConnectivity();
1768 connectivity->RecalculateRatsnest( nullptr );
1770
1771 std::vector<MSG_PANEL_ITEM> msg_list;
1772 GetBoard()->GetMsgPanelInfo( this, msg_list );
1773 SetMsgPanel( msg_list );
1774}
1775
1776
1778{
1779 wxFileName fn = GetBoard()->GetFileName();
1780 bool readOnly = false;
1781 bool unsaved = false;
1782
1783 if( fn.IsOk() && fn.FileExists() )
1784 readOnly = !fn.IsFileWritable();
1785 else
1786 unsaved = true;
1787
1788 wxString title;
1789
1790 if( IsContentModified() )
1791 title = wxT( "*" );
1792
1793 title += fn.GetName();
1794
1795 if( readOnly )
1796 title += wxS( " " ) + _( "[Read Only]" );
1797
1798 if( unsaved )
1799 title += wxS( " " ) + _( "[Unsaved]" );
1800
1801 title += wxT( " \u2014 " ) + _( "PCB Editor" );
1802
1803 SetTitle( title );
1804}
1805
1806
1808{
1809 // Update the layer manager and other widgets from the board setup
1810 // (layer and items visibility, colors ...)
1811
1812 // Rebuild list of nets (full ratsnest rebuild)
1814
1815 // Update info shown by the horizontal toolbars
1817
1818 LSET activeLayers = GetBoard()->GetEnabledLayers();
1819
1820 if( !activeLayers.test( GetActiveLayer() ) )
1821 SetActiveLayer( activeLayers.Seq().front() );
1822
1824
1826
1827 layerEnum.Choices().Clear();
1828 layerEnum.Undefined( UNDEFINED_LAYER );
1829
1830 for( PCB_LAYER_ID layer : LSET::AllLayersMask().Seq() )
1831 {
1832 // Canonical name
1833 layerEnum.Map( layer, LSET::Name( layer ) );
1834
1835 // User name
1836 layerEnum.Map( layer, GetBoard()->GetLayerName( layer ) );
1837 }
1838
1839 // Sync visibility with canvas
1840 for( PCB_LAYER_ID layer : LSET::AllLayersMask().Seq() )
1841 GetCanvas()->GetView()->SetLayerVisible( layer, GetBoard()->IsLayerVisible( layer ) );
1842
1843 // Stackup and/or color theme may have changed
1846}
1847
1848
1850{
1851 // switches currently used canvas (Cairo / OpenGL).
1852 PCB_BASE_FRAME::SwitchCanvas( aCanvasType );
1853}
1854
1855
1857{
1858 if( !m_findDialog )
1859 {
1860 m_findDialog = new DIALOG_FIND( this );
1863 }
1864
1865 wxString findString;
1866
1867 PCB_SELECTION& selection = m_toolManager->GetTool<PCB_SELECTION_TOOL>()->GetSelection();
1868
1869 if( selection.Size() == 1 )
1870 {
1871 EDA_ITEM* front = selection.Front();
1872
1873 switch( front->Type() )
1874 {
1875 case PCB_FOOTPRINT_T:
1876 findString = UnescapeString( static_cast<FOOTPRINT*>( front )->GetValue() );
1877 break;
1878
1879 case PCB_FIELD_T:
1880 case PCB_TEXT_T:
1881 findString = UnescapeString( static_cast<PCB_TEXT*>( front )->GetText() );
1882
1883 if( findString.Contains( wxT( "\n" ) ) )
1884 findString = findString.Before( '\n' );
1885
1886 break;
1887
1888 default:
1889 break;
1890 }
1891 }
1892
1893 m_findDialog->Preload( findString );
1894
1895 m_findDialog->Show( true );
1896}
1897
1898
1899void PCB_EDIT_FRAME::FindNext( bool reverse )
1900{
1901 if( !m_findDialog )
1903
1904 m_findDialog->FindNext( reverse );
1905}
1906
1907
1909{
1910 PCB_PLOT_PARAMS plotSettings = GetPlotSettings();
1911
1912 switch( aID )
1913 {
1914 case ID_GEN_PLOT_GERBER:
1915 plotSettings.SetFormat( PLOT_FORMAT::GERBER );
1916 break;
1917 case ID_GEN_PLOT_DXF:
1918 plotSettings.SetFormat( PLOT_FORMAT::DXF );
1919 break;
1920 case ID_GEN_PLOT_HPGL:
1921 plotSettings.SetFormat( PLOT_FORMAT::HPGL );
1922 break;
1923 case ID_GEN_PLOT_PDF:
1924 plotSettings.SetFormat( PLOT_FORMAT::PDF );
1925 break;
1926 case ID_GEN_PLOT_PS:
1927 plotSettings.SetFormat( PLOT_FORMAT::POST );
1928 break;
1929 case ID_GEN_PLOT_SVG:
1930 plotSettings.SetFormat( PLOT_FORMAT::SVG );
1931 break;
1932 case ID_GEN_PLOT:
1933 /* keep the previous setup */
1934 break;
1935 default:
1936 wxFAIL_MSG( wxT( "ToPlotter(): unexpected plot type" ) ); break;
1937 break;
1938 }
1939
1940 SetPlotSettings( plotSettings );
1941
1942 DIALOG_PLOT dlg( this );
1943 dlg.ShowQuasiModal( );
1944}
1945
1946
1948{
1949 if( Kiface().IsSingle() )
1950 return 0;
1951
1952 // Update PCB requires a netlist. Therefore the schematic editor must be running
1953 // If this is not the case, open the schematic editor
1954 KIWAY_PLAYER* frame = Kiway().Player( FRAME_SCH, true );
1955
1956 // If Kiway() cannot create the eeschema frame, it shows a error message, and
1957 // frame is null
1958 if( !frame )
1959 return -1;
1960
1961 if( !frame->IsShownOnScreen() )
1962 {
1963 wxEventBlocker blocker( this );
1964 wxFileName fn( Prj().GetProjectPath(), Prj().GetProjectName(),
1966
1967 // Maybe the file hasn't been converted to the new s-expression file format so
1968 // see if the legacy schematic file is still in play.
1969 if( !fn.FileExists() )
1970 {
1972
1973 if( !fn.FileExists() )
1974 {
1975 DisplayErrorMessage( this, _( "The schematic for this board cannot be found." ) );
1976 return -2;
1977 }
1978 }
1979
1980 frame->OpenProjectFiles( std::vector<wxString>( 1, fn.GetFullPath() ) );
1981
1982 // we show the schematic editor frame, because do not show is seen as
1983 // a not yet opened schematic by Kicad manager, which is not the case
1984 frame->Show( true );
1985
1986 // bring ourselves back to the front
1987 Raise();
1988 }
1989
1990 return 1; //Success!
1991}
1992
1993
1995 const wxString& aAnnotateMessage )
1996{
1997 int standalone = TestStandalone();
1998
1999 if( standalone == 0 )
2000 {
2001 DisplayErrorMessage( this, _( "Cannot update the PCB because PCB editor is opened in "
2002 "stand-alone mode. In order to create or update PCBs from "
2003 "schematics, you must launch the KiCad project manager and "
2004 "create a project." ) );
2005 return false; // Not in standalone mode
2006 }
2007
2008 if( standalone < 0 ) // Problem with Eeschema or the schematic
2009 return false;
2010
2011 Raise(); // Show
2012
2013 std::string payload( aAnnotateMessage );
2014
2015 Kiway().ExpressMail( FRAME_SCH, MAIL_SCH_GET_NETLIST, payload, this );
2016
2017 if( payload == aAnnotateMessage )
2018 {
2019 Raise();
2020 DisplayErrorMessage( this, aAnnotateMessage );
2021 return false;
2022 }
2023
2024 try
2025 {
2026 auto lineReader = new STRING_LINE_READER( payload, _( "Eeschema netlist" ) );
2027 KICAD_NETLIST_READER netlistReader( lineReader, &aNetlist );
2028 netlistReader.LoadNetlist();
2029 }
2030 catch( const IO_ERROR& e )
2031 {
2032 Raise();
2033
2034 // Do not translate extra_info strings. These are for developers
2035 wxString extra_info = e.Problem() + wxT( " : " ) + e.What() + wxT( " at " ) + e.Where();
2036
2037 DisplayErrorMessage( this, _( "Received an error while reading netlist. Please "
2038 "report this issue to the KiCad team using the menu "
2039 "Help->Report Bug."), extra_info );
2040 return false;
2041 }
2042
2043 return true;
2044}
2045
2046
2048{
2049 wxString msg;
2050 wxFileName schematic( Prj().GetProjectPath(), Prj().GetProjectName(),
2052
2053 if( !schematic.FileExists() )
2054 {
2055 wxFileName legacySchematic( Prj().GetProjectPath(), Prj().GetProjectName(),
2057
2058 if( legacySchematic.FileExists() )
2059 {
2060 schematic = legacySchematic;
2061 }
2062 else
2063 {
2064 msg.Printf( _( "Schematic file '%s' not found." ), schematic.GetFullPath() );
2065 DisplayErrorMessage( this, msg );
2066 return;
2067 }
2068 }
2069
2070 if( Kiface().IsSingle() )
2071 {
2072 ExecuteFile( EESCHEMA_EXE, schematic.GetFullPath() );
2073 }
2074 else
2075 {
2076 KIWAY_PLAYER* frame = Kiway().Player( FRAME_SCH, false );
2077
2078 // Please: note: DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::initBuffers() calls
2079 // Kiway.Player( FRAME_SCH, true )
2080 // therefore, the schematic editor is sometimes running, but the schematic project
2081 // is not loaded, if the library editor was called, and the dialog field editor was used.
2082 // On Linux, it happens the first time the schematic editor is launched, if
2083 // library editor was running, and the dialog field editor was open
2084 // On Windows, it happens always after the library editor was called,
2085 // and the dialog field editor was used
2086 if( !frame )
2087 {
2088 try
2089 {
2090 frame = Kiway().Player( FRAME_SCH, true );
2091 }
2092 catch( const IO_ERROR& err )
2093 {
2094
2095 DisplayErrorMessage( this, _( "Eeschema failed to load." ) + wxS( "\n" ) + err.What() );
2096 return;
2097 }
2098 }
2099
2100 wxEventBlocker blocker( this );
2101
2102 // If Kiway() cannot create the eeschema frame, it shows a error message, and
2103 // frame is null
2104 if( !frame )
2105 return;
2106
2107 if( !frame->IsShownOnScreen() ) // the frame exists, (created by the dialog field editor)
2108 // but no project loaded.
2109 {
2110 frame->OpenProjectFiles( std::vector<wxString>( 1, schematic.GetFullPath() ) );
2111 frame->Show( true );
2112 }
2113
2114 // On Windows, Raise() does not bring the window on screen, when iconized or not shown
2115 // On Linux, Raise() brings the window on screen, but this code works fine
2116 if( frame->IsIconized() )
2117 {
2118 frame->Iconize( false );
2119
2120 // If an iconized frame was created by Pcbnew, Iconize( false ) is not enough
2121 // to show the frame at its normal size: Maximize should be called.
2122 frame->Maximize( false );
2123 }
2124
2125 frame->Raise();
2126 }
2127}
2128
2129
2131{
2132 const ENV_VAR_MAP& vars = Pgm().GetLocalEnvVariables();
2133
2134 // Set the environment variables for python scripts
2135 // note: the string will be encoded UTF8 for python env
2136 for( const std::pair<const wxString, ENV_VAR_ITEM>& var : vars )
2137 UpdatePythonEnvVar( var.first, var.second.GetValue() );
2138
2139 // Because the env vars can be modified by the python scripts (rewritten in UTF8),
2140 // regenerate them (in Unicode) for our normal environment
2141 for( const std::pair<const wxString, ENV_VAR_ITEM>& var : vars )
2142 wxSetEnv( var.first, var.second.GetValue() );
2143}
2144
2145
2147{
2148 wxString evValue;
2149 wxGetEnv( PROJECT_VAR_NAME, &evValue );
2150 UpdatePythonEnvVar( wxString( PROJECT_VAR_NAME ).ToStdString(), evValue );
2151
2152 // Because PROJECT_VAR_NAME can be modified by the python scripts (rewritten in UTF8),
2153 // regenerate it (in Unicode) for our normal environment
2154 wxSetEnv( PROJECT_VAR_NAME, evValue );
2155}
2156
2157
2159{
2160 if( aFootprint == nullptr )
2161 return;
2162
2164
2165 /*
2166 * Make sure dlg is destroyed before GetCanvas->Refresh is called
2167 * later or the refresh will try to modify its properties since
2168 * they share a GL context.
2169 */
2170 {
2171 DIALOG_FOOTPRINT_PROPERTIES dlg( this, aFootprint );
2172
2173 dlg.ShowQuasiModal();
2174 retvalue = dlg.GetReturnValue();
2175 }
2176
2177 /*
2178 * retvalue =
2179 * FP_PROPS_UPDATE_FP to show Update Footprints dialog
2180 * FP_PROPS_CHANGE_FP to show Change Footprints dialog
2181 * FP_PROPS_OK for normal edit
2182 * FP_PROPS_CANCEL if aborted
2183 * FP_PROPS_EDIT_BOARD_FP to load board footprint into Footprint Editor
2184 * FP_PROPS_EDIT_LIBRARY_FP to load library footprint into Footprint Editor
2185 */
2186
2188 {
2189 // If something edited, push a refresh request
2190 GetCanvas()->Refresh();
2191 }
2193 {
2194 if( KIWAY_PLAYER* frame = Kiway().Player( FRAME_FOOTPRINT_EDITOR, true ) )
2195 {
2196 FOOTPRINT_EDIT_FRAME* fp_editor = static_cast<FOOTPRINT_EDIT_FRAME*>( frame );
2197
2198 fp_editor->LoadFootprintFromBoard( aFootprint );
2199 fp_editor->Show( true );
2200 fp_editor->Raise(); // Iconize( false );
2201 }
2202 }
2204 {
2205 if( KIWAY_PLAYER* frame = Kiway().Player( FRAME_FOOTPRINT_EDITOR, true ) )
2206 {
2207 FOOTPRINT_EDIT_FRAME* fp_editor = static_cast<FOOTPRINT_EDIT_FRAME*>( frame );
2208
2209 fp_editor->LoadFootprintFromLibrary( aFootprint->GetFPID() );
2210 fp_editor->Show( true );
2211 fp_editor->Raise(); // Iconize( false );
2212 }
2213 }
2215 {
2216 ShowExchangeFootprintsDialog( aFootprint, true, true );
2217 }
2219 {
2220 ShowExchangeFootprintsDialog( aFootprint, false, true );
2221 }
2222}
2223
2224
2226 bool aSelectedMode )
2227{
2228 DIALOG_EXCHANGE_FOOTPRINTS dialog( this, aFootprint, aUpdateMode, aSelectedMode );
2229
2230 return dialog.ShowQuasiModal();
2231}
2232
2233
2245static void processTextItem( const PCB_TEXT& aSrc, PCB_TEXT& aDest,
2246 bool aResetText, bool aResetTextLayers, bool aResetTextEffects,
2247 bool* aUpdated )
2248{
2249 if( aResetText )
2250 *aUpdated |= aSrc.GetText() != aDest.GetText();
2251 else
2252 aDest.SetText( aSrc.GetText() );
2253
2254 if( aResetTextLayers )
2255 {
2256 *aUpdated |= aSrc.GetLayer() != aDest.GetLayer();
2257 *aUpdated |= aSrc.IsVisible() != aDest.IsVisible();
2258 }
2259 else
2260 {
2261 aDest.SetLayer( aSrc.GetLayer() );
2262 aDest.SetVisible( aSrc.IsVisible() );
2263 }
2264
2265 if( aResetTextEffects )
2266 {
2267 *aUpdated |= aSrc.GetHorizJustify() != aDest.GetHorizJustify();
2268 *aUpdated |= aSrc.GetVertJustify() != aDest.GetVertJustify();
2269 *aUpdated |= aSrc.GetTextSize() != aDest.GetTextSize();
2270 *aUpdated |= aSrc.GetTextThickness() != aDest.GetTextThickness();
2271 *aUpdated |= aSrc.GetTextAngle() != aDest.GetTextAngle();
2272 *aUpdated |= aSrc.GetFPRelativePosition() != aDest.GetFPRelativePosition();
2273 }
2274 else
2275 {
2276 // Careful: the visible bit and position are also set by SetAttributes()
2277 bool visible = aDest.IsVisible();
2278 aDest.SetAttributes( aSrc );
2279 aDest.SetVisible( visible );
2281 }
2282
2283 aDest.SetLocked( aSrc.IsLocked() );
2284 const_cast<KIID&>( aDest.m_Uuid ) = aSrc.m_Uuid;
2285}
2286
2287
2288static PCB_TEXT* getMatchingTextItem( PCB_TEXT* aRefItem, FOOTPRINT* aFootprint )
2289{
2290 std::vector<PCB_TEXT*> candidates;
2291
2292 for( BOARD_ITEM* item : aFootprint->GraphicalItems() )
2293 {
2294 PCB_TEXT* candidate = dynamic_cast<PCB_TEXT*>( item );
2295
2296 if( candidate && candidate->GetText() == aRefItem->GetText() )
2297 candidates.push_back( candidate );
2298 }
2299
2300 if( candidates.size() == 0 )
2301 return nullptr;
2302
2303 if( candidates.size() == 1 )
2304 return candidates[0];
2305
2306 // Try refining the match by layer
2307 std::vector<PCB_TEXT*> candidatesOnSameLayer;
2308
2309 for( PCB_TEXT* candidate : candidates )
2310 {
2311 if( candidate->GetLayer() == aRefItem->GetLayer() )
2312 candidatesOnSameLayer.push_back( candidate );
2313 }
2314
2315 if( candidatesOnSameLayer.size() == 1 )
2316 return candidatesOnSameLayer[0];
2317
2318 // Last ditch effort: refine by position
2319 std::vector<PCB_TEXT*> candidatesAtSamePos;
2320
2321 for( PCB_TEXT* candidate : candidatesOnSameLayer.size() ? candidatesOnSameLayer : candidates )
2322 {
2323 if( candidate->GetFPRelativePosition() == aRefItem->GetFPRelativePosition() )
2324 candidatesAtSamePos.push_back( candidate );
2325 }
2326
2327 if( candidatesAtSamePos.size() > 0 )
2328 return candidatesAtSamePos[0];
2329 else if( candidatesOnSameLayer.size() > 0 )
2330 return candidatesOnSameLayer[0];
2331 else
2332 return candidates[0];
2333}
2334
2335
2337 BOARD_COMMIT& aCommit, bool deleteExtraTexts,
2338 bool resetTextLayers, bool resetTextEffects,
2339 bool resetTextContent, bool resetFabricationAttrs,
2340 bool reset3DModels, bool* aUpdated )
2341{
2342 PCB_GROUP* parentGroup = aExisting->GetParentGroup();
2343 bool dummyBool = false;
2344
2345 if( !aUpdated )
2346 aUpdated = &dummyBool;
2347
2348 if( parentGroup )
2349 {
2350 parentGroup->RemoveItem( aExisting );
2351 parentGroup->AddItem( aNew );
2352 }
2353
2354 aNew->SetParent( GetBoard() );
2355
2356 PlaceFootprint( aNew, false );
2357
2358 // PlaceFootprint will move the footprint to the cursor position, which we don't want. Copy
2359 // the original position across.
2360 aNew->SetPosition( aExisting->GetPosition() );
2361
2362 if( aNew->GetLayer() != aExisting->GetLayer() )
2363 aNew->Flip( aNew->GetPosition(), GetPcbNewSettings()->m_FlipDirection );
2364
2365 if( aNew->GetOrientation() != aExisting->GetOrientation() )
2366 aNew->SetOrientation( aExisting->GetOrientation() );
2367
2368 aNew->SetLocked( aExisting->IsLocked() );
2369
2370 // Now transfer the net info from "old" pads to the new footprint
2371 for( PAD* newPad : aNew->Pads() )
2372 {
2373 PAD* oldPad = nullptr;
2374
2375 // Pads with no numbers can't be matched. (Then again, they're never connected to a
2376 // net either, so it's just the UUID retention that we can't perform.)
2377 if( newPad->GetNumber().IsEmpty() )
2378 {
2380 continue;
2381 }
2382
2383 // Search for a similar pad to reuse UUID and net info
2384 PAD* last_pad = nullptr;
2385
2386 while( true )
2387 {
2388 oldPad = aExisting->FindPadByNumber( newPad->GetNumber(), last_pad );
2389
2390 if( !oldPad )
2391 break;
2392
2393 if( newPad->IsOnCopperLayer() == oldPad->IsOnCopperLayer() ) // a candidate is found
2394 break;
2395
2396 last_pad = oldPad;
2397 }
2398
2399 if( oldPad )
2400 {
2401 const_cast<KIID&>( newPad->m_Uuid ) = oldPad->m_Uuid;
2402 newPad->SetLocalRatsnestVisible( oldPad->GetLocalRatsnestVisible() );
2403 newPad->SetPinFunction( oldPad->GetPinFunction() );
2404 newPad->SetPinType( oldPad->GetPinType() );
2405 }
2406
2407 if( newPad->IsOnCopperLayer() )
2408 newPad->SetNetCode( oldPad ? oldPad->GetNetCode() : NETINFO_LIST::UNCONNECTED );
2409 else
2410 newPad->SetNetCode( NETINFO_LIST::UNCONNECTED );
2411 }
2412
2413 for( BOARD_ITEM* oldItem : aExisting->GraphicalItems() )
2414 {
2415 PCB_TEXT* oldTextItem = dynamic_cast<PCB_TEXT*>( oldItem );
2416
2417 if( oldTextItem )
2418 {
2419 // Dimensions have PCB_TEXT base but are not treated like texts in the updater
2420 if( dynamic_cast<PCB_DIMENSION_BASE*>( oldTextItem ) )
2421 continue;
2422
2423 PCB_TEXT* newTextItem = getMatchingTextItem( oldTextItem, aNew );
2424
2425 if( newTextItem )
2426 {
2427 processTextItem( *oldTextItem, *newTextItem, resetTextContent, resetTextLayers,
2428 resetTextEffects, aUpdated );
2429 }
2430 else if( deleteExtraTexts )
2431 {
2432 *aUpdated = true;
2433 }
2434 else
2435 {
2436 aNew->Add( static_cast<BOARD_ITEM*>( oldTextItem->Clone() ) );
2437 }
2438 }
2439 }
2440
2441 // Copy reference. The initial text is always used, never resetted
2442 processTextItem( aExisting->Reference(), aNew->Reference(), false, resetTextLayers,
2443 resetTextEffects, aUpdated );
2444
2445 // Copy value
2446 processTextItem( aExisting->Value(), aNew->Value(),
2447 // reset value text only when it is a proxy for the footprint ID
2448 // (cf replacing value "MountingHole-2.5mm" with "MountingHole-4.0mm")
2449 aExisting->GetValue() == aExisting->GetFPID().GetLibItemName().wx_str(),
2450 resetTextLayers, resetTextEffects, aUpdated );
2451
2452 // Copy fields in accordance with the reset* flags
2453 for( PCB_FIELD* oldField : aExisting->GetFields() )
2454 {
2455 // Reference and value are already handled
2456 if( oldField->IsReference() || oldField->IsValue() )
2457 continue;
2458
2459 PCB_FIELD* newField = aNew->GetFieldByName( oldField->GetName() );
2460
2461 if( newField )
2462 {
2463 processTextItem( *oldField, *newField, resetTextContent, resetTextLayers,
2464 resetTextEffects, aUpdated );
2465 }
2466 else if( deleteExtraTexts )
2467 {
2468 *aUpdated = true;
2469 }
2470 else
2471 {
2472 newField = new PCB_FIELD( *oldField );
2473 aNew->Add( newField );
2474 processTextItem( *oldField, *newField, true, true, true, aUpdated );
2475 }
2476 }
2477
2478 // Careful; allow-soldermask-bridges is in the m_attributes field but is not presented
2479 // as a fabrication attribute in the GUI....
2480 int existingFabAttrs = aExisting->GetAttributes() & ~FP_ALLOW_SOLDERMASK_BRIDGES;
2481 int libraryFabAttrs = aNew->GetAttributes() & ~FP_ALLOW_SOLDERMASK_BRIDGES;
2482
2483 if( resetFabricationAttrs )
2484 {
2485 // We've replaced the existing footprint with the library one, so the fabrication attrs
2486 // are already reset. Just set the aUpdated flag if appropriate.
2487 if( libraryFabAttrs != existingFabAttrs )
2488 *aUpdated = true;
2489 }
2490 else
2491 {
2492 int solderMaskBridgesFlag = aNew->GetAttributes() & FP_ALLOW_SOLDERMASK_BRIDGES;
2493 aNew->SetAttributes( existingFabAttrs | solderMaskBridgesFlag );
2494 }
2495
2496 if( reset3DModels )
2497 {
2498 // We've replaced the existing footprint with the library one, so the 3D models are
2499 // already reset. Just set the aUpdated flag if appropriate.
2500 if( aNew->Models().size() != aExisting->Models().size() )
2501 {
2502 *aUpdated = true;
2503 }
2504 else
2505 {
2506 for( size_t ii = 0; ii < aNew->Models().size(); ++ii )
2507 {
2508 if( aNew->Models()[ii] != aExisting->Models()[ii] )
2509 {
2510 *aUpdated = true;
2511 break;
2512 }
2513 }
2514 }
2515 }
2516 else
2517 {
2518 aNew->Models() = aExisting->Models(); // Linked list of 3D models.
2519 }
2520
2521 // Updating other parameters
2522 const_cast<KIID&>( aNew->m_Uuid ) = aExisting->m_Uuid;
2523 aNew->SetPath( aExisting->GetPath() );
2524 aNew->SetSheetfile( aExisting->GetSheetfile() );
2525 aNew->SetSheetname( aExisting->GetSheetname() );
2526 aNew->SetFilters( aExisting->GetFilters() );
2527 aNew->SetComponentClass( aExisting->GetComponentClass() );
2528
2529 aCommit.Remove( aExisting );
2530 aCommit.Add( aNew );
2531
2532 aNew->ClearFlags();
2533}
2534
2535
2536void PCB_EDIT_FRAME::CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged )
2537{
2538 PCB_BASE_EDIT_FRAME::CommonSettingsChanged( aEnvVarsChanged, aTextVarsChanged );
2539
2541
2542 SetElementVisibility( LAYER_RATSNEST, GetPcbNewSettings()->m_Display.m_ShowGlobalRatsnest );
2543
2545
2546 // Netclass definitions could have changed, either by us or by Eeschema, so we need to
2547 // recompile the implicit rules
2548 DRC_TOOL* drcTool = m_toolManager->GetTool<DRC_TOOL>();
2549 WX_INFOBAR* infobar = GetInfoBar();
2550
2551 try
2552 {
2553 drcTool->GetDRCEngine()->InitEngine( GetDesignRulesPath() );
2554
2555 if( infobar->GetMessageType() == WX_INFOBAR::MESSAGE_TYPE::DRC_RULES_ERROR )
2556 infobar->Dismiss();
2557 }
2558 catch( PARSE_ERROR& )
2559 {
2560 wxHyperlinkCtrl* button = new wxHyperlinkCtrl( infobar, wxID_ANY, _( "Edit design rules" ),
2561 wxEmptyString );
2562
2563 button->Bind( wxEVT_COMMAND_HYPERLINK, std::function<void( wxHyperlinkEvent& aEvent )>(
2564 [&]( wxHyperlinkEvent& aEvent )
2565 {
2566 ShowBoardSetupDialog( _( "Custom Rules" ) );
2567 } ) );
2568
2569 infobar->RemoveAllButtons();
2570 infobar->AddButton( button );
2571 infobar->AddCloseButton();
2572 infobar->ShowMessage( _( "Could not compile custom design rules." ), wxICON_ERROR,
2574 }
2575
2578
2579 // Update the environment variables in the Python interpreter
2580 if( aEnvVarsChanged )
2582
2583 Layout();
2584 SendSizeEvent();
2585}
2586
2587
2589{
2591}
2592
2593
2595{
2597}
2598
2599
2601{
2602 // For now, be conservative: Don't allow any API use while the user is changing things
2603 if( GetToolManager()->GetCurrentTool() != GetToolManager()->GetTool<PCB_SELECTION_TOOL>() )
2604 return false;
2605
2607
2608 if( zoneFillerTool->IsBusy() )
2609 return false;
2610
2611 ROUTER_TOOL* routerTool = m_toolManager->GetTool<ROUTER_TOOL>();
2612
2613 if( routerTool->RoutingInProgress() )
2614 return false;
2615
2617}
2618
2619
2620bool ExportBoardToHyperlynx( BOARD* aBoard, const wxFileName& aPath );
2621
2622
2623void PCB_EDIT_FRAME::OnExportHyperlynx( wxCommandEvent& event )
2624{
2625 wxString wildcard = wxT( "*.hyp" );
2626 wxFileName fn = GetBoard()->GetFileName();
2627
2628 fn.SetExt( wxT("hyp") );
2629
2630 wxFileDialog dlg( this, _( "Export Hyperlynx Layout" ), fn.GetPath(), fn.GetFullName(),
2631 wildcard, wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
2632
2633 if( dlg.ShowModal() != wxID_OK )
2634 return;
2635
2636 fn = dlg.GetPath();
2637
2638 // always enforce filename extension, user may not have entered it.
2639 fn.SetExt( wxT( "hyp" ) );
2640
2642}
2643
2644
2646{
2647 return GetBoard()->GetFileName();
2648}
2649
2650
2652{
2653 return m_auimgr.GetPane( wxS( "LayersManager" ) ).IsShown();
2654}
2655
2656
2658{
2659 return m_auimgr.GetPane( PropertiesPaneName() ).IsShown();
2660}
2661
2662
2664{
2665 return m_auimgr.GetPane( NetInspectorPanelName() ).IsShown();
2666}
2667
2668
2669void PCB_EDIT_FRAME::onSize( wxSizeEvent& aEvent )
2670{
2671 if( IsShownOnScreen() )
2672 {
2673 // We only need this until the frame is done resizing and the final client size is
2674 // established.
2675 Unbind( wxEVT_SIZE, &PCB_EDIT_FRAME::onSize, this );
2677 }
2678
2679 // Skip() is called in the base class.
2680 EDA_DRAW_FRAME::OnSize( aEvent );
2681}
2682
2683
2685{
2688 _( "Violation Report" ) );
2689
2690 return m_inspectDrcErrorDlg;
2691}
2692
2693
2695{
2698 _( "Clearance Report" ) );
2699
2700 return m_inspectClearanceDlg;
2701}
2702
2703
2705{
2708 _( "Constraints Report" ) );
2709
2711}
2712
2713
2715{
2716 if( !m_footprintDiffDlg )
2718 _( "Compare Footprint with Library" ) );
2719
2720 return m_footprintDiffDlg;
2721}
2722
2723
2725{
2726 if( m_inspectDrcErrorDlg && aEvent.GetString() == INSPECT_DRC_ERROR_DIALOG_NAME )
2727 {
2728 m_inspectDrcErrorDlg->Destroy();
2729 m_inspectDrcErrorDlg = nullptr;
2730 }
2731 else if( m_inspectClearanceDlg && aEvent.GetString() == INSPECT_CLEARANCE_DIALOG_NAME )
2732 {
2733 m_inspectClearanceDlg->Destroy();
2734 m_inspectClearanceDlg = nullptr;
2735 }
2736 else if( m_inspectConstraintsDlg && aEvent.GetString() == INSPECT_CONSTRAINTS_DIALOG_NAME )
2737 {
2738 m_inspectConstraintsDlg->Destroy();
2739 m_inspectConstraintsDlg = nullptr;
2740 }
2741 else if( m_footprintDiffDlg && aEvent.GetString() == INSPECT_CONSTRAINTS_DIALOG_NAME )
2742 {
2743 m_footprintDiffDlg->Destroy();
2744 m_footprintDiffDlg = nullptr;
2745 }
2746}
2747
2748#ifdef KICAD_IPC_API
2749void PCB_EDIT_FRAME::onPluginAvailabilityChanged( wxCommandEvent& aEvt )
2750{
2751 wxLogTrace( traceApi, "PCB frame: EDA_EVT_PLUGIN_AVAILABILITY_CHANGED" );
2753 aEvt.Skip();
2754}
2755#endif
Class PCBNEW_ACTION_PLUGINS.
const KICOMMON_API wxEventTypeTag< wxCommandEvent > EDA_EVT_PLUGIN_AVAILABILITY_CHANGED
Notifies other parts of KiCad when plugin availability changes.
constexpr EDA_IU_SCALE pcbIUScale
Definition: base_units.h:108
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:187
static TOOL_ACTION paste
Definition: actions.h:73
static TOOL_ACTION millimetersUnits
Definition: actions.h:195
static TOOL_ACTION unselectAll
Definition: actions.h:76
static TOOL_ACTION togglePolarCoords
Definition: actions.h:198
static TOOL_ACTION copy
Definition: actions.h:71
static TOOL_ACTION pluginsReload
Definition: actions.h:241
static TOOL_ACTION pasteSpecial
Definition: actions.h:74
static TOOL_ACTION milsUnits
Definition: actions.h:194
static TOOL_ACTION toggleBoundingBoxes
Definition: actions.h:147
static TOOL_ACTION showSearch
Definition: actions.h:108
static TOOL_ACTION undo
Definition: actions.h:68
static TOOL_ACTION duplicate
Definition: actions.h:77
static TOOL_ACTION inchesUnits
Definition: actions.h:193
static TOOL_ACTION highContrastMode
Definition: actions.h:145
static TOOL_ACTION embeddedFiles
Definition: actions.h:244
static TOOL_ACTION toggleCursorStyle
Definition: actions.h:144
static TOOL_ACTION measureTool
Definition: actions.h:203
static TOOL_ACTION doDelete
Definition: actions.h:78
static TOOL_ACTION selectionTool
Definition: actions.h:202
static TOOL_ACTION save
Definition: actions.h:51
static TOOL_ACTION zoomFitScreen
Definition: actions.h:134
static TOOL_ACTION redo
Definition: actions.h:69
static TOOL_ACTION deleteTool
Definition: actions.h:79
static TOOL_ACTION zoomTool
Definition: actions.h:138
static TOOL_ACTION showProperties
Definition: actions.h:216
static TOOL_ACTION cut
Definition: actions.h:70
static TOOL_ACTION gridSetOrigin
Definition: actions.h:184
static TOOL_ACTION toggleGridOverrides
Definition: actions.h:188
static TOOL_ACTION selectAll
Definition: actions.h:75
Manage TOOL_ACTION objects.
void SetConditions(const TOOL_ACTION &aAction, const ACTION_CONDITIONS &aConditions)
Set the conditions the UI elements for activating a specific tool action should use for determining t...
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
void ApplyLayerPreset(const wxString &aPresetName)
int GetTabIndex() const
Set the current notebook tab.
void UpdateDisplayOptions()
Return a list of the layer presets created by the user.
void OnColorThemeChanged()
Respond to change in OS's DarkMode.
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
Definition: app_settings.h:92
The array tool.
Definition: array_tool.h:48
Tool responsible for automagic placement of components.
Handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:41
int GetPageCount() const
Definition: base_screen.h:72
bool IsContentModified() const
Definition: base_screen.h:60
const wxString & GetPageNumber() const
Definition: base_screen.cpp:70
virtual void Push(const wxString &aMessage=wxEmptyString, int aCommitFlags=0) override
Execute the changes.
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
bool SetNetCode(int aNetCode, bool aNoAssert)
Set net using a net code.
bool GetLocalRatsnestVisible() const
Handle actions specific to the board editor in PcbNew.
Tool for pcb inspection.
Abstract interface for BOARD_ITEMs capable of storing other items inside.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:79
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition: board_item.h:239
virtual void SetLocked(bool aLocked)
Definition: board_item.h:330
PCB_GROUP * GetParentGroup() const
Definition: board_item.h:90
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Definition: board_item.h:290
VECTOR2I GetFPRelativePosition() const
Definition: board_item.cpp:327
void SetFPRelativePosition(const VECTOR2I &aPos)
Definition: board_item.cpp:341
virtual bool IsLocked() const
Definition: board_item.cpp:75
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:295
LSET GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
Definition: board.cpp:817
void BuildListOfNets()
Definition: board.h:842
bool IsElementVisible(GAL_LAYER_ID aLayer) const
Test whether a given element category is visible.
Definition: board.cpp:883
void RemoveAllListeners()
Remove all listeners.
Definition: board.cpp:2735
const PAGE_INFO & GetPageSettings() const
Definition: board.h:697
GAL_SET GetVisibleElements() const
Return a set of all the element categories that are visible.
Definition: board.cpp:877
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:187
void SynchronizeNetsAndNetClasses(bool aResetTrackAndViaSizes)
Copy NETCLASS info to each NET, based on NET membership in a NETCLASS.
Definition: board.cpp:2094
TITLE_BLOCK & GetTitleBlock()
Definition: board.h:703
const std::map< wxString, wxString > & GetProperties() const
Definition: board.h:367
void SetProject(PROJECT *aProject, bool aReferenceOnly=false)
Link a board to a given project.
Definition: board.cpp:197
const wxString & GetFileName() const
Definition: board.h:332
void SetElementVisibility(GAL_LAYER_ID aLayer, bool aNewState)
Change the visibility of an element category.
Definition: board.cpp:889
void ClearProject()
Definition: board.cpp:235
PROJECT * GetProject() const
Definition: board.h:499
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:1774
void UpdateRatsnestExclusions()
Update the visibility flags on the current unconnected ratsnest lines.
Definition: board.cpp:296
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Return a list of missing connections between components/tracks.
Definition: board.h:483
constexpr BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
Definition: box2.h:558
void SetColor(int aLayer, const COLOR4D &aColor)
COLOR4D GetColor(int aLayer) const
COMMIT & Remove(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Remove a new item from the model.
Definition: commit.h:92
COMMIT & Add(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Add a new item to the model.
Definition: commit.h:80
Handle actions that are shared between different applications.
Handles action that are shared between different applications.
Definition: common_tools.h:38
void SetCallback(std::function< void(BOARD_ITEM *)> aCallback)
Function to be called on each found event.
Definition: dialog_find.h:63
bool Show(bool show=true) override
The Show method is overridden to make the search combobox focused by default.
void Preload(const wxString &aFindString)
Definition: dialog_find.cpp:98
void FindNext(bool reverse)
Finds the next item.
Definition: dialog_find.h:71
enum FP_PROPS_RETVALUE GetReturnValue()
A dialog to set the plot options and create plot files in various formats.
Definition: dialog_plot.h:41
int ShowQuasiModal()
Tool responsible for drawing graphical elements like lines, arcs, circles, etc.
Definition: drawing_tool.h:55
MODE GetDrawingMode() const
Return the current drawing mode of the DRAWING_TOOL or MODE::NONE if not currently in any drawing mod...
std::shared_ptr< DRC_ENGINE > GetDRCEngine()
Definition: drc_tool.h:78
bool IsDRCRunning() const
Check to see if the DRC engine is running the tests.
Definition: drc_tool.h:71
void SetSheetPath(const std::string &aSheetPath)
Set the sheet path displayed in the title block.
void SetSheetCount(int aSheetCount)
Change the sheet-count number displayed in the title block.
void SetPageNumber(const std::string &aPageNumber)
Change the page number displayed in the title block.
void SetSheetName(const std::string &aSheetName)
Set the sheet name displayed in the title block.
void SetIsFirstPage(bool aIsFirstPage)
Change if this is first page.
void SetFileName(const std::string &aFileName)
Set the file name displayed in the title block.
void 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.
void CommonSettingsChanged(bool aEnvVarsChanged, bool aTextVarsChanged) override
Notification event that some of the common (suite-wide) settings have changed.
virtual void OnSize(wxSizeEvent &aEvent)
virtual bool canCloseWindow(wxCloseEvent &aCloseEvent)
virtual int GetUndoCommandCount() const
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 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
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 base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:89
const KIID m_Uuid
Definition: eda_item.h:490
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:101
void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: eda_item.h:129
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:104
Specialization of the wxAuiPaneInfo class for KiCad panels.
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
Definition: eda_text.h:80
const EDA_ANGLE & GetTextAngle() const
Definition: eda_text.h:134
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:98
virtual bool IsVisible() const
Definition: eda_text.h:174
void SetAttributes(const EDA_TEXT &aSrc, bool aSetPosition=true)
Set the text attributes from another instance.
Definition: eda_text.cpp:424
GR_TEXT_H_ALIGN_T GetHorizJustify() const
Definition: eda_text.h:187
virtual void SetVisible(bool aVisible)
Definition: eda_text.cpp:377
GR_TEXT_V_ALIGN_T GetVertJustify() const
Definition: eda_text.h:190
virtual void SetText(const wxString &aText)
Definition: eda_text.cpp:268
int GetTextThickness() const
Definition: eda_text.h:126
VECTOR2I GetTextSize() const
Definition: eda_text.h:248
SELECTION_CONDITION NoActiveTool()
Create a functor testing if there are no tools active in the frame.
SELECTION_CONDITION BoundingBoxes()
SELECTION_CONDITION RedoAvailable()
Create a functor that tests if there are any items in the redo queue.
SELECTION_CONDITION ScriptingConsoleVisible()
Create a functor testing if the python scripting console window is visible.
SELECTION_CONDITION Units(EDA_UNITS aUnit)
Create a functor that tests if the frame has the specified units.
SELECTION_CONDITION GridVisible()
Create a functor testing if the grid is visible in a frame.
SELECTION_CONDITION PolarCoordinates()
Create a functor testing if polar coordinates are current being used.
SELECTION_CONDITION GridOverrides()
Create a functor testing if the grid overrides wires is enabled in a frame.
SELECTION_CONDITION FullscreenCursor()
Create a functor testing if the cursor is full screen in a frame.
The interactive edit tool.
Definition: edit_tool.h:56
ENUM_MAP & Map(T aValue, const wxString &aName)
Definition: property.h:686
static ENUM_MAP< T > & Instance()
Definition: property.h:680
ENUM_MAP & Undefined(T aValue)
Definition: property.h:693
wxPGChoices & Choices()
Definition: property.h:729
void LoadFootprintFromLibrary(LIB_ID aFPID)
bool LoadFootprintFromBoard(FOOTPRINT *aFootprint)
Load a footprint from the main board into the Footprint Editor.
Component library viewer main window.
void SetPosition(const VECTOR2I &aPos) override
Definition: footprint.cpp:2451
void SetLocked(bool isLocked) override
Set the #MODULE_is_LOCKED bit in the m_ModuleStatus.
Definition: footprint.h:419
EDA_ANGLE GetOrientation() const
Definition: footprint.h:225
void SetComponentClass(const COMPONENT_CLASS *aClass)
Definition: footprint.h:1024
void SetOrientation(const EDA_ANGLE &aNewAngle)
Definition: footprint.cpp:2539
PCB_FIELD * GetFieldByName(const wxString &aFieldName)
Return a field in this symbol.
Definition: footprint.cpp:615
wxString GetSheetname() const
Definition: footprint.h:264
void SetPath(const KIID_PATH &aPath)
Definition: footprint.h:262
void SetFilters(const wxString &aFilters)
Definition: footprint.h:271
void SetAttributes(int aAttributes)
Definition: footprint.h:289
void SetSheetfile(const wxString &aSheetfile)
Definition: footprint.h:268
PCB_FIELD & Value()
read/write accessors:
Definition: footprint.h:656
std::deque< PAD * > & Pads()
Definition: footprint.h:204
int GetAttributes() const
Definition: footprint.h:288
const COMPONENT_CLASS * GetComponentClass() const
Definition: footprint.h:1026
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
Definition: footprint.h:234
wxString GetSheetfile() const
Definition: footprint.h:267
const LIB_ID & GetFPID() const
Definition: footprint.h:246
bool IsLocked() const override
Definition: footprint.h:409
PCB_FIELD & Reference()
Definition: footprint.h:657
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
Definition: footprint.cpp:1079
void Flip(const VECTOR2I &aCentre, FLIP_DIRECTION aFlipDirection) override
Flip this object, i.e.
Definition: footprint.cpp:2389
wxString GetFilters() const
Definition: footprint.h:270
void SetSheetname(const wxString &aSheetname)
Definition: footprint.h:265
void GetFields(std::vector< PCB_FIELD * > &aVector, bool aVisibleOnly) const
Populate a std::vector with PCB_TEXTs.
Definition: footprint.cpp:667
std::vector< FP_3DMODEL > & Models()
Definition: footprint.h:218
const wxString & GetValue() const
Definition: footprint.h:642
const KIID_PATH & GetPath() const
Definition: footprint.h:261
VECTOR2I GetPosition() const override
Definition: footprint.h:222
DRAWINGS & GraphicalItems()
Definition: footprint.h:207
PAD * FindPadByNumber(const wxString &aPadNumber, PAD *aSearchAfterMe=nullptr) const
Return a PAD with a matching number.
Definition: footprint.cpp:1906
void ReadWindowSettings(WINDOW_SETTINGS &aCfg)
Read GAL config options from application-level config.
bool Contains(GAL_LAYER_ID aPos)
Definition: layer_ids.h:389
Handle actions specific to filling copper zones.
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
Definition: ki_exception.h:77
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:30
virtual const wxString Problem() const
what was the problem?
Definition: exceptions.cpp:46
virtual const wxString Where() const
where did the Problem() occur?
Definition: exceptions.cpp:40
Read the new s-expression based KiCad netlist format.
virtual void LoadNetlist() override
Load the contents of the netlist file into aNetlist.
APP_SETTINGS_BASE * KifaceSettings() const
Definition: kiface_base.h:95
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:104
void SetGridColor(const COLOR4D &aGridColor)
Set the grid color.
virtual RENDER_SETTINGS * GetSettings()=0
Return a pointer to current settings that are going to be used when drawing items.
virtual void Update(const VIEW_ITEM *aItem, int aUpdateFlags) const override
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
Definition: pcb_view.cpp:91
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
const std::set< int > & GetHighlightNetCodes() const
Return the netcode of currently highlighted net.
An abstract base class for deriving all objects that can be added to a VIEW.
Definition: view_item.h:86
bool IsBOARD_ITEM() const
Definition: view_item.h:102
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:67
double GetScale() const
Definition: view.h:272
BOX2D GetViewport() const
Return the current viewport visible area rectangle.
Definition: view.cpp:520
virtual void Update(const VIEW_ITEM *aItem, int aUpdateFlags) const
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
Definition: view.cpp:1673
void SetLayerVisible(int aLayer, bool aVisible=true)
Control the visibility of a particular layer.
Definition: view.h:396
bool IsMirroredX() const
Return true if view is flipped across the X axis.
Definition: view.h:246
void UpdateAllItems(int aUpdateFlags)
Update all items in the view according to the given flags.
Definition: view.cpp:1549
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
Definition: view.h:216
void MarkTargetDirty(int aTarget)
Set or clear target 'dirty' flag.
Definition: view.h:635
void UpdateAllItemsConditionally(int aUpdateFlags, std::function< bool(VIEW_ITEM *)> aCondition)
Update items in the view according to the given flags and condition.
Definition: view.cpp:1559
An implementation of class VIEW_CONTROLS for wxWidgets library.
std::unique_ptr< PROF_COUNTER > m_MotionEventCounter
Definition: kiid.h:49
A wxFrame capable of the OpenProjectFiles function, meaning it can load a portion of a KiCad project.
Definition: kiway_player.h:65
virtual bool OpenProjectFiles(const std::vector< wxString > &aFileList, int aCtl=0)
Open a project or set of files given by aFileList.
Definition: kiway_player.h:113
void OnSockRequestServer(wxSocketEvent &evt)
Definition: eda_dde.cpp:99
void OnSockRequest(wxSocketEvent &evt)
Definition: eda_dde.cpp:69
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition: kiway.h:285
void OnKiCadExit()
Definition: kiway.cpp:727
virtual void CommonSettingsChanged(bool aEnvVarsChanged, bool aTextVarsChanged)
Call CommonSettingsChanged() on all KIWAY_PLAYERs.
Definition: kiway.cpp:617
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
Definition: kiway.cpp:406
virtual void ExpressMail(FRAME_T aDestination, MAIL_T aCommand, std::string &aPayload, wxWindow *aSource=nullptr)
Send aPayload to aDestination from aSource.
Definition: kiway.cpp:527
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
static LSET AllLayersMask()
Definition: lset.cpp:587
LSEQ Seq(const LSEQ &aSequence) const
Return an LSEQ from the union of this LSET and a desired sequence.
Definition: lset.cpp:295
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:241
virtual void OnBoardChanged()
Notification from file loader when board changed and connectivity rebuilt.
virtual void SaveSettings()
Save the net inspector settings - called from EDA_EDIT_FRAME when hiding the panel.
virtual void OnParentSetupChanged()
Rebuild inspector data if project settings updated.
Tool relating to pads and pad settings.
Definition: pad_tool.h:37
Definition: pad.h:54
const wxString & GetPinType() const
Definition: pad.h:151
const wxString & GetPinFunction() const
Definition: pad.h:145
bool IsOnCopperLayer() const override
Definition: pad.cpp:1031
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:50
static TOOL_ACTION toggleHV45Mode
Definition: pcb_actions.h:524
static TOOL_ACTION drawRuleArea
Definition: pcb_actions.h:223
static TOOL_ACTION microwaveCreateGap
Definition: pcb_actions.h:513
static TOOL_ACTION drawBezier
Definition: pcb_actions.h:206
static TOOL_ACTION placeText
Definition: pcb_actions.h:208
static TOOL_ACTION pointEditorArcKeepCenter
Definition: pcb_actions.h:302
static TOOL_ACTION drawOrthogonalDimension
Definition: pcb_actions.h:219
static TOOL_ACTION drawRectangle
Definition: pcb_actions.h:203
static TOOL_ACTION padDisplayMode
Definition: pcb_actions.h:340
static TOOL_ACTION placeReferenceImage
Definition: pcb_actions.h:207
static TOOL_ACTION showRatsnest
Definition: pcb_actions.h:335
static TOOL_ACTION showLayersManager
Definition: pcb_actions.h:454
static TOOL_ACTION toggleNetHighlight
Definition: pcb_actions.h:560
static TOOL_ACTION drawCircle
Definition: pcb_actions.h:204
static TOOL_ACTION routeDiffPair
Activation of the Push and Shove router (differential pair mode)
Definition: pcb_actions.h:257
static TOOL_ACTION tuneDiffPair
Definition: pcb_actions.h:260
static TOOL_ACTION layerChanged
Definition: pcb_actions.h:392
static TOOL_ACTION ddAppendBoard
Drag and drop.
Definition: pcb_actions.h:589
static TOOL_ACTION highlightNet
Definition: pcb_actions.h:558
static TOOL_ACTION drawTable
Definition: pcb_actions.h:210
static TOOL_ACTION drawTextBox
Definition: pcb_actions.h:209
static TOOL_ACTION routerHighlightMode
Actions to enable switching modes via hotkey assignments.
Definition: pcb_actions.h:276
static TOOL_ACTION routerWalkaroundMode
Definition: pcb_actions.h:278
static TOOL_ACTION routerShoveMode
Definition: pcb_actions.h:277
static TOOL_ACTION drawZoneCutout
Definition: pcb_actions.h:224
static TOOL_ACTION drawPolygon
Definition: pcb_actions.h:202
static TOOL_ACTION hideNetInRatsnest
Definition: pcb_actions.h:565
static TOOL_ACTION group
Definition: pcb_actions.h:532
static TOOL_ACTION zoneDisplayFilled
Definition: pcb_actions.h:342
static TOOL_ACTION showNetInRatsnest
Definition: pcb_actions.h:566
static TOOL_ACTION drawRadialDimension
Definition: pcb_actions.h:218
static TOOL_ACTION tuneSingleTrack
Definition: pcb_actions.h:259
static TOOL_ACTION viaDisplayMode
Definition: pcb_actions.h:341
static TOOL_ACTION drawLeader
Definition: pcb_actions.h:220
static TOOL_ACTION drillOrigin
Definition: pcb_actions.h:542
static TOOL_ACTION tuneSkew
Definition: pcb_actions.h:261
static TOOL_ACTION trackDisplayMode
Definition: pcb_actions.h:339
static TOOL_ACTION showNetInspector
Definition: pcb_actions.h:455
static TOOL_ACTION microwaveCreateStubArc
Definition: pcb_actions.h:517
static TOOL_ACTION zoneDisplayTriangulated
Definition: pcb_actions.h:345
static TOOL_ACTION ungroup
Definition: pcb_actions.h:533
static TOOL_ACTION selectUnconnected
Select unconnected footprints from ratsnest of selection.
Definition: pcb_actions.h:102
static TOOL_ACTION zoneDisplayFractured
Definition: pcb_actions.h:344
static TOOL_ACTION drawVia
Definition: pcb_actions.h:222
static TOOL_ACTION drawArc
Definition: pcb_actions.h:205
static TOOL_ACTION zoneDuplicate
Duplicate zone onto another layer.
Definition: pcb_actions.h:415
static TOOL_ACTION graphicsOutlines
Display footprint graphics as outlines.
Definition: pcb_actions.h:496
static TOOL_ACTION drawSimilarZone
Definition: pcb_actions.h:225
static TOOL_ACTION pointEditorArcKeepEndpoint
Definition: pcb_actions.h:303
static TOOL_ACTION drawCenterDimension
Definition: pcb_actions.h:217
static TOOL_ACTION selectSameSheet
Select all components on the same sheet as the selected footprint.
Definition: pcb_actions.h:111
static TOOL_ACTION microwaveCreateStub
Definition: pcb_actions.h:515
static TOOL_ACTION selectNet
Select all connections belonging to a single net.
Definition: pcb_actions.h:96
static TOOL_ACTION microwaveCreateLine
Definition: pcb_actions.h:521
static TOOL_ACTION flipBoard
Definition: pcb_actions.h:394
static TOOL_ACTION zoneDisplayOutline
Definition: pcb_actions.h:343
static TOOL_ACTION ratsnestLineMode
Definition: pcb_actions.h:336
static TOOL_ACTION textOutlines
Display texts as lines.
Definition: pcb_actions.h:499
static TOOL_ACTION highlightNetSelection
Definition: pcb_actions.h:561
static TOOL_ACTION microwaveCreateFunctionShape
Definition: pcb_actions.h:519
static TOOL_ACTION zoneMerge
Definition: pcb_actions.h:412
static TOOL_ACTION unlock
Definition: pcb_actions.h:529
static TOOL_ACTION placeFootprint
Definition: pcb_actions.h:228
static TOOL_ACTION routeSingleTrack
Activation of the Push and Shove router.
Definition: pcb_actions.h:254
static TOOL_ACTION createArray
Tool for creating an array of objects.
Definition: pcb_actions.h:493
static TOOL_ACTION deselectNet
Remove all connections belonging to a single net from the active selection.
Definition: pcb_actions.h:99
static TOOL_ACTION showPythonConsole
Definition: pcb_actions.h:456
static TOOL_ACTION drawLine
Definition: pcb_actions.h:201
static TOOL_ACTION localRatsnestTool
Definition: pcb_actions.h:567
static TOOL_ACTION drawAlignedDimension
Definition: pcb_actions.h:216
static TOOL_ACTION drawZone
Definition: pcb_actions.h:221
static TOOL_ACTION selectOnSchematic
Select symbols/pins on schematic corresponding to selected footprints/pads.
Definition: pcb_actions.h:114
static TOOL_ACTION lock
Definition: pcb_actions.h:528
Common, abstract interface for edit frames.
COLOR_SETTINGS * GetColorSettings(bool aForceRefresh=false) const override
Helper to retrieve the current color settings.
wxString GetDesignRulesPath()
Return the absolute path to the design rules file for the currently-loaded board.
void doCloseWindow() override
void unitsChangeRefresh() override
Called when when the units setting has changed to allow for any derived classes to handle refreshing ...
virtual void SetBoard(BOARD *aBoard, PROGRESS_REPORTER *aReporter=nullptr) override
Set the #m_Pcb member in such as way as to ensure deleting any previous BOARD.
std::unique_ptr< LAYER_PAIR_SETTINGS > m_layerPairSettings
APPEARANCE_CONTROLS * GetAppearancePanel()
APPEARANCE_CONTROLS * m_appearancePanel
PANEL_SELECTION_FILTER * m_selectionFilterPanel
void ActivateGalCanvas() override
Set the #m_Pcb member in such as way as to ensure deleting any previous BOARD.
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
virtual const PCB_PLOT_PARAMS & GetPlotSettings() const
Return the PCB_PLOT_PARAMS for the BOARD owned by this frame.
const PCB_DISPLAY_OPTIONS & GetDisplayOptions() const
Display options control the way tracks, vias, outlines and other things are shown (for instance solid...
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
PCBNEW_SETTINGS * GetPcbNewSettings() const
virtual PCB_LAYER_ID GetActiveLayer() const
void OnModify() override
Must be called after a change in order to set the "modify" flag and update other data structures and ...
virtual MAGNETIC_SETTINGS * GetMagneticItemsSettings()
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
virtual void SetPageSettings(const PAGE_INFO &aPageSettings) override
void SaveSettings(APP_SETTINGS_BASE *aCfg) override
Save common frame parameters to a configuration data file.
PCB_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
BOARD * GetBoard() const
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Return the BOARD_DESIGN_SETTINGS for the open project.
virtual void SetPlotSettings(const PCB_PLOT_PARAMS &aSettings)
void PlaceFootprint(FOOTPRINT *aFootprint, bool aRecreateRatsnest=true)
Place aFootprint at the current cursor position and updates footprint coordinates with the new positi...
virtual void SetActiveLayer(PCB_LAYER_ID aLayer)
virtual void Update3DView(bool aMarkDirty, bool aRefresh, const wxString *aTitle=nullptr)
Update the 3D view, if the viewer is opened by this frame.
Handle actions that are shared between different frames in PcbNew.
Definition: pcb_control.h:47
Abstract dimension API.
double m_ZoneOpacity
Opacity override for filled zone areas.
HIGH_CONTRAST_MODE m_ContrastModeDisplay
How inactive layers are displayed.
void UpdateColors()
Update the color settings in the painter and GAL.
void SetDrawingSheet(DS_PROXY_VIEW_ITEM *aDrawingSheet)
Sets (or updates) drawing-sheet used by the draw panel.
virtual KIGFX::PCB_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
void SyncLayersVisibility(const BOARD *aBoard)
Update "visibility" property of each layer of a given BOARD.
virtual void SetHighContrastLayer(int aLayer) override
SetHighContrastLayer(), with some extra smarts for PCB.
void RedrawRatsnest()
Return the bounding box of the view that should be used if model is not valid.
Group generic conditions for PCB editor states.
SELECTION_CONDITION PadFillDisplay()
Create a functor that tests if the frame fills the pads.
SELECTION_CONDITION TrackFillDisplay()
Create a functor that tests if the frame fills tracks.
SELECTION_CONDITION HasItems()
Create a functor that tests if there are items in the board.
SELECTION_CONDITION GraphicsFillDisplay()
Create a functor that tests if the frame fills graphics items.
SELECTION_CONDITION ZoneDisplayMode(ZONE_DISPLAY_MODE aMode)
Create a functor that tests the current zone display mode in the frame.
SELECTION_CONDITION ViaFillDisplay()
Create a functor that tests if the frame fills vias.
SELECTION_CONDITION Get45degMode()
Create a functor that tests whether only 45 degree lines should be allowed.
SELECTION_CONDITION TextFillDisplay()
Create a functor that tests if the frame fills text items.
The main frame for Pcbnew.
void HardRedraw() override
Rebuild the GAL and redraws the screen.
void OnDisplayOptionsChanged() override
void ShowBoardSetupDialog(const wxString &aInitialPage=wxEmptyString)
void SetLastPath(LAST_PATH_TYPE aType, const wxString &aLastPath)
Set the path of the last file successfully read.
void FindNext(bool reverse=false)
Find the next item using our existing search parameters.
void ResolveDRCExclusions(bool aCreateMarkers)
If aCreateMarkers then create DRC exclusion markers from the serialized data.
void SetBoard(BOARD *aBoard, PROGRESS_REPORTER *aReporter=nullptr) override
Set the #m_Pcb member in such as way as to ensure deleting any previous BOARD.
void SetActiveLayer(PCB_LAYER_ID aLayer) override
Change the currently active layer to aLayer and also update the APPEARANCE_CONTROLS.
void OnModify() override
Must be called after a board change to set the modified flag.
void ThemeChanged() override
Called when light/dark theme is changed.
void setupUIConditions() override
Setup the UI conditions for the various actions and their controls in this frame.
void ReCreateHToolbar() override
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).
BOARD_ITEM_CONTAINER * GetModel() const override
DIALOG_BOOK_REPORTER * GetInspectDrcErrorDialog()
void OnExportSTEP(wxCommandEvent &event)
Export the current BOARD to a STEP assembly.
void ExchangeFootprint(FOOTPRINT *aExisting, FOOTPRINT *aNew, BOARD_COMMIT &aCommit, bool deleteExtraTexts=true, bool resetTextLayers=true, bool resetTextEffects=true, bool resetFabricationAttrs=true, bool resetTextContent=true, bool reset3DModels=true, bool *aUpdated=nullptr)
Replace aExisting footprint by aNew footprint using the Existing footprint settings (position,...
DIALOG_FIND * m_findDialog
DIALOG_BOOK_REPORTER * m_inspectConstraintsDlg
void SetPageSettings(const PAGE_INFO &aPageSettings) override
bool IsElementVisible(GAL_LAYER_ID aElement) const
Test whether a given element category is visible.
bool CanAcceptApiCommands() override
Check if this frame is ready to accept API commands.
void UpdateUserInterface()
Update the layer manager and other widgets from the board setup (layer and items visibility,...
void onBoardLoaded()
Update the state of the GUI after a new board is loaded or created.
void SetGridColor(const COLOR4D &aColor) override
void ProjectChanged() override
Notification event that the project has changed.
wxString GetLastPath(LAST_PATH_TYPE aType)
Get the last path for a particular type.
void OnExportIDF3(wxCommandEvent &event)
Export the current BOARD to a IDFv3 board and lib files.
void ShowChangedLanguage() override
Redraw the menus and what not in current language.
void doCloseWindow() override
void ReCreateLayerBox(bool aForceResizeToolbar=true)
Recreate the layer box by clearing the old list and building a new one from the new layer names and c...
void SaveProjectLocalSettings() override
Save changes to the project local settings.
void PythonSyncProjectName()
Synchronize the project name from KiCad's environment into the Python interpreter.
bool m_show_layer_manager_tools
void OnExportVRML(wxCommandEvent &event)
Export the current BOARD to a VRML file.
void ShowFindDialog()
Show the Find dialog.
void onSize(wxSizeEvent &aEvent)
int ShowExchangeFootprintsDialog(FOOTPRINT *aFootprint, bool aUpdateMode, bool aSelectedMode)
int TestStandalone()
Test if standalone mode.
void ShowFootprintPropertiesDialog(FOOTPRINT *aFootprint)
void OnExportHyperlynx(wxCommandEvent &event)
Export the current BOARD to a Hyperlynx HYP file.
bool IsContentModified() const override
Get if the current board has been modified but not saved.
void PythonSyncEnvironmentVariables()
Synchronize the environment variables from KiCad's environment into the Python interpreter.
bool Clear_Pcb(bool doAskAboutUnsavedChanges, bool aFinal=false)
Delete all and reinitialize the current board.
Definition: initpcb.cpp:42
TOOL_ACTION * m_exportNetlistAction
The export board netlist tool action object.
void ReCreateAuxiliaryToolbar() override
bool FetchNetlistFromSchematic(NETLIST &aNetlist, const wxString &aAnnotateMessage)
wxString GetCurrentFileName() const override
Get the full filename + path of the currently opened file in the frame.
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
void RecreateCmpFileFromBoard(wxCommandEvent &aEvent)
Recreates a .cmp file from the current loaded board.
DIALOG_BOOK_REPORTER * GetFootprintDiffDialog()
EDA_ANGLE GetRotationAngle() const override
Return the angle used for rotate operations.
COLOR4D GetGridColor() override
void Files_io(wxCommandEvent &event)
Call Files_io_from_id with the wxCommandEvent id.
void UpdateTitle()
Set the main window title bar text.
DIALOG_BOOK_REPORTER * m_footprintDiffDlg
PCB_LAYER_BOX_SELECTOR * m_SelLayerBox
void ExportToGenCAD(wxCommandEvent &event)
Create a file in GenCAD 1.4 format from the current board.
void ActivateGalCanvas() override
Set the #m_Pcb member in such as way as to ensure deleting any previous BOARD.
void CommonSettingsChanged(bool aEnvVarsChanged, bool aTextVarsChanged) override
Called after the preferences dialog is run.
void Process_Special_Functions(wxCommandEvent &event)
Definition: edit.cpp:53
SELECTION & GetCurrentSelection() override
Get the current selection from the canvas area.
void OnQuit(wxCommandEvent &event)
void onCloseModelessBookReporterDialogs(wxCommandEvent &aEvent)
bool canCloseWindow(wxCloseEvent &aCloseEvent) override
DIALOG_BOARD_SETUP * m_boardSetupDlg
DIALOG_BOOK_REPORTER * GetInspectClearanceDialog()
wxTimer * m_eventCounterTimer
void Tracks_and_Vias_Size_Event(wxCommandEvent &event)
void SaveSettings(APP_SETTINGS_BASE *aCfg) override
Save common frame parameters to a configuration data file.
static const wxString SearchPaneName()
DIALOG_BOOK_REPORTER * m_inspectClearanceDlg
void OnFileHistory(wxCommandEvent &event)
void ToPlotter(int aID)
Open a dialog frame to create plot and drill files relative to the current board.
DIALOG_BOOK_REPORTER * GetInspectConstraintsDialog()
A set of BOARD_ITEMs (i.e., without duplicates).
Definition: pcb_group.h:52
virtual bool RemoveItem(BOARD_ITEM *aItem)
Remove item from group.
Definition: pcb_group.cpp:96
virtual bool AddItem(BOARD_ITEM *aItem)
Add item to group.
Definition: pcb_group.cpp:81
Net inspection panel for pcbnew.
Generic tool for picking an item.
Parameters and options when plotting/printing a board.
void SetFormat(PLOT_FORMAT aFormat)
Tool that displays edit points allowing to modify items by dragging the points.
PCB_LAYER_ID m_Route_Layer_TOP
Definition: pcb_screen.h:43
PCB_LAYER_ID m_Route_Layer_BOTTOM
Definition: pcb_screen.h:44
static bool HasUnlockedItems(const SELECTION &aSelection)
Test if any selected items are unlocked.
static bool HasLockedItems(const SELECTION &aSelection)
Test if any selected items are locked.
The selection tool: currently supports:
void FindItem(BOARD_ITEM *aItem)
Take necessary actions to mark an item as found.
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: pcb_text.cpp:452
Tool useful for viewing footprints.
virtual ENV_VAR_MAP & GetLocalEnvVariables() const
Definition: pgm_base.cpp:935
virtual const wxString & GetExecutablePath() const
Definition: pgm_base.cpp:1050
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:72
std::vector< LAYER_PAIR_INFO > m_LayerPairInfos
List of stored 3D viewports (view matrixes)
Definition: project_file.h:189
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:206
void IncrementNetclassesTicker()
Definition: project.h:118
virtual PROJECT_FILE & GetProjectFile() const
Definition: project.h:200
void IncrementTextVarsTicker()
Definition: project.h:115
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.
static SELECTION_CONDITION HasTypes(std::vector< KICAD_T > aTypes)
Create a functor that tests if among the selected items there is at least one of a given types.
static bool NotEmpty(const SELECTION &aSelection)
Test if there are any items selected.
static SELECTION_CONDITION MoreThan(int aNumber)
Create a functor that tests if the number of selected items is greater than the value given as parame...
static bool Idle(const SELECTION &aSelection)
Test if there no items selected or being edited.
static SELECTION_CONDITION Count(int aNumber)
Create a functor that tests if the number of selected items is equal to the value given as parameter.
static bool ShowAlways(const SELECTION &aSelection)
The default condition function (always returns true).
static SELECTION_CONDITION OnlyTypes(std::vector< KICAD_T > aTypes)
Create a functor that tests if the selected items are only of given types.
EDA_ITEM * Front() const
Definition: selection.h:172
int Size() const
Returns the number of selected parts.
Definition: selection.h:116
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:167
TOOL_DISPATCHER * m_toolDispatcher
Definition: tools_holder.h:169
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
Definition: tools_holder.h:55
ACTIONS * m_actions
Definition: tools_holder.h:168
Represent a single user action.
Definition: tool_action.h:269
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:302
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:337
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:320
@ OUTDATED_SAVE
OUTDATED_SAVE Messages that should be cleared on save.
void AddCloseButton(const wxString &aTooltip=_("Hide this message."))
Add the default close button to the infobar on the right side.
Definition: wx_infobar.cpp:310
void ShowMessage(const wxString &aMessage, int aFlags=wxICON_INFORMATION) override
Show the info bar with the provided message and icon.
Definition: wx_infobar.cpp:153
Handle actions specific to filling copper zones.
PROGRESS_REPORTER * GetProgressReporter()
bool HandleUnsavedChanges(wxWindow *aParent, const wxString &aMessage, const std::function< bool()> &aSaveFunction)
Display a dialog with Save, Cancel and Discard Changes buttons.
Definition: confirm.cpp:130
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition: confirm.cpp:195
This file is part of the common library.
#define CHECK(x)
#define ENABLE(x)
#define DIALOG_DRC_WINDOW_NAME
Definition: dialog_drc.h:42
#define _HKI(x)
#define _(s)
Declaration of the eda_3d_viewer class.
static constexpr EDA_ANGLE ANGLE_90
Definition: eda_angle.h:403
#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
GERBVIEW_FRAME::OnZipFileHistory GERBVIEW_FRAME::OnSelectHighlightChoice EVT_UPDATE_UI(ID_TOOLBARH_GERBVIEW_SELECT_ACTIVE_LAYER, GERBVIEW_FRAME::OnUpdateLayerSelectBox) void GERBVIEW_FRAME
KiCad executable names.
const wxString EESCHEMA_EXE
bool ExportBoardToHyperlynx(BOARD *aBoard, const wxFileName &aPath)
@ FP_ALLOW_SOLDERMASK_BRIDGES
Definition: footprint.h: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
@ ID_MAIN_MENUBAR
Definition: gerbview_id.h:38
int ExecuteFile(const wxString &aEditorName, const wxString &aFileName, wxProcess *aCallback, bool aFileForKicad)
Call the executable file aEditorName with the parameter aFileName.
Definition: gestfich.cpp:143
bool m_ShowEventCounters
Shows debugging event counters in various places.
static const std::string LegacySchematicFileExtension
static const std::string LegacyPcbFileExtension
static const std::string KiCadSchematicFileExtension
static const std::string AutoSaveFilePrefix
static const std::string KiCadPcbFileExtension
const wxChar *const traceAutoSave
Flag to enable auto save feature debug tracing.
const wxChar *const traceApi
Flag to enable debug output related to the IPC API and its plugin system.
Definition: api_utils.cpp:26
@ ID_ON_GRID_SELECT
Definition: id.h:143
@ ID_GEN_PLOT_DXF
Definition: id.h:93
@ ID_FILE_LIST_CLEAR
Definition: id.h:84
@ ID_EDA_SOCKET_EVENT
Definition: id.h:161
@ ID_GEN_PLOT_PS
Definition: id.h:89
@ ID_EDA_SOCKET_EVENT_SERV
Definition: id.h:160
@ ID_GEN_PLOT_GERBER
Definition: id.h:91
@ ID_ON_ZOOM_SELECT
Definition: id.h:141
@ ID_GEN_PLOT
Definition: id.h:88
@ ID_GEN_PLOT_SVG
Definition: id.h:92
@ ID_GEN_PLOT_HPGL
Definition: id.h:90
@ ID_FILEMAX
Definition: id.h:82
@ ID_FILE1
Definition: id.h:81
@ ID_GEN_PLOT_PDF
Definition: id.h:94
std::map< wxString, ENV_VAR_ITEM > ENV_VAR_MAP
PROJECT & Prj()
Definition: kicad.cpp:597
int GetNetnameLayer(int aLayer)
Return a netname layer corresponding to the given layer.
Definition: layer_ids.h:756
bool IsCopperLayer(int aLayerId)
Test whether a layer is a copper layer.
Definition: layer_ids.h:581
GAL_LAYER_ID
GAL layers are "virtual" layers, i.e.
Definition: layer_ids.h:191
@ LAYER_GRID
Definition: layer_ids.h:216
@ LAYER_ZONES
Control for copper zone opacity/visibility (color ignored).
Definition: layer_ids.h:257
@ LAYER_RATSNEST
Definition: layer_ids.h:215
#define CLEARANCE_LAYER_FOR(boardLayer)
Definition: layer_ids.h:324
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:60
@ F_Paste
Definition: layer_ids.h:104
@ B_Mask
Definition: layer_ids.h:98
@ B_Cu
Definition: layer_ids.h:65
@ F_Mask
Definition: layer_ids.h:97
@ B_Paste
Definition: layer_ids.h:105
@ UNDEFINED_LAYER
Definition: layer_ids.h:61
@ F_Cu
Definition: layer_ids.h:64
@ MAIL_SCH_GET_NETLIST
Definition: mail_type.h:49
@ REPAINT
Item needs to be redrawn.
Definition: view_item.h:58
@ ALL
All except INITIAL_ADD.
Definition: view_item.h:59
@ TARGET_NONCACHED
Auxiliary rendering target (noncached)
Definition: definitions.h:38
void SetShutdownBlockReason(wxWindow *aWindow, const wxString &aReason)
Sets the block reason why the window/application is preventing OS shutdown.
Definition: unix/app.cpp:90
bool SupportsShutdownBlockReason()
Whether or not the window supports setting a shutdown block reason.
Definition: unix/app.cpp:79
@ RM_MarkObstacles
Ignore collisions, mark obstacles.
@ RM_Walkaround
Only walk around.
@ RM_Shove
Only shove.
static void processTextItem(const PCB_TEXT &aSrc, PCB_TEXT &aDest, bool aResetText, bool aResetTextLayers, bool aResetTextEffects, bool *aUpdated)
copy text settings from aSrc to aDest
#define FOOTPRINT_DIFF_DIALOG_NAME
static PCB_TEXT * getMatchingTextItem(PCB_TEXT *aRefItem, FOOTPRINT *aFootprint)
EVT_MENU_RANGE(ID_POPUP_PCB_SELECT_WIDTH_START_RANGE, ID_POPUP_PCB_SELECT_WIDTH_END_RANGE, PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event) EVT_UPDATE_UI_RANGE(ID_POPUP_PCB_SELECT_WIDTH1
ID_POPUP_PCB_SELECT_WIDTH8
bool ExportBoardToHyperlynx(BOARD *aBoard, const wxFileName &aPath)
#define INSPECT_CLEARANCE_DIALOG_NAME
PCB_EDIT_FRAME::OnUpdateSelectTrackWidth EVT_UPDATE_UI_RANGE(ID_POPUP_PCB_SELECT_VIASIZE1, ID_POPUP_PCB_SELECT_VIASIZE8, PCB_EDIT_FRAME::OnUpdateSelectViaSize) PCB_EDIT_FRAME
#define INSPECT_DRC_ERROR_DIALOG_NAME
#define INSPECT_CONSTRAINTS_DIALOG_NAME
@ ID_POPUP_PCB_SELECT_WIDTH_START_RANGE
Definition: pcbnew_id.h:25
@ ID_POPUP_PCB_SELECT_WIDTH1
Definition: pcbnew_id.h:29
@ ID_POPUP_PCB_SELECT_VIASIZE8
Definition: pcbnew_id.h:52
@ ID_GEN_EXPORT_FILE_HYPERLYNX
Definition: pcbnew_id.h:88
@ ID_IMPORT_NON_KICAD_BOARD
Definition: pcbnew_id.h:19
@ ID_MENU_RECOVER_BOARD_AUTOSAVE
Definition: pcbnew_id.h:81
@ ID_AUX_TOOLBAR_PCB_VIA_SIZE
Definition: pcbnew_id.h:22
@ ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH
Definition: pcbnew_id.h:24
@ ID_PCB_GEN_CMP_FILE
Definition: pcbnew_id.h:93
@ ID_MENU_EXPORT_FOOTPRINTS_TO_NEW_LIBRARY
Definition: pcbnew_id.h:83
@ ID_POPUP_PCB_SELECT_WIDTH_END_RANGE
Definition: pcbnew_id.h:79
@ ID_MENU_EXPORT_FOOTPRINTS_TO_LIBRARY
Definition: pcbnew_id.h:82
@ ID_GEN_EXPORT_FILE_VRML
Definition: pcbnew_id.h:86
@ ID_POPUP_PCB_SELECT_VIASIZE1
Definition: pcbnew_id.h:45
@ ID_GEN_EXPORT_FILE_STEP
Definition: pcbnew_id.h:87
@ ID_TOOLBARH_PCB_SELECT_LAYER
Definition: pcbnew_id.h:96
@ ID_GEN_EXPORT_FILE_IDF3
Definition: pcbnew_id.h:85
@ ID_AUX_TOOLBAR_PCB_TRACK_WIDTH
Definition: pcbnew_id.h:23
@ ID_GEN_EXPORT_FILE_GENCADFORMAT
Definition: pcbnew_id.h:89
void 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:1073
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:48
@ 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:398
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:88
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:48
@ AS_ACTIVE
All active tools.
Definition: tool_action.h:47
@ TA_MODEL_CHANGE
Model has changed (partial update).
Definition: tool_event.h:121
@ TC_COMMAND
Definition: tool_event.h:57
wxLogTrace helper definitions.
@ PCB_GENERATOR_T
class PCB_GENERATOR, generator on a layer
Definition: typeinfo.h:91
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:97
@ PCB_GROUP_T
class PCB_GROUP, a set of BOARD_ITEMs
Definition: typeinfo.h:110
@ PCB_ZONE_T
class ZONE, a copper pour area
Definition: typeinfo.h:107
@ PCB_TEXT_T
class PCB_TEXT, text on a layer
Definition: typeinfo.h:92
@ PCB_FIELD_T
class PCB_FIELD, text associated with a footprint property
Definition: typeinfo.h:90
@ PCB_FOOTPRINT_T
class FOOTPRINT, a footprint
Definition: typeinfo.h:86
@ PCB_PAD_T
class PAD, a pad in a footprint
Definition: typeinfo.h:87
@ PCB_ARC_T
class PCB_ARC, an arc track segment on a copper layer
Definition: typeinfo.h:98
@ PCB_TRACE_T
class PCB_TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:96
Definition of file extensions used in Kicad.
void SetAuiPaneSize(wxAuiManager &aManager, wxAuiPaneInfo &aPane, int aWidth, int aHeight)
Sets the size of an AUI pane, working around http://trac.wxwidgets.org/ticket/13180.
WX_VIEW_CONTROLS class definition.