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 (C) 2013-2023 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>
29#include <fp_lib_table.h>
30#include <bitmaps.h>
31#include <confirm.h>
32#include <trace_helpers.h>
33#include <pcbnew_id.h>
34#include <pcbnew_settings.h>
37#include <dialog_plot.h>
38#include <dialog_find.h>
42#include <dialog_board_setup.h>
43#include <invoke_pcb_dialog.h>
44#include <board.h>
45#include <pcb_group.h>
47#include <footprint.h>
51#include <pcb_draw_panel_gal.h>
52#include <functional>
53#include <pcb_painter.h>
56#include <python_scripting.h>
59#include <tool/tool_manager.h>
61#include <tool/action_toolbar.h>
62#include <tool/common_control.h>
63#include <tool/common_tools.h>
64#include <tool/selection.h>
65#include <tool/zoom_tool.h>
69#include <tools/edit_tool.h>
70#include <tools/group_tool.h>
71#include <tools/drc_tool.h>
73#include <tools/convert_tool.h>
74#include <tools/drawing_tool.h>
75#include <tools/pcb_control.h>
82#include <tools/pad_tool.h>
87#include <tools/pcb_actions.h>
88#include <router/router_tool.h>
92#include <gestfich.h>
93#include <executable_names.h>
95#include <wx/socket.h>
96#include <wx/wupdlock.h>
97#include <dialog_drc.h> // for DIALOG_DRC_WINDOW_NAME definition
101#include <widgets/wx_infobar.h>
104#include <widgets/wx_aui_utils.h>
105#include <kiplatform/app.h>
106#include <profile.h>
109
110#include <action_plugin.h>
111#include "../scripting/python_scripting.h"
112
113#include <wx/filedlg.h>
114
115using namespace std::placeholders;
116
117
118#define INSPECT_DRC_ERROR_DIALOG_NAME wxT( "InspectDrcErrorDialog" )
119#define INSPECT_CLEARANCE_DIALOG_NAME wxT( "InspectClearanceDialog" )
120#define INSPECT_CONSTRAINTS_DIALOG_NAME wxT( "InspectConstraintsDialog" )
121#define FOOTPRINT_DIFF_DIALOG_NAME wxT( "FootprintDiffDialog" )
122
123
124BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME )
127
128
131
132 EVT_SIZE( PCB_EDIT_FRAME::OnSize )
133
135
136 // Menu Files:
138
142
148
151
152 EVT_MENU( wxID_EXIT, PCB_EDIT_FRAME::OnQuit )
153 EVT_MENU( wxID_CLOSE, PCB_EDIT_FRAME::OnQuit )
154
155 // menu Config
157
158 // menu Postprocess
160
161 // Horizontal toolbar
167
168 // Tracks and vias sizes general options
170 PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event )
171
172 // User interface update event handlers.
178 PCB_EDIT_FRAME::OnUpdateSelectTrackWidth )
180 PCB_EDIT_FRAME::OnUpdateSelectViaSize )
181 // Drop files event
182 EVT_DROP_FILES( PCB_EDIT_FRAME::OnDropFiles )
183END_EVENT_TABLE()
184
185
186PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
187 PCB_BASE_EDIT_FRAME( aKiway, aParent, FRAME_PCB_EDITOR, _( "PCB Editor" ),
188 wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE,
190 m_exportNetlistAction( nullptr ),
191 m_findDialog( nullptr ),
192 m_inspectDrcErrorDlg( nullptr ),
193 m_inspectClearanceDlg( nullptr ),
194 m_inspectConstraintsDlg( nullptr ),
195 m_footprintDiffDlg( nullptr ),
196 m_netInspectorDlg( nullptr )
197{
198 m_maximizeByDefault = true;
199 m_showBorderAndTitleBlock = true; // true to display sheet references
200 m_SelTrackWidthBox = nullptr;
201 m_SelViaSizeBox = nullptr;
202 m_SelLayerBox = nullptr;
203 m_show_layer_manager_tools = true;
204 m_supportsAutoSave = true;
205 m_probingSchToPcb = false;
206 m_show_properties = true;
207 m_show_search = false;
208
209 // We don't know what state board was in when it was last saved, so we have to
210 // assume dirty
211 m_ZoneFillsDirty = true;
212
213 m_aboutTitle = _HKI( "KiCad PCB Editor" );
214
215 // Must be created before the menus are created.
216 if( ADVANCED_CFG::GetCfg().m_ShowPcbnewExportNetlist )
217 m_exportNetlistAction = new TOOL_ACTION( "pcbnew.EditorControl.exportNetlist",
218 AS_GLOBAL, 0, "", _( "Netlist..." ),
219 _( "Export netlist used to update schematics" ) );
220
221 // Create GAL canvas
222 auto canvas = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_frameSize,
223 GetGalDisplayOptions(),
225
226 SetCanvas( canvas );
227 SetBoard( new BOARD() );
228
229 wxIcon icon;
230 wxIconBundle icon_bundle;
231
232 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_pcbnew ) );
233 icon_bundle.AddIcon( icon );
234 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_pcbnew_32 ) );
235 icon_bundle.AddIcon( icon );
236 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_pcbnew_16 ) );
237 icon_bundle.AddIcon( icon );
238
239 SetIcons( icon_bundle );
240
241 // LoadSettings() *after* creating m_LayersManager, because LoadSettings()
242 // initialize parameters in m_LayersManager
243 LoadSettings( config() );
244
245 SetScreen( new PCB_SCREEN( GetPageSettings().GetSizeIU( pcbIUScale.IU_PER_MILS ) ) );
246
247 // PCB drawings start in the upper left corner.
248 GetScreen()->m_Center = false;
249
250 setupTools();
251 setupUIConditions();
252
253 ReCreateMenuBar();
254 ReCreateHToolbar();
255 ReCreateAuxiliaryToolbar();
256 ReCreateVToolbar();
257 ReCreateOptToolbar();
258
259
260 m_propertiesPanel = new PCB_PROPERTIES_PANEL( this, this );
261
262 float proportion = GetPcbNewSettings()->m_AuiPanels.properties_splitter_proportion;
263 m_propertiesPanel->SetSplitterProportion( proportion );
264
265 m_selectionFilterPanel = new PANEL_SELECTION_FILTER( this );
266
267 m_appearancePanel = new APPEARANCE_CONTROLS( this, GetCanvas() );
268 m_searchPane = new PCB_SEARCH_PANE( this );
269
270 m_auimgr.SetManagedWindow( this );
271
272 CreateInfoBar();
273
274 unsigned int auiFlags = wxAUI_MGR_DEFAULT;
275#if !defined( _WIN32 )
276 // Windows cannot redraw the UI fast enough during a live resize and may lead to all kinds
277 // of graphical glitches.
278 auiFlags |= wxAUI_MGR_LIVE_RESIZE;
279#endif
280 m_auimgr.SetFlags( auiFlags );
281
282 // Rows; layers 4 - 6
283 m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( wxS( "MainToolbar" ) )
284 .Top().Layer( 6 ) );
285 m_auimgr.AddPane( m_auxiliaryToolBar, EDA_PANE().HToolbar().Name( wxS( "AuxToolbar" ) )
286 .Top().Layer( 5 ) );
287 m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( wxS( "MsgPanel" ) )
288 .Bottom().Layer( 6 ) );
289
290 // Columns; layers 1 - 3
291 m_auimgr.AddPane( m_optionsToolBar, EDA_PANE().VToolbar().Name( wxS( "OptToolbar" ) )
292 .Left().Layer( 3 ) );
293
294 m_auimgr.AddPane( m_drawToolBar, EDA_PANE().VToolbar().Name( wxS( "ToolsToolbar" ) )
295 .Right().Layer( 3 ) );
296
297 m_auimgr.AddPane( m_appearancePanel, EDA_PANE().Name( wxS( "LayersManager" ) )
298 .Right().Layer( 4 )
299 .Caption( _( "Appearance" ) ).PaneBorder( false )
300 .MinSize( 180, -1 ).BestSize( 180, -1 ) );
301
302 m_auimgr.AddPane( m_selectionFilterPanel, EDA_PANE().Name( wxS( "SelectionFilter" ) )
303 .Right().Layer( 4 ).Position( 2 )
304 .Caption( _( "Selection Filter" ) ).PaneBorder( false )
305 .MinSize( 180, -1 ).BestSize( 180, -1 ) );
306
307 m_auimgr.AddPane( m_propertiesPanel, EDA_PANE().Name( wxS( "PropertiesManager" ) )
308 .Left().Layer( 5 ).Caption( _( "Properties" ) )
309 .PaneBorder( false ).MinSize( 240, -1 ).BestSize( 300, -1 ) );
310
311 // Center
312 m_auimgr.AddPane( GetCanvas(), EDA_PANE().Canvas().Name( wxS( "DrawFrame" ) )
313 .Center() );
314
315
316 m_auimgr.AddPane( m_searchPane, EDA_PANE()
317 .Name( SearchPaneName() )
318 .Bottom()
319 .Caption( _( "Search" ) )
320 .PaneBorder( false )
321 .MinSize( 180, -1 )
322 .BestSize( 180, -1 )
323 .FloatingSize( 480, 200 )
324 .CloseButton( true )
325 .DestroyOnClose( false ) );
326
327
328 m_auimgr.GetPane( "LayersManager" ).Show( m_show_layer_manager_tools );
329 m_auimgr.GetPane( "SelectionFilter" ).Show( m_show_layer_manager_tools );
330 m_auimgr.GetPane( "PropertiesManager" ).Show( m_show_properties );
331
332 m_auimgr.GetPane( SearchPaneName() ).Show( m_show_search );
333
334 // The selection filter doesn't need to grow in the vertical direction when docked
335 m_auimgr.GetPane( "SelectionFilter" ).dock_proportion = 0;
336
337 FinishAUIInitialization();
338
339 if( PCBNEW_SETTINGS* settings = dynamic_cast<PCBNEW_SETTINGS*>( config() ) )
340 {
341 if( settings->m_AuiPanels.right_panel_width > 0 )
342 {
343 wxAuiPaneInfo& layersManager = m_auimgr.GetPane( wxS( "LayersManager" ) );
344 SetAuiPaneSize( m_auimgr, layersManager, settings->m_AuiPanels.right_panel_width, -1 );
345 }
346
347 if( settings->m_AuiPanels.properties_panel_width > 0 && m_propertiesPanel )
348 {
349 wxAuiPaneInfo& propertiesPanel = m_auimgr.GetPane( wxS( "PropertiesManager" ) );
350 SetAuiPaneSize( m_auimgr, propertiesPanel,
351 settings->m_AuiPanels.properties_panel_width, -1 );
352 }
353
354 if( settings->m_AuiPanels.search_panel_height > 0 )
355 {
356 wxAuiPaneInfo& searchPane = m_auimgr.GetPane( SearchPaneName() );
357 SetAuiPaneSize( m_auimgr, searchPane, -1, settings->m_AuiPanels.search_panel_height );
358 }
359
360 m_appearancePanel->SetTabIndex( settings->m_AuiPanels.appearance_panel_tab );
361 }
362
363 GetToolManager()->RunAction( ACTIONS::zoomFitScreen, false );
364
365 // This is used temporarily to fix a client size issue on GTK that causes zoom to fit
366 // to calculate the wrong zoom size. See PCB_EDIT_FRAME::onSize().
367 Bind( wxEVT_SIZE, &PCB_EDIT_FRAME::onSize, this );
368
369 // Redraw netnames (so that they fall within the current viewport) after the viewport
370 // has stopped changing. Redrawing them without the timer moves them smoothly with scrolling,
371 // making it look like the tracks are being dragged -- which we don't want.
372 m_redrawNetnamesTimer.SetOwner( this );
373 Connect( wxEVT_TIMER, wxTimerEventHandler( PCB_EDIT_FRAME::redrawNetnames ), nullptr, this );
374
375 Bind( wxEVT_IDLE,
376 [this]( wxIdleEvent& aEvent )
377 {
378 if( GetCanvas()->GetView()->GetViewport() != m_lastViewport )
379 {
380 m_lastViewport = GetCanvas()->GetView()->GetViewport();
381 m_redrawNetnamesTimer.StartOnce( 500 );
382 }
383
384 // Do not forget to pass the Idle event to other clients:
385 aEvent.Skip();
386 } );
387
388 resolveCanvasType();
389
390 setupUnits( config() );
391
392 // Ensure the Python interpreter is up to date with its environment variables
393 PythonSyncEnvironmentVariables();
394 PythonSyncProjectName();
395
396 // Sync action plugins in case they changed since the last time the frame opened
397 GetToolManager()->RunAction( PCB_ACTIONS::pluginsReload, true );
398
399 GetCanvas()->SwitchBackend( m_canvasType );
400 ActivateGalCanvas();
401
402 // Default shutdown reason until a file is loaded
403 KIPLATFORM::APP::SetShutdownBlockReason( this, _( "New PCB file is unsaved" ) );
404
405 // disable Export STEP item if kicad2step does not exist
406 wxString strK2S = Pgm().GetExecutablePath();
407
408#ifdef __WXMAC__
409 if( strK2S.Find( wxT( "pcbnew.app" ) ) != wxNOT_FOUND )
410 {
411 // On macOS, we have standalone applications inside the main bundle, so we handle that here:
412 strK2S += wxT( "../../" );
413 }
414
415 strK2S += wxT( "Contents/MacOS/" );
416#endif
417
418 wxFileName appK2S( strK2S, wxT( "kicad2step" ) );
419
420#ifdef _WIN32
421 appK2S.SetExt( wxT( "exe" ) );
422#endif
423
424 // Ensure the window is on top
425 Raise();
426
427// if( !appK2S.FileExists() )
428 // GetMenuBar()->FindItem( ID_GEN_EXPORT_FILE_STEP )->Enable( false );
429
430 // AUI doesn't refresh properly on wxMac after changes in eb7dc6dd, so force it to
431#ifdef __WXMAC__
432 if( Kiface().IsSingle() )
433 {
434 CallAfter( [&]()
435 {
436 m_appearancePanel->OnBoardChanged();
437 } );
438 }
439#endif
440
441 // Register a call to update the toolbar sizes. It can't be done immediately because
442 // it seems to require some sizes calculated that aren't yet (at least on GTK).
443 CallAfter( [&]()
444 {
445 // Ensure the controls on the toolbars all are correctly sized
446 UpdateToolbarControlSizes();
447 } );
448
450 {
451 m_eventCounterTimer = new wxTimer( this );
452
453 Bind( wxEVT_TIMER,
454 [&]( wxTimerEvent& aEvent )
455 {
456 GetCanvas()->m_PaintEventCounter->Show();
457 GetCanvas()->m_PaintEventCounter->Reset();
458
460 static_cast<KIGFX::WX_VIEW_CONTROLS*>( GetCanvas()->GetViewControls() );
461 vc->m_MotionEventCounter->Show();
462 vc->m_MotionEventCounter->Reset();
463
464 },
465 m_eventCounterTimer->GetId() );
466
467 m_eventCounterTimer->Start( 1000 );
468 }
469
470 Bind( EDA_EVT_CLOSE_DIALOG_BOOK_REPORTER, &PCB_EDIT_FRAME::onCloseModelessBookReporterDialogs,
471 this );
472 Bind( EDA_EVT_CLOSE_NET_INSPECTOR_DIALOG, &PCB_EDIT_FRAME::onCloseNetInspectorDialog, this );
473 Bind( EDA_EVT_UNITS_CHANGED, &PCB_EDIT_FRAME::onUnitsChanged, this );
474
475 m_acceptedExts.emplace( KiCadPcbFileExtension, &PCB_ACTIONS::ddAppendBoard );
476 m_acceptedExts.emplace( LegacyPcbFileExtension, &PCB_ACTIONS::ddAppendBoard );
477 DragAcceptFiles( true );
478}
479
480
482{
483 if( ADVANCED_CFG::GetCfg().m_ShowEventCounters )
484 {
485 // Stop the timer during destruction early to avoid potential event race conditions (that
486 // do happen on windows)
487 m_eventCounterTimer->Stop();
488 delete m_eventCounterTimer;
489 }
490
491 // Shutdown all running tools
492 if( m_toolManager )
494
495 if( GetBoard() )
497
499 delete m_appearancePanel;
501 delete m_propertiesPanel;
502}
503
504
505void PCB_EDIT_FRAME::SetBoard( BOARD* aBoard, bool aBuildConnectivity,
506 PROGRESS_REPORTER* aReporter )
507{
508 if( m_pcb )
510
511 PCB_BASE_EDIT_FRAME::SetBoard( aBoard, aReporter );
512
513 aBoard->SetProject( &Prj() );
514
515 if( aBuildConnectivity )
516 aBoard->BuildConnectivity();
517
518 // reload the drawing-sheet
519 SetPageSettings( aBoard->GetPageSettings() );
520}
521
522
524{
525 return m_pcb;
526}
527
528
529void PCB_EDIT_FRAME::redrawNetnames( wxTimerEvent& aEvent )
530{
531 bool needs_refresh = false;
532
533 // Don't stomp on the auto-save timer event.
534 if( aEvent.GetId() == ID_AUTO_SAVE_TIMER )
535 {
536 aEvent.Skip();
537 return;
538 }
539
540 PCBNEW_SETTINGS* cfg = dynamic_cast<PCBNEW_SETTINGS*>( Kiface().KifaceSettings() );
541
542 if( !cfg || cfg->m_Display.m_NetNames < 2 )
543 return;
544
545 KIGFX::VIEW* view = GetCanvas()->GetView();
546 double scale = view->GetScale();
547
548 for( PCB_TRACK* track : GetBoard()->Tracks() )
549 {
550 double lod = track->ViewGetLOD( GetNetnameLayer( track->GetLayer() ), view );
551
552 if( lod < scale )
553 continue;
554
555 if( lod != track->GetCachedLOD() || scale != track->GetCachedScale() )
556 {
557 view->Update( track, KIGFX::REPAINT );
558 needs_refresh = true;
559 track->SetCachedLOD( lod );
560 track->SetCachedScale( scale );
561 }
562 }
563
564 if( needs_refresh )
565 GetCanvas()->Refresh();
566}
567
568
569void PCB_EDIT_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings )
570{
571 PCB_BASE_FRAME::SetPageSettings( aPageSettings );
572
573 // Prepare drawing-sheet template
576 m_pcb->GetProject(),
578 &m_pcb->GetProperties() );
579
580 drawingSheet->SetSheetName( std::string( GetScreenDesc().mb_str() ) );
581 drawingSheet->SetSheetPath( std::string( GetFullScreenDesc().mb_str() ) );
582
583 // A board is not like a schematic having a main page and sub sheets.
584 // So for the drawing sheet, use only the first page option to display items
585 drawingSheet->SetIsFirstPage( true );
586
587 BASE_SCREEN* screen = GetScreen();
588
589 if( screen != nullptr )
590 {
591 drawingSheet->SetPageNumber(TO_UTF8( screen->GetPageNumber() ) );
592 drawingSheet->SetSheetCount( screen->GetPageCount() );
593 }
594
595 if( BOARD* board = GetBoard() )
596 drawingSheet->SetFileName( TO_UTF8( board->GetFileName() ) );
597
598 // PCB_DRAW_PANEL_GAL takes ownership of the drawing-sheet
599 GetCanvas()->SetDrawingSheet( drawingSheet );
600}
601
602
604{
605 return GetScreen() && GetScreen()->IsContentModified();
606}
607
608
610{
611 return m_toolManager->GetTool<PCB_SELECTION_TOOL>()->GetSelection();
612}
613
614
616{
617 // Create the manager and dispatcher & route draw panel events to the dispatcher
620 GetCanvas()->GetViewControls(), config(), this );
621 m_actions = new PCB_ACTIONS();
623
624 // Register tools
653
654 for( TOOL_BASE* tool : m_toolManager->Tools() )
655 {
656 if( PCB_TOOL_BASE* pcbTool = dynamic_cast<PCB_TOOL_BASE*>( tool ) )
657 pcbTool->SetIsBoardEditor( true );
658 }
659
660 // Run the selection tool, it is supposed to be always active
661 m_toolManager->InvokeTool( "pcbnew.InteractiveSelection" );
662}
663
664
666{
668
670 PCB_EDITOR_CONDITIONS cond( this );
671
672 wxASSERT( mgr );
673
674#define ENABLE( x ) ACTION_CONDITIONS().Enable( x )
675#define CHECK( x ) ACTION_CONDITIONS().Check( x )
676
680
684 mgr->SetConditions( ACTIONS::millimetersUnits, CHECK( cond.Units( EDA_UNITS::MILLIMETRES ) ) );
685 mgr->SetConditions( ACTIONS::inchesUnits, CHECK( cond.Units( EDA_UNITS::INCHES ) ) );
686 mgr->SetConditions( ACTIONS::milsUnits, CHECK( cond.Units( EDA_UNITS::MILS ) ) );
687
688 mgr->SetConditions( ACTIONS::cut, ENABLE( cond.HasItems() ) );
689 mgr->SetConditions( ACTIONS::copy, ENABLE( cond.HasItems() ) );
697
702
708
709 if( SCRIPTING::IsWxAvailable() )
711
712 auto enableZoneControlConition =
713 [this] ( const SELECTION& )
714 {
717 };
718
720 ENABLE( enableZoneControlConition )
721 .Check( cond.ZoneDisplayMode( ZONE_DISPLAY_MODE::SHOW_FILLED ) ) );
723 ENABLE( enableZoneControlConition )
724 .Check( cond.ZoneDisplayMode( ZONE_DISPLAY_MODE::SHOW_ZONE_OUTLINE ) ) );
726 ENABLE( enableZoneControlConition )
727 .Check( cond.ZoneDisplayMode( ZONE_DISPLAY_MODE::SHOW_FRACTURE_BORDERS ) ) );
729 ENABLE( enableZoneControlConition )
730 .Check( cond.ZoneDisplayMode( ZONE_DISPLAY_MODE::SHOW_TRIANGULATION ) ) );
731
733
734 auto constrainedDrawingModeCond =
735 [this]( const SELECTION& )
736 {
738 };
739
740 auto enableBoardSetupCondition =
741 [this] ( const SELECTION& )
742 {
743 if( DRC_TOOL* tool = m_toolManager->GetTool<DRC_TOOL>() )
744 return !tool->IsDRCDialogShown();
745
746 return true;
747 };
748
749 auto boardFlippedCond =
750 [this]( const SELECTION& )
751 {
752 return GetCanvas()->GetView()->IsMirroredX();
753 };
754
755 auto layerManagerCond =
756 [this] ( const SELECTION& )
757 {
758 return LayerManagerShown();
759 };
760
761 auto propertiesCond =
762 [this] ( const SELECTION& )
763 {
764 return PropertiesShown();
765 };
766
767 auto searchPaneCond =
768 [this] ( const SELECTION& )
769 {
770 return m_auimgr.GetPane( SearchPaneName() ).IsShown();
771 };
772
773 auto highContrastCond =
774 [this] ( const SELECTION& )
775 {
776 return GetDisplayOptions().m_ContrastModeDisplay != HIGH_CONTRAST_MODE::NORMAL;
777 };
778
779 auto globalRatsnestCond =
780 [this] (const SELECTION& )
781 {
783 };
784
785 auto curvedRatsnestCond =
786 [this] (const SELECTION& )
787 {
789 };
790
791 auto netHighlightCond =
792 [this]( const SELECTION& )
793 {
795 return !settings->GetHighlightNetCodes().empty();
796 };
797
798 auto enableNetHighlightCond =
799 [this]( const SELECTION& )
800 {
802 return tool->IsNetHighlightSet();
803 };
804
805 mgr->SetConditions( PCB_ACTIONS::toggleHV45Mode, CHECK( constrainedDrawingModeCond ) );
806 mgr->SetConditions( ACTIONS::highContrastMode, CHECK( highContrastCond ) );
807 mgr->SetConditions( PCB_ACTIONS::flipBoard, CHECK( boardFlippedCond ) );
808 mgr->SetConditions( PCB_ACTIONS::showLayersManager, CHECK( layerManagerCond ) );
809 mgr->SetConditions( PCB_ACTIONS::showRatsnest, CHECK( globalRatsnestCond ) );
810 mgr->SetConditions( PCB_ACTIONS::ratsnestLineMode, CHECK( curvedRatsnestCond ) );
811 mgr->SetConditions( PCB_ACTIONS::toggleNetHighlight, CHECK( netHighlightCond )
812 .Enable( enableNetHighlightCond ) );
813 mgr->SetConditions( PCB_ACTIONS::boardSetup, ENABLE( enableBoardSetupCondition ) );
814 mgr->SetConditions( PCB_ACTIONS::showProperties, CHECK( propertiesCond ) );
815 mgr->SetConditions( PCB_ACTIONS::showSearch, CHECK( searchPaneCond ) );
816
817 auto isArcKeepCenterMode = [this]( const SELECTION& )
818 {
819 return GetPcbNewSettings()->m_ArcEditMode == ARC_EDIT_MODE::KEEP_CENTER_ADJUST_ANGLE_RADIUS;
820 };
821
822 auto isArcKeepEndpointMode = [this]( const SELECTION& )
823 {
825 == ARC_EDIT_MODE::KEEP_ENDPOINTS_OR_START_DIRECTION;
826 };
827
828 mgr->SetConditions( PCB_ACTIONS::pointEditorArcKeepCenter, CHECK( isArcKeepCenterMode ) );
829 mgr->SetConditions( PCB_ACTIONS::pointEditorArcKeepEndpoint, CHECK( isArcKeepEndpointMode ) );
830
831 auto isHighlightMode =
832 [this]( const SELECTION& )
833 {
835 return tool->GetRouterMode() == PNS::RM_MarkObstacles;
836 };
837
838 auto isShoveMode =
839 [this]( const SELECTION& )
840 {
842 return tool->GetRouterMode() == PNS::RM_Shove;
843 };
844
845 auto isWalkaroundMode =
846 [this]( const SELECTION& )
847 {
849 return tool->GetRouterMode() == PNS::RM_Walkaround;
850 };
851
852 mgr->SetConditions( PCB_ACTIONS::routerHighlightMode, CHECK( isHighlightMode ) );
853 mgr->SetConditions( PCB_ACTIONS::routerShoveMode, CHECK( isShoveMode ) );
854 mgr->SetConditions( PCB_ACTIONS::routerWalkaroundMode, CHECK( isWalkaroundMode ) );
855
856 auto haveNetCond =
857 [] ( const SELECTION& aSel )
858 {
859 for( EDA_ITEM* item : aSel )
860 {
861 if( BOARD_CONNECTED_ITEM* bci = dynamic_cast<BOARD_CONNECTED_ITEM*>( item ) )
862 {
863 if( bci->GetNetCode() > 0 )
864 return true;
865 }
866 }
867
868 return false;
869 };
870
875
886
887
890
893
894 mgr->SetConditions( PCB_ACTIONS::zoneDuplicate, ENABLE( singleZoneCond ) );
895 mgr->SetConditions( PCB_ACTIONS::drawZoneCutout, ENABLE( singleZoneCond ) );
896 mgr->SetConditions( PCB_ACTIONS::drawSimilarZone, ENABLE( singleZoneCond ) );
897 mgr->SetConditions( PCB_ACTIONS::zoneMerge, ENABLE( zoneMergeCond ) );
900
902
903#define CURRENT_TOOL( action ) mgr->SetConditions( action, CHECK( cond.CurrentTool( action ) ) )
904
905 // These tools can be used at any time to inspect the board
910
911
912 auto isDrcRunning =
913 [this] ( const SELECTION& )
914 {
916 return !tool->IsDRCRunning();
917 };
918
919#define CURRENT_EDIT_TOOL( action ) mgr->SetConditions( action, ACTION_CONDITIONS().Check( cond.CurrentTool( action ) ).Enable( isDrcRunning ) )
920
921 // These tools edit the board, so they must be disabled during some operations
947
953
954#undef CURRENT_TOOL
955#undef CURRENT_EDIT_TOOL
956#undef ENABLE
957#undef CHECK
958}
959
960
961void PCB_EDIT_FRAME::OnQuit( wxCommandEvent& event )
962{
963 if( event.GetId() == wxID_EXIT )
964 Kiway().OnKiCadExit();
965
966 if( event.GetId() == wxID_CLOSE || Kiface().IsSingle() )
967 Close( false );
968}
969
970
972{
974 bds.m_DrcExclusions.clear();
975
976 for( PCB_MARKER* marker : GetBoard()->Markers() )
977 {
978 if( marker->IsExcluded() )
979 bds.m_DrcExclusions.insert( marker->Serialize() );
980 }
981}
982
983
984void PCB_EDIT_FRAME::ResolveDRCExclusions( bool aCreateMarkers )
985{
986 BOARD_COMMIT commit( this );
987
988 for( PCB_MARKER* marker : GetBoard()->ResolveDRCExclusions( aCreateMarkers ) )
989 {
990 if( marker->GetMarkerType() == MARKER_BASE::MARKER_DRAWING_SHEET )
991 marker->GetRCItem()->SetItems( GetCanvas()->GetDrawingSheet() );
992
993 commit.Add( marker );
994 }
995
996 commit.Push( wxEmptyString, SKIP_UNDO | SKIP_SET_DIRTY );
997
998 for( PCB_MARKER* marker : GetBoard()->Markers() )
999 {
1000 if( marker->GetSeverity() == RPT_SEVERITY_EXCLUSION )
1001 GetCanvas()->GetView()->Update( marker );
1002 }
1003
1005}
1006
1007
1008bool PCB_EDIT_FRAME::canCloseWindow( wxCloseEvent& aEvent )
1009{
1010 // Shutdown blocks must be determined and vetoed as early as possible
1011 if( KIPLATFORM::APP::SupportsShutdownBlockReason() && aEvent.GetId() == wxEVT_QUERY_END_SESSION
1012 && IsContentModified() )
1013 {
1014 return false;
1015 }
1016
1018
1019 if( zoneFillerTool->IsBusy() )
1020 {
1021 wxBell();
1022
1023 if( wxWindow* reporter = dynamic_cast<wxWindow*>( zoneFillerTool->GetProgressReporter() ) )
1024 reporter->ShowWithEffect( wxSHOW_EFFECT_EXPAND );
1025
1026 return false;
1027 }
1028
1029 if( Kiface().IsSingle() )
1030 {
1031 auto* fpEditor = (FOOTPRINT_EDIT_FRAME*) Kiway().Player( FRAME_FOOTPRINT_EDITOR, false );
1032
1033 if( fpEditor && !fpEditor->Close() ) // Can close footprint editor?
1034 return false;
1035
1036 auto* fpViewer = (FOOTPRINT_VIEWER_FRAME*) Kiway().Player( FRAME_FOOTPRINT_VIEWER, false );
1037
1038 if( fpViewer && !fpViewer->Close() ) // Can close footprint viewer?
1039 return false;
1040
1042
1043 if( fpViewer && !fpViewer->Close() ) // Can close modal footprint viewer?
1044 return false;
1045 }
1046 else
1047 {
1048 auto* fpEditor = (FOOTPRINT_EDIT_FRAME*) Kiway().Player( FRAME_FOOTPRINT_EDITOR, false );
1049
1050 if( fpEditor && fpEditor->IsCurrentFPFromBoard() )
1051 {
1052 if( !fpEditor->CanCloseFPFromBoard( true ) )
1053 return false;
1054 }
1055 }
1056
1057 if( IsContentModified() )
1058 {
1059 wxFileName fileName = GetBoard()->GetFileName();
1060 wxString msg = _( "Save changes to '%s' before closing?" );
1061
1062 if( !HandleUnsavedChanges( this, wxString::Format( msg, fileName.GetFullName() ),
1063 [&]() -> bool
1064 {
1065 return Files_io_from_id( ID_SAVE_BOARD );
1066 } ) )
1067 {
1068 return false;
1069 }
1070 }
1071
1072 return PCB_BASE_EDIT_FRAME::canCloseWindow( aEvent );
1073}
1074
1075
1077{
1078 // On Windows 7 / 32 bits, on OpenGL mode only, Pcbnew crashes
1079 // when closing this frame if a footprint was selected, and the footprint editor called
1080 // to edit this footprint, and when closing pcbnew if this footprint is still selected
1081 // See https://bugs.launchpad.net/kicad/+bug/1655858
1082 // I think this is certainly a OpenGL event fired after frame deletion, so this workaround
1083 // avoid the crash (JPC)
1084 GetCanvas()->SetEvtHandlerEnabled( false );
1085
1087
1088 // Clean up mode-less dialogs.
1089 Unbind( EDA_EVT_CLOSE_DIALOG_BOOK_REPORTER,
1091 Unbind( EDA_EVT_CLOSE_NET_INSPECTOR_DIALOG, &PCB_EDIT_FRAME::onCloseNetInspectorDialog, this );
1092 Unbind( EDA_EVT_UNITS_CHANGED, &PCB_EDIT_FRAME::onUnitsChanged, this );
1093
1094 wxWindow* open_dlg = wxWindow::FindWindowByName( DIALOG_DRC_WINDOW_NAME );
1095
1096 if( open_dlg )
1097 open_dlg->Close( true );
1098
1099 if( m_findDialog )
1100 {
1101 m_findDialog->Destroy();
1102 m_findDialog = nullptr;
1103 }
1104
1106 {
1107 m_inspectDrcErrorDlg->Destroy();
1108 m_inspectDrcErrorDlg = nullptr;
1109 }
1110
1112 {
1113 m_inspectClearanceDlg->Destroy();
1114 m_inspectClearanceDlg = nullptr;
1115 }
1116
1118 {
1119 m_inspectConstraintsDlg->Destroy();
1120 m_inspectConstraintsDlg = nullptr;
1121 }
1122
1123 if( m_footprintDiffDlg )
1124 {
1125 m_footprintDiffDlg->Destroy();
1126 m_footprintDiffDlg = nullptr;
1127 }
1128
1129 if( m_netInspectorDlg )
1130 {
1132 m_netInspectorDlg->Destroy();
1133 m_netInspectorDlg = nullptr;
1134 }
1135
1136 // Delete the auto save file if it exists.
1137 wxFileName fn = GetBoard()->GetFileName();
1138
1139 // Auto save file name is the normal file name prefixed with 'GetAutoSaveFilePrefix()'.
1140 fn.SetName( GetAutoSaveFilePrefix() + fn.GetName() );
1141
1142 // When the auto save feature does not have write access to the board file path, it falls
1143 // back to a platform specific user temporary file path.
1144 if( !fn.IsOk() || !fn.IsDirWritable() )
1145 fn.SetPath( wxFileName::GetTempDir() );
1146
1147 wxLogTrace( traceAutoSave, wxT( "Deleting auto save file <" ) + fn.GetFullPath() + wxT( ">" ) );
1148
1149 // Remove the auto save file on a normal close of Pcbnew.
1150 if( fn.FileExists() && !wxRemoveFile( fn.GetFullPath() ) )
1151 {
1152 wxLogTrace( traceAutoSave, wxT( "The auto save file could not be removed!" ) );
1153 }
1154
1155 // Make sure local settings are persisted
1157
1158 // Do not show the layer manager during closing to avoid flicker
1159 // on some platforms (Windows) that generate useless redraw of items in
1160 // the Layer Manager
1162 {
1163 m_auimgr.GetPane( wxS( "LayersManager" ) ).Show( false );
1164 m_auimgr.GetPane( wxS( "TabbedPanel" ) ).Show( false );
1165 }
1166
1167 // Unlink the old project if needed
1169
1170 // Delete board structs and undo/redo lists, to avoid crash on exit
1171 // when deleting some structs (mainly in undo/redo lists) too late
1172 Clear_Pcb( false, true );
1173
1174 // do not show the window because ScreenPcb will be deleted and we do not
1175 // want any paint event
1176 Show( false );
1177
1179}
1180
1181
1183{
1186 GetCanvas()->Refresh();
1187}
1188
1189
1190void PCB_EDIT_FRAME::ShowBoardSetupDialog( const wxString& aInitialPage )
1191{
1192 std::unique_lock<std::mutex> dialogLock( DIALOG_BOARD_SETUP::g_Mutex, std::try_to_lock );
1193
1194 // One DIALOG_BOARD_SETUP dialog at a time.
1195 if( !dialogLock.owns_lock() )
1196 return;
1197
1198 // Make sure everything's up-to-date
1200
1201 DIALOG_BOARD_SETUP dlg( this );
1202
1203 if( !aInitialPage.IsEmpty() )
1204 dlg.SetInitialPage( aInitialPage, wxEmptyString );
1205
1206 if( dlg.ShowQuasiModal() == wxID_OK )
1207 {
1209 // We don't know if anything was modified, so err on the side of requiring a save
1210 OnModify();
1211
1212 Kiway().CommonSettingsChanged( false, true );
1213
1214 PCBNEW_SETTINGS* settings = GetPcbNewSettings();
1215 static LSET maskAndPasteLayers = LSET( 4, F_Mask, F_Paste, B_Mask, B_Paste );
1216
1218 [&]( KIGFX::VIEW_ITEM* aItem ) -> int
1219 {
1220 if( dynamic_cast<PCB_TRACK*>( aItem ) )
1221 {
1223 return KIGFX::REPAINT;
1224 }
1225 else if( dynamic_cast<PAD*>( aItem ) )
1226 {
1227 if( settings->m_Display.m_PadClearance )
1228 return KIGFX::REPAINT;
1229
1230 // Note: KIGFX::REPAINT isn't enough for things that go from invisible
1231 // to visible as they won't be found in the view layer's itemset for
1232 // re-painting.
1233 if( ( GetBoard()->GetVisibleLayers() & maskAndPasteLayers ).any() )
1234 return KIGFX::ALL;
1235 }
1236
1237 EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( aItem );
1238
1239 if( text && text->HasTextVars() )
1240 {
1241 text->ClearRenderCache();
1242 text->ClearBoundingBoxCache();
1244 }
1245
1246 return 0;
1247 } );
1248
1249 GetCanvas()->Refresh();
1250
1254
1255 //this event causes the routing tool to reload its design rules information
1257 toolEvent.SetHasPosition( false );
1258 m_toolManager->ProcessEvent( toolEvent );
1259 }
1260
1261 GetCanvas()->SetFocus();
1262}
1263
1264
1266{
1268
1269 PCBNEW_SETTINGS* cfg = dynamic_cast<PCBNEW_SETTINGS*>( aCfg );
1270 wxASSERT( cfg );
1271
1272 if( cfg )
1273 {
1277 }
1278}
1279
1280
1282{
1284
1285 PCBNEW_SETTINGS* cfg = dynamic_cast<PCBNEW_SETTINGS*>( aCfg );
1286 wxASSERT( cfg );
1287
1288 if( cfg )
1289 {
1293
1294 if( m_propertiesPanel )
1295 {
1298
1301 }
1302
1303 // ensure m_show_search is up to date (the pane can be closed)
1304 m_show_search = m_auimgr.GetPane( SearchPaneName() ).IsShown();
1306 cfg->m_AuiPanels.search_panel_height = m_searchPane->GetSize().y;
1307 }
1308}
1309
1310
1312{
1313 PCBNEW_SETTINGS* cfg = dynamic_cast<PCBNEW_SETTINGS*>( config() );
1314
1315 return cfg ? cfg->m_RotationAngle : ANGLE_90;
1316}
1317
1318
1320{
1322}
1323
1324
1326{
1327
1328 GetColorSettings()->SetColor( LAYER_GRID, aColor );
1329 GetCanvas()->GetGAL()->SetGridColor( aColor );
1330}
1331
1332
1334{
1335 PCB_LAYER_ID oldLayer = GetActiveLayer();
1336
1337 if( oldLayer == aLayer )
1338 return;
1339
1341
1343
1344 m_toolManager->RunAction( PCB_ACTIONS::layerChanged ); // notify other tools
1345 GetCanvas()->SetFocus(); // allow capture of hotkeys
1346 GetCanvas()->SetHighContrastLayer( aLayer );
1347
1349 [&]( KIGFX::VIEW_ITEM* aItem ) -> int
1350 {
1351 BOARD_ITEM* item = dynamic_cast<BOARD_ITEM*>( aItem );
1352
1353 if( !item )
1354 return 0;
1355
1356 // Note: KIGFX::REPAINT isn't enough for things that go from invisible to visible
1357 // as they won't be found in the view layer's itemset for re-painting.
1358 if( GetDisplayOptions().m_ContrastModeDisplay == HIGH_CONTRAST_MODE::HIDDEN )
1359 {
1360 if( item->IsOnLayer( oldLayer, true ) || item->IsOnLayer( aLayer, true ) )
1361 return KIGFX::ALL;
1362 }
1363
1364 if( item->Type() == PCB_VIA_T )
1365 {
1366 PCB_VIA* via = static_cast<PCB_VIA*>( item );
1367
1368 // Vias on a restricted layer set must be redrawn when the active layer
1369 // is changed
1370 if( via->GetViaType() == VIATYPE::BLIND_BURIED
1371 || via->GetViaType() == VIATYPE::MICROVIA )
1372 {
1373 return KIGFX::REPAINT;
1374 }
1375 }
1376 else if( item->Type() == PCB_PAD_T )
1377 {
1378 PAD* pad = static_cast<PAD*>( item );
1379
1380 // Clearances could be layer-dependent so redraw them when the active layer
1381 // is changed
1383 {
1384 // Round-corner rects are expensive to draw, but are mostly found on
1385 // SMD pads which only need redrawing on an active-to-not-active
1386 // switch.
1387 if( pad->GetAttribute() == PAD_ATTRIB::SMD )
1388 {
1389 if( ( oldLayer == F_Cu || aLayer == F_Cu ) && pad->IsOnLayer( F_Cu ) )
1390 return KIGFX::REPAINT;
1391
1392 if( ( oldLayer == B_Cu || aLayer == B_Cu ) && pad->IsOnLayer( B_Cu ) )
1393 return KIGFX::REPAINT;
1394 }
1395 else if( pad->IsOnLayer( oldLayer ) || pad->IsOnLayer( aLayer ) )
1396 {
1397 return KIGFX::REPAINT;
1398 }
1399 }
1400 }
1401 else if( item->Type() == PCB_TRACE_T || item->Type() == PCB_ARC_T )
1402 {
1403 PCB_TRACK* track = static_cast<PCB_TRACK*>( item );
1404
1405 // Clearances could be layer-dependent so redraw them when the active layer
1406 // is changed
1408 {
1409 // Tracks aren't particularly expensive to draw, but it's an easy check.
1410 if( track->IsOnLayer( oldLayer ) || track->IsOnLayer( aLayer ) )
1411 return KIGFX::REPAINT;
1412 }
1413 }
1414
1415 return 0;
1416 } );
1417
1418 GetCanvas()->Refresh();
1419}
1420
1421
1423{
1424 // JEY TODO: move this global to the board
1426
1427 layerEnum.Choices().Clear();
1428 layerEnum.Undefined( UNDEFINED_LAYER );
1429
1430 for( LSEQ seq = LSET::AllLayersMask().Seq(); seq; ++seq )
1431 {
1432 // Canonical name
1433 layerEnum.Map( *seq, LSET::Name( *seq ) );
1434
1435 // User name
1436 layerEnum.Map( *seq, GetBoard()->GetLayerName( *seq ) );
1437 }
1438
1439 DRC_TOOL* drcTool = m_toolManager->GetTool<DRC_TOOL>();
1440
1441 try
1442 {
1443 drcTool->GetDRCEngine()->InitEngine( GetDesignRulesPath() );
1444 }
1445 catch( PARSE_ERROR& )
1446 {
1447 // Not sure this is the best place to tell the user their rules are buggy, so
1448 // we'll stay quiet for now. Feel free to revisit this decision....
1449 }
1450
1451 UpdateTitle();
1452
1453 wxFileName fn = GetBoard()->GetFileName();
1454
1455 // Display a warning that the file is read only
1456 if( fn.FileExists() && !fn.IsFileWritable() )
1457 {
1460 m_infoBar->ShowMessage( _( "Board file is read only." ),
1462 }
1463
1465
1466 // Sync layer and item visibility
1468
1469 SetElementVisibility( LAYER_RATSNEST, GetPcbNewSettings()->m_Display.m_ShowGlobalRatsnest );
1470
1472
1473 // Apply saved display state to the appearance panel after it has been set up
1474 PROJECT_LOCAL_SETTINGS& localSettings = Prj().GetLocalSettings();
1475
1477
1478 if( GetBoard()->GetDesignSettings().IsLayerEnabled( localSettings.m_ActiveLayer ) )
1479 SetActiveLayer( localSettings.m_ActiveLayer );
1480
1481 // Updates any auto dimensions and the auxiliary toolbar tracks/via sizes
1483
1484 // Display the loaded board:
1485 Zoom_Automatique( false );
1486
1487 // Invalidate painting as loading the DRC engine will cause clearances to become valid
1489
1490 Refresh();
1491
1492 SetMsgPanel( GetBoard() );
1493 SetStatusText( wxEmptyString );
1494
1495 KIPLATFORM::APP::SetShutdownBlockReason( this, _( "PCB file changes are unsaved" ) );
1496}
1497
1498
1500{
1502}
1503
1504
1506{
1507 return GetBoard()->IsElementVisible( aElement );
1508}
1509
1510
1512{
1513 // Force the RATSNEST visible
1514 if( aElement == LAYER_RATSNEST )
1515 GetCanvas()->GetView()->SetLayerVisible( aElement, true );
1516 else
1517 GetCanvas()->GetView()->SetLayerVisible( aElement , aNewState );
1518
1519 GetBoard()->SetElementVisibility( aElement, aNewState );
1520}
1521
1522
1524{
1525 // call my base class
1527
1528 m_auimgr.GetPane( m_appearancePanel ).Caption( _( "Appearance" ) );
1529 m_auimgr.GetPane( m_selectionFilterPanel ).Caption( _( "Selection Filter" ) );
1530 m_auimgr.GetPane( m_propertiesPanel ).Caption( _( "Properties" ) );
1531 m_auimgr.Update();
1532
1536
1537 UpdateTitle();
1538}
1539
1540
1542{
1544
1545 if( project.m_PcbLastPath[ aType ].IsEmpty() )
1546 return wxEmptyString;
1547
1548 wxFileName absoluteFileName = project.m_PcbLastPath[ aType ];
1549 wxFileName pcbFileName = GetBoard()->GetFileName();
1550
1551 absoluteFileName.MakeAbsolute( pcbFileName.GetPath() );
1552 return absoluteFileName.GetFullPath();
1553}
1554
1555
1556void PCB_EDIT_FRAME::SetLastPath( LAST_PATH_TYPE aType, const wxString& aLastPath )
1557{
1559
1560 wxFileName relativeFileName = aLastPath;
1561 wxFileName pcbFileName = GetBoard()->GetFileName();
1562
1563 relativeFileName.MakeRelativeTo( pcbFileName.GetPath() );
1564
1565 if( relativeFileName.GetFullPath() != project.m_PcbLastPath[ aType ] )
1566 {
1567 project.m_PcbLastPath[ aType ] = relativeFileName.GetFullPath();
1568 OnModify();
1569 }
1570}
1571
1572
1574{
1576
1577 Update3DView( true, GetPcbNewSettings()->m_Display.m_Live3DRefresh );
1578
1579 if( !GetTitle().StartsWith( wxT( "*" ) ) )
1580 UpdateTitle();
1581
1582 m_ZoneFillsDirty = true;
1583}
1584
1585
1587{
1588 Update3DView( true, true );
1589}
1590
1591
1592void PCB_EDIT_FRAME::ExportSVG( wxCommandEvent& event )
1593{
1594 InvokeExportSVG( this, GetBoard() );
1595}
1596
1597
1599{
1600 wxFileName fn = GetBoard()->GetFileName();
1601 bool readOnly = false;
1602 bool unsaved = false;
1603
1604 if( fn.IsOk() && fn.FileExists() )
1605 readOnly = !fn.IsFileWritable();
1606 else
1607 unsaved = true;
1608
1609 wxString title;
1610
1611 if( IsContentModified() )
1612 title = wxT( "*" );
1613
1614 title += fn.GetName();
1615
1616 if( readOnly )
1617 title += wxS( " " ) + _( "[Read Only]" );
1618
1619 if( unsaved )
1620 title += wxS( " " ) + _( "[Unsaved]" );
1621
1622 title += wxT( " \u2014 " ) + _( "PCB Editor" );
1623
1624 SetTitle( title );
1625}
1626
1627
1629{
1630 // Update the layer manager and other widgets from the board setup
1631 // (layer and items visibility, colors ...)
1632
1633 // Rebuild list of nets (full ratsnest rebuild)
1635
1636 // Update info shown by the horizontal toolbars
1638
1639 LSET activeLayers = GetBoard()->GetEnabledLayers();
1640
1641 if( !activeLayers.test( GetActiveLayer() ) )
1642 SetActiveLayer( activeLayers.Seq().front() );
1643
1645
1647
1648 layerEnum.Choices().Clear();
1649 layerEnum.Undefined( UNDEFINED_LAYER );
1650
1651 for( LSEQ seq = LSET::AllLayersMask().Seq(); seq; ++seq )
1652 {
1653 // Canonical name
1654 layerEnum.Map( *seq, LSET::Name( *seq ) );
1655
1656 // User name
1657 layerEnum.Map( *seq, GetBoard()->GetLayerName( *seq ) );
1658 }
1659
1660 // Sync visibility with canvas
1661 for( PCB_LAYER_ID layer : LSET::AllLayersMask().Seq() )
1662 GetCanvas()->GetView()->SetLayerVisible( layer, GetBoard()->IsLayerVisible( layer ) );
1663
1664 // Stackup and/or color theme may have changed
1666}
1667
1668
1670{
1671 // switches currently used canvas (Cairo / OpenGL).
1672 PCB_BASE_FRAME::SwitchCanvas( aCanvasType );
1673}
1674
1675
1677{
1678 if( !m_findDialog )
1679 {
1680 m_findDialog = new DIALOG_FIND( this );
1683 }
1684
1685 wxString findString;
1686
1687 PCB_SELECTION& selection = m_toolManager->GetTool<PCB_SELECTION_TOOL>()->GetSelection();
1688
1689 if( selection.Size() == 1 )
1690 {
1691 EDA_ITEM* front = selection.Front();
1692
1693 switch( front->Type() )
1694 {
1695 case PCB_FOOTPRINT_T:
1696 findString = UnescapeString( static_cast<FOOTPRINT*>( front )->GetValue() );
1697 break;
1698
1699 case PCB_TEXT_T:
1700 findString = UnescapeString( static_cast<PCB_TEXT*>( front )->GetText() );
1701
1702 if( findString.Contains( wxT( "\n" ) ) )
1703 findString = findString.Before( '\n' );
1704
1705 break;
1706
1707 default:
1708 break;
1709 }
1710 }
1711
1712 m_findDialog->Preload( findString );
1713
1714 m_findDialog->Show( true );
1715}
1716
1717
1718void PCB_EDIT_FRAME::FindNext( bool reverse )
1719{
1720 if( !m_findDialog )
1722
1723 m_findDialog->FindNext( reverse );
1724}
1725
1726
1728{
1729 PCB_PLOT_PARAMS plotSettings = GetPlotSettings();
1730
1731 switch( aID )
1732 {
1733 case ID_GEN_PLOT_GERBER:
1734 plotSettings.SetFormat( PLOT_FORMAT::GERBER );
1735 break;
1736 case ID_GEN_PLOT_DXF:
1737 plotSettings.SetFormat( PLOT_FORMAT::DXF );
1738 break;
1739 case ID_GEN_PLOT_HPGL:
1740 plotSettings.SetFormat( PLOT_FORMAT::HPGL );
1741 break;
1742 case ID_GEN_PLOT_PDF:
1743 plotSettings.SetFormat( PLOT_FORMAT::PDF );
1744 break;
1745 case ID_GEN_PLOT_PS:
1746 plotSettings.SetFormat( PLOT_FORMAT::POST );
1747 break;
1748 case ID_GEN_PLOT:
1749 /* keep the previous setup */
1750 break;
1751 default:
1752 wxFAIL_MSG( wxT( "ToPlotter(): unexpected plot type" ) ); break;
1753 break;
1754 }
1755
1756 SetPlotSettings( plotSettings );
1757
1758 DIALOG_PLOT dlg( this );
1759 dlg.ShowQuasiModal( );
1760}
1761
1762
1764{
1765 if( Kiface().IsSingle() )
1766 return 0;
1767
1768 // Update PCB requires a netlist. Therefore the schematic editor must be running
1769 // If this is not the case, open the schematic editor
1770 KIWAY_PLAYER* frame = Kiway().Player( FRAME_SCH, true );
1771
1772 // If Kiway() cannot create the eeschema frame, it shows a error message, and
1773 // frame is null
1774 if( !frame )
1775 return -1;
1776
1777 if( !frame->IsShown() )
1778 {
1779 wxFileName fn( Prj().GetProjectPath(), Prj().GetProjectName(),
1781
1782 // Maybe the file hasn't been converted to the new s-expression file format so
1783 // see if the legacy schematic file is still in play.
1784 if( !fn.FileExists() )
1785 {
1786 fn.SetExt( LegacySchematicFileExtension );
1787
1788 if( !fn.FileExists() )
1789 {
1790 DisplayError( this, _( "The schematic for this board cannot be found." ) );
1791 return -2;
1792 }
1793 }
1794
1795 frame->OpenProjectFiles( std::vector<wxString>( 1, fn.GetFullPath() ) );
1796
1797 // we show the schematic editor frame, because do not show is seen as
1798 // a not yet opened schematic by Kicad manager, which is not the case
1799 frame->Show( true );
1800
1801 // bring ourselves back to the front
1802 Raise();
1803 }
1804
1805 return 1; //Success!
1806}
1807
1808
1810 const wxString& aAnnotateMessage )
1811{
1812 if( TestStandalone() == 0 )
1813 {
1814 DisplayErrorMessage( this, _( "Cannot update the PCB because PCB editor is opened in "
1815 "stand-alone mode. In order to create or update PCBs from "
1816 "schematics, you must launch the KiCad project manager and "
1817 "create a project." ) );
1818 return false; // Not in standalone mode
1819 }
1820
1821 if( TestStandalone() < 0 ) // Problem with Eeschema or the schematic
1822 return false;
1823
1824 Raise(); // Show
1825
1826 std::string payload( aAnnotateMessage );
1827
1828 Kiway().ExpressMail( FRAME_SCH, MAIL_SCH_GET_NETLIST, payload, this );
1829
1830 if( payload == aAnnotateMessage )
1831 {
1832 Raise();
1833 DisplayErrorMessage( this, aAnnotateMessage );
1834 return false;
1835 }
1836
1837 try
1838 {
1839 auto lineReader = new STRING_LINE_READER( payload, _( "Eeschema netlist" ) );
1840 KICAD_NETLIST_READER netlistReader( lineReader, &aNetlist );
1841 netlistReader.LoadNetlist();
1842 }
1843 catch( const IO_ERROR& e )
1844 {
1845 Raise();
1846
1847 // Do not translate extra_info strings. These are for developers
1848 wxString extra_info = e.Problem() + wxT( " : " ) + e.What() + wxT( " at " ) + e.Where();
1849
1850 DisplayErrorMessage( this, _( "Received an error while reading netlist. Please "
1851 "report this issue to the KiCad team using the menu "
1852 "Help->Report Bug."), extra_info );
1853 return false;
1854 }
1855
1856 return true;
1857}
1858
1859
1861{
1862 wxString msg;
1863 wxFileName schematic( Prj().GetProjectPath(), Prj().GetProjectName(),
1865
1866 if( !schematic.FileExists() )
1867 {
1868 wxFileName legacySchematic( Prj().GetProjectPath(), Prj().GetProjectName(),
1870
1871 if( legacySchematic.FileExists() )
1872 {
1873 schematic = legacySchematic;
1874 }
1875 else
1876 {
1877 msg.Printf( _( "Schematic file '%s' not found." ), schematic.GetFullPath() );
1878 DisplayErrorMessage( this, msg );
1879 return;
1880 }
1881 }
1882
1883 if( Kiface().IsSingle() )
1884 {
1885 ExecuteFile( EESCHEMA_EXE, schematic.GetFullPath() );
1886 }
1887 else
1888 {
1889 KIWAY_PLAYER* frame = Kiway().Player( FRAME_SCH, false );
1890
1891 // Please: note: DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::initBuffers() calls
1892 // Kiway.Player( FRAME_SCH, true )
1893 // therefore, the schematic editor is sometimes running, but the schematic project
1894 // is not loaded, if the library editor was called, and the dialog field editor was used.
1895 // On Linux, it happens the first time the schematic editor is launched, if
1896 // library editor was running, and the dialog field editor was open
1897 // On Windows, it happens always after the library editor was called,
1898 // and the dialog field editor was used
1899 if( !frame )
1900 {
1901 try
1902 {
1903 frame = Kiway().Player( FRAME_SCH, true );
1904 }
1905 catch( const IO_ERROR& err )
1906 {
1907 DisplayErrorMessage( this, _( "Eeschema failed to load." ) + wxS( "\n" ) + err.What() );
1908 return;
1909 }
1910 }
1911
1912 // If Kiway() cannot create the eeschema frame, it shows a error message, and
1913 // frame is null
1914 if( !frame )
1915 return;
1916
1917 if( !frame->IsShown() ) // the frame exists, (created by the dialog field editor)
1918 // but no project loaded.
1919 {
1920 frame->OpenProjectFiles( std::vector<wxString>( 1, schematic.GetFullPath() ) );
1921 frame->Show( true );
1922 }
1923
1924 // On Windows, Raise() does not bring the window on screen, when iconized or not shown
1925 // On Linux, Raise() brings the window on screen, but this code works fine
1926 if( frame->IsIconized() )
1927 {
1928 frame->Iconize( false );
1929
1930 // If an iconized frame was created by Pcbnew, Iconize( false ) is not enough
1931 // to show the frame at its normal size: Maximize should be called.
1932 frame->Maximize( false );
1933 }
1934
1935 frame->Raise();
1936 }
1937}
1938
1939
1941{
1942 const ENV_VAR_MAP& vars = Pgm().GetLocalEnvVariables();
1943
1944 // Set the environment variables for python scripts
1945 // note: the string will be encoded UTF8 for python env
1946 for( const std::pair<const wxString, ENV_VAR_ITEM>& var : vars )
1947 UpdatePythonEnvVar( var.first, var.second.GetValue() );
1948
1949 // Because the env vars can be modified by the python scripts (rewritten in UTF8),
1950 // regenerate them (in Unicode) for our normal environment
1951 for( const std::pair<const wxString, ENV_VAR_ITEM>& var : vars )
1952 wxSetEnv( var.first, var.second.GetValue() );
1953}
1954
1955
1957{
1958 wxString evValue;
1959 wxGetEnv( PROJECT_VAR_NAME, &evValue );
1960 UpdatePythonEnvVar( wxString( PROJECT_VAR_NAME ).ToStdString(), evValue );
1961
1962 // Because PROJECT_VAR_NAME can be modified by the python scripts (rewritten in UTF8),
1963 // regenerate it (in Unicode) for our normal environment
1964 wxSetEnv( PROJECT_VAR_NAME, evValue );
1965}
1966
1967
1969{
1970 if( aFootprint == nullptr )
1971 return;
1972
1974
1975 /*
1976 * Make sure dlg is destroyed before GetCanvas->Refresh is called
1977 * later or the refresh will try to modify its properties since
1978 * they share a GL context.
1979 */
1980 {
1981 DIALOG_FOOTPRINT_PROPERTIES dlg( this, aFootprint );
1982
1983 dlg.ShowModal();
1984 retvalue = dlg.GetReturnValue();
1985 }
1986
1987 /*
1988 * retvalue =
1989 * FP_PROPS_UPDATE_FP to show Update Footprints dialog
1990 * FP_PROPS_CHANGE_FP to show Change Footprints dialog
1991 * FP_PROPS_OK for normal edit
1992 * FP_PROPS_CANCEL if aborted
1993 * FP_PROPS_EDIT_BOARD_FP to load board footprint into Footprint Editor
1994 * FP_PROPS_EDIT_LIBRARY_FP to load library footprint into Footprint Editor
1995 */
1996
1998 {
1999 // If something edited, push a refresh request
2000 GetCanvas()->Refresh();
2001 }
2003 {
2005
2006 editor->LoadFootprintFromBoard( aFootprint );
2007
2008 editor->Show( true );
2009 editor->Raise(); // Iconize( false );
2010 }
2012 {
2014
2015 editor->LoadFootprintFromLibrary( aFootprint->GetFPID() );
2016
2017 editor->Show( true );
2018 editor->Raise(); // Iconize( false );
2019 }
2021 {
2022 ShowExchangeFootprintsDialog( aFootprint, true, true );
2023 }
2025 {
2026 ShowExchangeFootprintsDialog( aFootprint, false, true );
2027 }
2028}
2029
2030
2032 bool aSelectedMode )
2033{
2034 DIALOG_EXCHANGE_FOOTPRINTS dialog( this, aFootprint, aUpdateMode, aSelectedMode );
2035
2036 return dialog.ShowQuasiModal();
2037}
2038
2039
2040namespace {
2041
2042
2043void processTextItem( const PCB_TEXT& aSrc, PCB_TEXT& aDest,
2044 bool resetText, bool resetTextLayers, bool resetTextEffects,
2045 bool* aUpdated )
2046{
2047 if( resetText )
2048 *aUpdated |= aSrc.GetText() != aDest.GetText();
2049 else
2050 aDest.SetText( aSrc.GetText() );
2051
2052 if( resetTextLayers )
2053 {
2054 *aUpdated |= aSrc.GetLayer() != aDest.GetLayer();
2055 *aUpdated |= aSrc.IsVisible() != aDest.IsVisible();
2056 }
2057 else
2058 {
2059 aDest.SetLayer( aSrc.GetLayer() );
2060 aDest.SetVisible( aSrc.IsVisible() );
2061 }
2062
2063 if( resetTextEffects )
2064 {
2065 *aUpdated |= aSrc.GetHorizJustify() != aDest.GetHorizJustify();
2066 *aUpdated |= aSrc.GetVertJustify() != aDest.GetVertJustify();
2067 *aUpdated |= aSrc.GetTextSize() != aDest.GetTextSize();
2068 *aUpdated |= aSrc.GetTextThickness() != aDest.GetTextThickness();
2069 *aUpdated |= aSrc.GetTextAngle() != aDest.GetTextAngle();
2070 *aUpdated |= aSrc.GetFPRelativePosition() != aDest.GetFPRelativePosition();
2071 }
2072 else
2073 {
2074 // Careful: the visible bit and position are also set by SetAttributes()
2075 bool visible = aDest.IsVisible();
2076 aDest.SetAttributes( aSrc );
2077 aDest.SetVisible( visible );
2079 }
2080
2081 aDest.SetLocked( aSrc.IsLocked() );
2082}
2083
2084
2085PCB_TEXT* getMatchingTextItem( PCB_TEXT* aRefItem, FOOTPRINT* aFootprint )
2086{
2087 std::vector<PCB_TEXT*> candidates;
2088
2089 for( BOARD_ITEM* item : aFootprint->GraphicalItems() )
2090 {
2091 PCB_TEXT* candidate = dyn_cast<PCB_TEXT*>( item );
2092
2093 if( candidate && candidate->GetText() == aRefItem->GetText() )
2094 candidates.push_back( candidate );
2095 }
2096
2097 if( candidates.size() == 0 )
2098 return nullptr;
2099
2100 if( candidates.size() == 1 )
2101 return candidates[0];
2102
2103 // Try refining the match by layer
2104 std::vector<PCB_TEXT*> candidatesOnSameLayer;
2105
2106 for( PCB_TEXT* candidate : candidates )
2107 {
2108 if( candidate->GetLayer() == aRefItem->GetLayer() )
2109 candidatesOnSameLayer.push_back( candidate );
2110 }
2111
2112 if( candidatesOnSameLayer.size() == 1 )
2113 return candidatesOnSameLayer[0];
2114
2115 // Last ditch effort: refine by position
2116 std::vector<PCB_TEXT*> candidatesAtSamePos;
2117
2118 for( PCB_TEXT* candidate : candidatesOnSameLayer.size() ? candidatesOnSameLayer : candidates )
2119 {
2120 if( candidate->GetFPRelativePosition() == aRefItem->GetFPRelativePosition() )
2121 candidatesAtSamePos.push_back( candidate );
2122 }
2123
2124 if( candidatesAtSamePos.size() > 0 )
2125 return candidatesAtSamePos[0];
2126 else if( candidatesOnSameLayer.size() > 0 )
2127 return candidatesOnSameLayer[0];
2128 else
2129 return candidates[0];
2130}
2131
2132
2133}
2134
2135
2137 BOARD_COMMIT& aCommit, bool deleteExtraTexts,
2138 bool resetTextLayers, bool resetTextEffects,
2139 bool resetFabricationAttrs, bool reset3DModels,
2140 bool* aUpdated )
2141{
2142 PCB_GROUP* parentGroup = aExisting->GetParentGroup();
2143 bool dummyBool = false;
2144
2145 if( !aUpdated )
2146 aUpdated = &dummyBool;
2147
2148 if( parentGroup )
2149 {
2150 parentGroup->RemoveItem( aExisting );
2151 parentGroup->AddItem( aNew );
2152 }
2153
2154 aNew->SetParent( GetBoard() );
2155
2156 PlaceFootprint( aNew, false );
2157
2158 // PlaceFootprint will move the footprint to the cursor position, which we don't want. Copy
2159 // the original position across.
2160 aNew->SetPosition( aExisting->GetPosition() );
2161
2162 if( aNew->GetLayer() != aExisting->GetLayer() )
2163 aNew->Flip( aNew->GetPosition(), GetPcbNewSettings()->m_FlipLeftRight );
2164
2165 if( aNew->GetOrientation() != aExisting->GetOrientation() )
2166 aNew->SetOrientation( aExisting->GetOrientation() );
2167
2168 aNew->SetLocked( aExisting->IsLocked() );
2169
2170 // Now transfer the net info from "old" pads to the new footprint
2171 for( PAD* pad : aNew->Pads() )
2172 {
2173 PAD* pad_model = nullptr;
2174
2175 // Pads with no copper are never connected to a net
2176 if( !pad->IsOnCopperLayer() )
2177 {
2178 pad->SetNetCode( NETINFO_LIST::UNCONNECTED );
2179 continue;
2180 }
2181
2182 // Pads with no numbers are never connected to a net
2183 if( pad->GetNumber().IsEmpty() )
2184 {
2185 pad->SetNetCode( NETINFO_LIST::UNCONNECTED );
2186 continue;
2187 }
2188
2189 // Search for a similar pad on a copper layer, to reuse net info
2190 PAD* last_pad = nullptr;
2191
2192 while( true )
2193 {
2194 pad_model = aExisting->FindPadByNumber( pad->GetNumber(), last_pad );
2195
2196 if( !pad_model )
2197 break;
2198
2199 if( pad_model->IsOnCopperLayer() ) // a candidate is found
2200 break;
2201
2202 last_pad = pad_model;
2203 }
2204
2205 if( pad_model )
2206 {
2207 pad->SetLocalRatsnestVisible( pad_model->GetLocalRatsnestVisible() );
2208 pad->SetPinFunction( pad_model->GetPinFunction() );
2209 pad->SetPinType( pad_model->GetPinType() );
2210 }
2211
2212 pad->SetNetCode( pad_model ? pad_model->GetNetCode() : NETINFO_LIST::UNCONNECTED );
2213 }
2214
2215 // Copy reference
2216 processTextItem( aExisting->Reference(), aNew->Reference(),
2217 // never reset reference text
2218 false,
2219 resetTextLayers, resetTextEffects, aUpdated );
2220
2221 // Copy value
2222 processTextItem( aExisting->Value(), aNew->Value(),
2223 // reset value text only when it is a proxy for the footprint ID
2224 // (cf replacing value "MountingHole-2.5mm" with "MountingHole-4.0mm")
2225 aExisting->GetValue() == aExisting->GetFPID().GetLibItemName(),
2226 resetTextLayers, resetTextEffects, aUpdated );
2227
2228 // Copy fields in accordance with the reset* flags
2229
2230 for( BOARD_ITEM* item : aExisting->GraphicalItems() )
2231 {
2232 PCB_TEXT* srcItem = dyn_cast<PCB_TEXT*>( item );
2233
2234 if( srcItem )
2235 {
2236 PCB_TEXT* destItem = getMatchingTextItem( srcItem, aNew );
2237
2238 if( destItem )
2239 {
2240 processTextItem( *srcItem, *destItem, false, resetTextLayers, resetTextEffects,
2241 aUpdated );
2242 }
2243 else if( !deleteExtraTexts )
2244 {
2245 aNew->Add( new PCB_TEXT( *srcItem ) );
2246 }
2247 }
2248 }
2249
2250 if( resetFabricationAttrs )
2251 {
2252 // We've replaced the existing footprint with the library one, so the fabrication attrs
2253 // are already reset.
2254 //
2255 // We only have to do anything if resetFabricationAttrs is *not* set....
2256 }
2257 else
2258 {
2259 // Careful; allow-soldermask-bridges is in the m_attributes field but is not presented
2260 // as a fabrication attribute in the GUI....
2261 int libraryFlagsToKeep = aNew->GetAttributes() & FP_ALLOW_SOLDERMASK_BRIDGES;
2262 int existingFlagsToKeep = aExisting->GetAttributes() & ~FP_ALLOW_SOLDERMASK_BRIDGES;
2263 aNew->SetAttributes( existingFlagsToKeep | libraryFlagsToKeep );
2264 }
2265
2266 if( reset3DModels )
2267 {
2268 // We've replaced the existing footprint with the library one, so the 3D models are
2269 // already reset.
2270 //
2271 // We only have to do anything if reset3DModels is *not* set....
2272 }
2273 else
2274 {
2275 aNew->Models() = aExisting->Models(); // Linked list of 3D models.
2276 }
2277
2278 // Updating other parameters
2279 const_cast<KIID&>( aNew->m_Uuid ) = aExisting->m_Uuid;
2280 aNew->SetProperties( aExisting->GetProperties() );
2281 aNew->SetPath( aExisting->GetPath() );
2282
2283 aCommit.Remove( aExisting );
2284 aCommit.Add( aNew );
2285
2286 aNew->ClearFlags();
2287}
2288
2289
2290void PCB_EDIT_FRAME::CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged )
2291{
2292 PCB_BASE_EDIT_FRAME::CommonSettingsChanged( aEnvVarsChanged, aTextVarsChanged );
2293
2295
2296 KIGFX::PCB_VIEW* view = GetCanvas()->GetView();
2297 KIGFX::PCB_PAINTER* painter = static_cast<KIGFX::PCB_PAINTER*>( view->GetPainter() );
2298 KIGFX::PCB_RENDER_SETTINGS* renderSettings = painter->GetSettings();
2299
2300 renderSettings->LoadDisplayOptions( GetDisplayOptions() );
2301
2302 SetElementVisibility( LAYER_RATSNEST, GetPcbNewSettings()->m_Display.m_ShowGlobalRatsnest );
2303
2305
2306 // Netclass definitions could have changed, either by us or by Eeschema, so we need to
2307 // recompile the implicit rules
2308 DRC_TOOL* drcTool = m_toolManager->GetTool<DRC_TOOL>();
2309 WX_INFOBAR* infobar = GetInfoBar();
2310
2311 try
2312 {
2313 drcTool->GetDRCEngine()->InitEngine( GetDesignRulesPath() );
2314
2315 if( infobar->GetMessageType() == WX_INFOBAR::MESSAGE_TYPE::DRC_RULES_ERROR )
2316 infobar->Dismiss();
2317 }
2318 catch( PARSE_ERROR& )
2319 {
2320 wxHyperlinkCtrl* button = new wxHyperlinkCtrl( infobar, wxID_ANY, _( "Edit design rules" ),
2321 wxEmptyString );
2322
2323 button->Bind( wxEVT_COMMAND_HYPERLINK, std::function<void( wxHyperlinkEvent& aEvent )>(
2324 [&]( wxHyperlinkEvent& aEvent )
2325 {
2326 ShowBoardSetupDialog( _( "Custom Rules" ) );
2327 } ) );
2328
2329 infobar->RemoveAllButtons();
2330 infobar->AddButton( button );
2331 infobar->AddCloseButton();
2332 infobar->ShowMessage( _( "Could not compile custom design rules." ), wxICON_ERROR,
2334 }
2335
2338
2339 // Update the environment variables in the Python interpreter
2340 if( aEnvVarsChanged )
2342
2343 Layout();
2344 SendSizeEvent();
2345}
2346
2347
2349{
2351}
2352
2353
2355{
2357}
2358
2359
2360bool ExportBoardToHyperlynx( BOARD* aBoard, const wxFileName& aPath );
2361
2362
2363void PCB_EDIT_FRAME::OnExportHyperlynx( wxCommandEvent& event )
2364{
2365 wxString wildcard = wxT( "*.hyp" );
2366 wxFileName fn = GetBoard()->GetFileName();
2367
2368 fn.SetExt( wxT("hyp") );
2369
2370 wxFileDialog dlg( this, _( "Export Hyperlynx Layout" ), fn.GetPath(), fn.GetFullName(),
2371 wildcard, wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
2372
2373 if( dlg.ShowModal() != wxID_OK )
2374 return;
2375
2376 fn = dlg.GetPath();
2377
2378 // always enforce filename extension, user may not have entered it.
2379 fn.SetExt( wxT( "hyp" ) );
2380
2382}
2383
2384
2386{
2387 return GetBoard()->GetFileName();
2388}
2389
2390
2392{
2393 return m_auimgr.GetPane( wxS( "LayersManager" ) ).IsShown();
2394}
2395
2396
2398{
2399 return m_auimgr.GetPane( wxS( "PropertiesManager" ) ).IsShown();
2400}
2401
2402
2403void PCB_EDIT_FRAME::onSize( wxSizeEvent& aEvent )
2404{
2405 if( IsShown() )
2406 {
2407 // We only need this until the frame is done resizing and the final client size is
2408 // established.
2409 Unbind( wxEVT_SIZE, &PCB_EDIT_FRAME::onSize, this );
2411 }
2412
2413 // Skip() is called in the base class.
2414 EDA_DRAW_FRAME::OnSize( aEvent );
2415}
2416
2417
2419{
2422 _( "Violation Report" ) );
2423
2424 return m_inspectDrcErrorDlg;
2425}
2426
2427
2429{
2432 _( "Clearance Report" ) );
2433
2434 return m_inspectClearanceDlg;
2435}
2436
2437
2439{
2442 _( "Constraints Report" ) );
2443
2445}
2446
2447
2449{
2450 if( !m_footprintDiffDlg )
2452 _( "Diff Footprint with Library" ) );
2453
2454 return m_footprintDiffDlg;
2455}
2456
2457
2459{
2460 if( m_inspectDrcErrorDlg && aEvent.GetString() == INSPECT_DRC_ERROR_DIALOG_NAME )
2461 {
2462 m_inspectDrcErrorDlg->Destroy();
2463 m_inspectDrcErrorDlg = nullptr;
2464 }
2465 else if( m_inspectClearanceDlg && aEvent.GetString() == INSPECT_CLEARANCE_DIALOG_NAME )
2466 {
2467 m_inspectClearanceDlg->Destroy();
2468 m_inspectClearanceDlg = nullptr;
2469 }
2470 else if( m_inspectConstraintsDlg && aEvent.GetString() == INSPECT_CONSTRAINTS_DIALOG_NAME )
2471 {
2472 m_inspectConstraintsDlg->Destroy();
2473 m_inspectConstraintsDlg = nullptr;
2474 }
2475 else if( m_footprintDiffDlg && aEvent.GetString() == INSPECT_CONSTRAINTS_DIALOG_NAME )
2476 {
2477 m_footprintDiffDlg->Destroy();
2478 m_footprintDiffDlg = nullptr;
2479 }
2480}
2481
2482
2484{
2485 if( !m_netInspectorDlg )
2486 {
2489 }
2490
2491 return m_netInspectorDlg;
2492}
2493
2494
2495void PCB_EDIT_FRAME::onCloseNetInspectorDialog( wxCommandEvent& aEvent )
2496{
2497 if( m_netInspectorDlg )
2498 {
2500 m_netInspectorDlg->Destroy();
2501 m_netInspectorDlg = nullptr;
2502 }
2503}
2504
2505
2506void PCB_EDIT_FRAME::onUnitsChanged( wxCommandEvent& aEvent )
2507{
2508 wxCommandEvent evt( EDA_EVT_UNITS_CHANGED );
2509
2510 if( m_netInspectorDlg )
2511 m_netInspectorDlg->HandleWindowEvent( evt );
2512}
Class PCBNEW_ACTION_PLUGINS.
constexpr EDA_IU_SCALE pcbIUScale
Definition: base_units.h:109
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:106
@ icon_pcbnew_32
@ icon_pcbnew_16
static TOOL_ACTION toggleGrid
Definition: actions.h:144
static TOOL_ACTION paste
Definition: actions.h:69
static TOOL_ACTION millimetersUnits
Definition: actions.h:150
static TOOL_ACTION togglePolarCoords
Definition: actions.h:153
static TOOL_ACTION copy
Definition: actions.h:68
static TOOL_ACTION pasteSpecial
Definition: actions.h:70
static TOOL_ACTION milsUnits
Definition: actions.h:149
static TOOL_ACTION toggleBoundingBoxes
Definition: actions.h:108
static TOOL_ACTION showSearch
Definition: actions.h:77
static TOOL_ACTION undo
Definition: actions.h:65
static TOOL_ACTION duplicate
Definition: actions.h:72
static TOOL_ACTION inchesUnits
Definition: actions.h:148
static TOOL_ACTION highContrastMode
Definition: actions.h:106
static TOOL_ACTION toggleCursorStyle
Definition: actions.h:105
static TOOL_ACTION measureTool
Definition: actions.h:158
static TOOL_ACTION doDelete
Definition: actions.h:73
static TOOL_ACTION selectionTool
Definition: actions.h:157
static TOOL_ACTION save
Definition: actions.h:51
static TOOL_ACTION zoomFitScreen
Definition: actions.h:99
static TOOL_ACTION redo
Definition: actions.h:66
static TOOL_ACTION deleteTool
Definition: actions.h:74
static TOOL_ACTION zoomTool
Definition: actions.h:102
static TOOL_ACTION cut
Definition: actions.h:67
static TOOL_ACTION gridSetOrigin
Definition: actions.h:141
static TOOL_ACTION selectAll
Definition: actions.h:71
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.
void OnLanguageChanged()
Update the panel contents from the application and board models.
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
Definition: app_settings.h:110
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:71
virtual void Push(const wxString &aMessage=wxT("A commit"), int aCommitFlags=0) override
Revert the commit by restoring the modified items state.
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
bool GetLocalRatsnestVisible() const
Container for design settings for a BOARD object.
std::set< wxString > m_DrcExclusions
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:71
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition: board_item.h:196
virtual void SetLocked(bool aLocked)
Definition: board_item.h:270
PCB_GROUP * GetParentGroup() const
Definition: board_item.h:85
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Definition: board_item.h:230
VECTOR2I GetFPRelativePosition() const
Definition: board_item.cpp:254
void SetFPRelativePosition(const VECTOR2I &aPos)
Definition: board_item.cpp:268
virtual bool IsLocked() const
Definition: board_item.cpp:72
virtual bool IsOnLayer(PCB_LAYER_ID aLayer, bool aIncludeCourtyards=false) const
Test to see if this object is on the given layer.
Definition: board_item.h:261
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:270
LSET GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
Definition: board.cpp:611
void BuildListOfNets()
Definition: board.h:779
bool IsElementVisible(GAL_LAYER_ID aLayer) const
Test whether a given element category is visible.
Definition: board.cpp:677
void RemoveAllListeners()
Remove all listeners.
Definition: board.cpp:2121
const PAGE_INFO & GetPageSettings() const
Definition: board.h:638
GAL_SET GetVisibleElements() const
Return a set of all the element categories that are visible.
Definition: board.cpp:671
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:168
void SynchronizeNetsAndNetClasses(bool aResetTrackAndViaSizes)
Copy NETCLASS info to each NET, based on NET membership in a NETCLASS.
Definition: board.cpp:1601
TITLE_BLOCK & GetTitleBlock()
Definition: board.h:644
const std::map< wxString, wxString > & GetProperties() const
Definition: board.h:339
void SetProject(PROJECT *aProject, bool aReferenceOnly=false)
Link a board to a given project.
Definition: board.cpp:178
const wxString & GetFileName() const
Definition: board.h:307
void SetElementVisibility(GAL_LAYER_ID aLayer, bool aNewState)
Change the visibility of an element category.
Definition: board.cpp:683
void ClearProject()
Definition: board.cpp:217
PROJECT * GetProject() const
Definition: board.h:448
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:728
void UpdateRatsnestExclusions()
Update the visibility flags on the current unconnected ratsnest lines.
Definition: board.cpp:275
void SetColor(int aLayer, const COLOR4D &aColor)
COLOR4D GetColor(int aLayer) const
COMMIT & Remove(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Notify observers that aItem has been removed.
Definition: commit.h:91
COMMIT & Add(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Notify observers that aItem has been added.
Definition: commit.h:79
Handle actions that are shared between different applications.
Handles action that are shared between different applications.
Definition: common_tools.h:38
static std::mutex g_Mutex
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:40
int ShowQuasiModal()
Tool responsible for drawing graphical elements like lines, arcs, circles, etc.
Definition: drawing_tool.h:51
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)
Changes the sheet-count number displayed in the title block.
void SetPageNumber(const std::string &aPageNumber)
Changes 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
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)
static wxString GetAutoSaveFilePrefix()
WX_INFOBAR * GetInfoBar()
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.
KIGFX::GAL_DISPLAY_OPTIONS & GetGalDisplayOptions()
Return a reference to the gal rendering options used by GAL for rendering.
virtual void SwitchCanvas(EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType)
Changes 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.
virtual wxString GetScreenDesc() const
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.
void OnGridSettings(wxCommandEvent &event)
SEARCH_PANE * m_searchPane
The current canvas type.
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:85
const KIID m_Uuid
Definition: eda_item.h:475
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:97
void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: eda_item.h:125
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:100
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:72
const EDA_ANGLE & GetTextAngle() const
Definition: eda_text.h:123
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:87
void SetAttributes(const EDA_TEXT &aSrc)
Set the text attributes from another instance.
Definition: eda_text.cpp:276
virtual bool IsVisible() const
Definition: eda_text.h:139
GR_TEXT_H_ALIGN_T GetHorizJustify() const
Definition: eda_text.h:152
virtual void SetVisible(bool aVisible)
Definition: eda_text.cpp:229
GR_TEXT_V_ALIGN_T GetVertJustify() const
Definition: eda_text.h:155
virtual void SetText(const wxString &aText)
Definition: eda_text.cpp:175
int GetTextThickness() const
Definition: eda_text.h:115
VECTOR2I GetTextSize() const
Definition: eda_text.h:199
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 UndoAvailable()
Create a functor that tests if there are any items in the undo 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 FullscreenCursor()
Create a functor testing if the cursor is full screen in a frame.
The interactive edit tool.
Definition: edit_tool.h:65
ENUM_MAP & Map(T aValue, const wxString &aName)
Definition: property.h:633
static ENUM_MAP< T > & Instance()
Definition: property.h:627
ENUM_MAP & Undefined(T aValue)
Definition: property.h:640
wxPGChoices & Choices()
Definition: property.h:676
Component library viewer main window.
void SetPosition(const VECTOR2I &aPos) override
Definition: footprint.cpp:1656
void SetLocked(bool isLocked) override
Set the #MODULE_is_LOCKED bit in the m_ModuleStatus.
Definition: footprint.h:352
EDA_ANGLE GetOrientation() const
Definition: footprint.h:193
void SetOrientation(const EDA_ANGLE &aNewAngle)
Definition: footprint.cpp:1728
void SetPath(const KIID_PATH &aPath)
Definition: footprint.h:227
PCB_TEXT & Value()
read/write accessors:
Definition: footprint.h:569
void SetAttributes(int aAttributes)
Definition: footprint.h:253
int GetAttributes() const
Definition: footprint.h:252
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
Definition: footprint.h:202
PADS & Pads()
Definition: footprint.h:172
const LIB_ID & GetFPID() const
Definition: footprint.h:214
bool IsLocked() const override
Definition: footprint.h:342
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
Definition: footprint.cpp:568
PCB_TEXT & Reference()
Definition: footprint.h:570
std::vector< FP_3DMODEL > & Models()
Definition: footprint.h:186
void Flip(const VECTOR2I &aCentre, bool aFlipLeftRight) override
Flip this object, i.e.
Definition: footprint.cpp:1596
const wxString & GetValue() const
Definition: footprint.h:549
void SetProperties(const std::map< wxString, wxString > &aProps)
Definition: footprint.h:577
const KIID_PATH & GetPath() const
Definition: footprint.h:226
VECTOR2I GetPosition() const override
Definition: footprint.h:190
DRAWINGS & GraphicalItems()
Definition: footprint.h:175
PAD * FindPadByNumber(const wxString &aPadNumber, PAD *aSearchAfterMe=nullptr) const
Return a PAD with a matching number.
Definition: footprint.cpp:1187
const std::map< wxString, wxString > & GetProperties() const
Definition: footprint.h:576
bool Contains(GAL_LAYER_ID aPos)
Definition: layer_ids.h:333
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
Definition: ki_exception.h:76
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:103
void ReadWindowSettings(WINDOW_SETTINGS &aCfg)
Read GAL config options from application-level config.
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.
Contains methods for drawing PCB-specific items.
Definition: pcb_painter.h:156
virtual PCB_RENDER_SETTINGS * GetSettings() override
Return a pointer to current settings that are going to be used when drawing items.
Definition: pcb_painter.h:161
PCB specific render settings.
Definition: pcb_painter.h:70
void LoadDisplayOptions(const PCB_DISPLAY_OPTIONS &aOptions)
Load settings related to display options (high-contrast mode, full or outline modes for vias/pads/tra...
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:92
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:77
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:69
double GetScale() const
Definition: view.h:269
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:1608
void SetLayerVisible(int aLayer, bool aVisible=true)
Control the visibility of a particular layer.
Definition: view.h:393
bool IsMirroredX() const
Return true if view is flipped across the X axis.
Definition: view.h:243
void UpdateAllItems(int aUpdateFlags)
Update all items in the view according to the given flags.
Definition: view.cpp:1501
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
Definition: view.h:213
void MarkTargetDirty(int aTarget)
Set or clear target 'dirty' flag.
Definition: view.h:617
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:1511
An implementation of class VIEW_CONTROLS for wxWidgets library.
std::unique_ptr< PROF_COUNTER > m_MotionEventCounter
Definition: kiid.h:48
A wxFrame capable of the OpenProjectFiles function, meaning it can load a portion of a KiCad project.
Definition: kiway_player.h:66
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:118
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:279
void OnKiCadExit()
Definition: kiway.cpp:733
virtual void CommonSettingsChanged(bool aEnvVarsChanged, bool aTextVarsChanged)
Call CommonSettingsChanged() on all KIWAY_PLAYERs.
Definition: kiway.cpp:633
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
Definition: kiway.cpp:432
virtual void ExpressMail(FRAME_T aDestination, MAIL_T aCommand, std::string &aPayload, wxWindow *aSource=nullptr)
Send aPayload to aDestination from aSource.
Definition: kiway.cpp:549
int SetLayerSelection(int layer)
const UTF8 & GetLibItemName() const
Definition: lib_id.h:102
LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.
Definition: layer_ids.h:497
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:536
static LSET AllLayersMask()
Definition: lset.cpp:808
LSEQ Seq(const PCB_LAYER_ID *aWishListSequence, unsigned aCount) const
Return an LSEQ from the union of this LSET and a desired sequence.
Definition: lset.cpp:411
static const wxChar * Name(PCB_LAYER_ID aLayerId)
Return the fixed name association with aLayerId.
Definition: lset.cpp:82
@ MARKER_DRAWING_SHEET
Definition: marker_base.h:55
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:387
Store information read from a netlist along with the flags used to update the NETLIST in the BOARD.
Definition: pcb_netlist.h:213
Tool relating to pads and pad settings.
Definition: pad_tool.h:37
Definition: pad.h:59
const wxString & GetPinType() const
Definition: pad.h:152
const wxString & GetPinFunction() const
Definition: pad.h:146
bool IsOnCopperLayer() const override
Definition: pad.cpp:769
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:54
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:49
static TOOL_ACTION toggleHV45Mode
Definition: pcb_actions.h:467
static TOOL_ACTION drawRuleArea
Definition: pcb_actions.h:185
static TOOL_ACTION microwaveCreateGap
Definition: pcb_actions.h:456
static TOOL_ACTION placeText
Definition: pcb_actions.h:176
static TOOL_ACTION pointEditorArcKeepCenter
Definition: pcb_actions.h:248
static TOOL_ACTION drawOrthogonalDimension
Definition: pcb_actions.h:181
static TOOL_ACTION drawRectangle
Definition: pcb_actions.h:172
static TOOL_ACTION padDisplayMode
Definition: pcb_actions.h:280
static TOOL_ACTION showRatsnest
Definition: pcb_actions.h:275
static TOOL_ACTION showLayersManager
Definition: pcb_actions.h:390
static TOOL_ACTION toggleNetHighlight
Definition: pcb_actions.h:501
static TOOL_ACTION drawCircle
Definition: pcb_actions.h:173
static TOOL_ACTION routeDiffPair
Activation of the Push and Shove router (differential pair mode)
Definition: pcb_actions.h:211
static TOOL_ACTION placeImage
Definition: pcb_actions.h:175
static TOOL_ACTION layerChanged
Definition: pcb_actions.h:328
static TOOL_ACTION ddAppendBoard
Drag and drop.
Definition: pcb_actions.h:530
static TOOL_ACTION highlightNet
Definition: pcb_actions.h:499
static TOOL_ACTION routerTuneDiffPair
Activation of the Push and Shove router (diff pair tuning mode)
Definition: pcb_actions.h:217
static TOOL_ACTION drawTextBox
Definition: pcb_actions.h:177
static TOOL_ACTION routerHighlightMode
Actions to enable switching modes via hotkey assignments.
Definition: pcb_actions.h:236
static TOOL_ACTION routerWalkaroundMode
Definition: pcb_actions.h:238
static TOOL_ACTION routerShoveMode
Definition: pcb_actions.h:237
static TOOL_ACTION drawZoneCutout
Definition: pcb_actions.h:186
static TOOL_ACTION drawPolygon
Definition: pcb_actions.h:171
static TOOL_ACTION hideNetInRatsnest
Definition: pcb_actions.h:506
static TOOL_ACTION group
Definition: pcb_actions.h:475
static TOOL_ACTION zoneDisplayFilled
Definition: pcb_actions.h:282
static TOOL_ACTION showNetInRatsnest
Definition: pcb_actions.h:507
static TOOL_ACTION drawRadialDimension
Definition: pcb_actions.h:180
static TOOL_ACTION showProperties
Definition: pcb_actions.h:391
static TOOL_ACTION routerTuneDiffPairSkew
Activation of the Push and Shove router (skew tuning mode)
Definition: pcb_actions.h:220
static TOOL_ACTION zoneFill
Definition: pcb_actions.h:343
static TOOL_ACTION viaDisplayMode
Definition: pcb_actions.h:281
static TOOL_ACTION drawLeader
Definition: pcb_actions.h:182
static TOOL_ACTION zoneUnfill
Definition: pcb_actions.h:346
static TOOL_ACTION drillOrigin
Definition: pcb_actions.h:485
static TOOL_ACTION routerTuneSingleTrace
Activation of the Push and Shove router (tune single line mode)
Definition: pcb_actions.h:214
static TOOL_ACTION trackDisplayMode
Definition: pcb_actions.h:279
static TOOL_ACTION microwaveCreateStubArc
Definition: pcb_actions.h:460
static TOOL_ACTION zoneDisplayTriangulated
Definition: pcb_actions.h:285
static TOOL_ACTION ungroup
Definition: pcb_actions.h:476
static TOOL_ACTION selectUnconnected
Select unconnected footprints from ratsnest of selection.
Definition: pcb_actions.h:92
static TOOL_ACTION zoneDisplayFractured
Definition: pcb_actions.h:284
static TOOL_ACTION drawVia
Definition: pcb_actions.h:184
static TOOL_ACTION drawArc
Definition: pcb_actions.h:174
static TOOL_ACTION zoneDuplicate
Duplicate zone onto another layer.
Definition: pcb_actions.h:351
static TOOL_ACTION graphicsOutlines
Display footprint graphics as outlines.
Definition: pcb_actions.h:439
static TOOL_ACTION pluginsReload
Scripting Actions.
Definition: pcb_actions.h:354
static TOOL_ACTION drawSimilarZone
Definition: pcb_actions.h:187
static TOOL_ACTION pointEditorArcKeepEndpoint
Definition: pcb_actions.h:249
static TOOL_ACTION boardSetup
Definition: pcb_actions.h:358
static TOOL_ACTION drawCenterDimension
Definition: pcb_actions.h:179
static TOOL_ACTION selectSameSheet
Select all components on the same sheet as the selected footprint.
Definition: pcb_actions.h:101
static TOOL_ACTION microwaveCreateStub
Definition: pcb_actions.h:458
static TOOL_ACTION selectNet
Select all connections belonging to a single net.
Definition: pcb_actions.h:86
static TOOL_ACTION microwaveCreateLine
Definition: pcb_actions.h:464
static TOOL_ACTION flipBoard
Definition: pcb_actions.h:330
static TOOL_ACTION zoneDisplayOutline
Definition: pcb_actions.h:283
static TOOL_ACTION ratsnestLineMode
Definition: pcb_actions.h:276
static TOOL_ACTION textOutlines
Display texts as lines.
Definition: pcb_actions.h:442
static TOOL_ACTION highlightNetSelection
Definition: pcb_actions.h:502
static TOOL_ACTION microwaveCreateFunctionShape
Definition: pcb_actions.h:462
static TOOL_ACTION zoneMerge
Definition: pcb_actions.h:348
static TOOL_ACTION unlock
Definition: pcb_actions.h:472
static TOOL_ACTION placeFootprint
Definition: pcb_actions.h:190
static TOOL_ACTION routeSingleTrack
Activation of the Push and Shove router.
Definition: pcb_actions.h:208
static TOOL_ACTION deselectNet
Remove all connections belonging to a single net from the active selection.
Definition: pcb_actions.h:89
static TOOL_ACTION showPythonConsole
Definition: pcb_actions.h:392
static TOOL_ACTION drawLine
Definition: pcb_actions.h:170
static TOOL_ACTION localRatsnestTool
Definition: pcb_actions.h:508
static TOOL_ACTION drawAlignedDimension
Definition: pcb_actions.h:178
static TOOL_ACTION drawZone
Definition: pcb_actions.h:183
static TOOL_ACTION selectOnSchematic
Select symbols/pins on schematic corresponding to selected footprints/pads.
Definition: pcb_actions.h:104
static TOOL_ACTION lock
Definition: pcb_actions.h:471
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.
APPEARANCE_CONTROLS * GetAppearancePanel()
APPEARANCE_CONTROLS * m_appearancePanel
PANEL_SELECTION_FILTER * m_selectionFilterPanel
PROPERTIES_PANEL * m_propertiesPanel
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.
void RemoveBoardChangeListener(wxEvtHandler *aListener)
Remove aListener to from the board changed listener list.
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 ...
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
Returns the BOARD_DESIGN_SETTINGS for the open project.
void AddBoardChangeListener(wxEvtHandler *aListener)
Add aListener to post #EDA_EVT_BOARD_CHANGED command events to.
virtual void SetPlotSettings(const PCB_PLOT_PARAMS &aSettings)
void PlaceFootprint(FOOTPRINT *aFootprint, bool aRecreateRatsnest=true)
Places aFootprint at the current cursor position and updates footprint coordinates with the new posit...
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
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.
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
int TestStandalone(void)
Test if standalone mode.
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 RecordDRCExclusions()
Scan existing markers and record data from any that are Excluded.
void SetElementVisibility(GAL_LAYER_ID aElement, bool aNewState)
Change the visibility of an element category.
DIALOG_BOOK_REPORTER * m_inspectDrcErrorDlg
void OnClearFileHistory(wxCommandEvent &aEvent)
void onUnitsChanged(wxCommandEvent &aEvent)
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.
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.
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.
bool Clear_Pcb(bool aQuery, bool aFinal=false)
Delete all and reinitialize the current board.
Definition: initpcb.cpp:43
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)
void onCloseNetInspectorDialog(wxCommandEvent &aEvent)
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.
DIALOG_NET_INSPECTOR * GetNetInspectorDialog()
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 ExportSVG(wxCommandEvent &event)
Show the Export to SVG file dialog.
void RecreateCmpFileFromBoard(wxCommandEvent &aEvent)
Recreates a .cmp file from the current loaded board.
DIALOG_BOOK_REPORTER * GetFootprintDiffDialog()
EDA_ANGLE GetRotationAngle() const override
Return the angle used for rotate operations.
COLOR4D GetGridColor() override
void Files_io(wxCommandEvent &event)
Call Files_io_from_id with the wxCommandEvent id.
void UpdateTitle()
Set the main window title bar text.
DIALOG_BOOK_REPORTER * m_footprintDiffDlg
void ExchangeFootprint(FOOTPRINT *aExisting, FOOTPRINT *aNew, BOARD_COMMIT &aCommit, bool deleteExtraTexts=true, bool resetTextLayers=true, bool resetTextEffects=true, bool resetFabricationAttrs=true, bool reset3DModels=true, bool *aUpdated=nullptr)
Replace aExisting footprint by aNew footprint using the Existing footprint settings (position,...
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:49
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_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.
void redrawNetnames(wxTimerEvent &aEvent)
static const wxString SearchPaneName()
DIALOG_BOOK_REPORTER * m_inspectClearanceDlg
DIALOG_NET_INSPECTOR * m_netInspectorDlg
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:51
bool RemoveItem(BOARD_ITEM *aItem)
Remove item from group.
Definition: pcb_group.cpp:86
bool AddItem(BOARD_ITEM *aItem)
Add item to group.
Definition: pcb_group.cpp:71
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.
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.
Tool useful for viewing footprints.
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:65
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:155
virtual PROJECT_FILE & GetProjectFile() const
Definition: project.h:149
float SplitterProportion() const
Action handler for the Properties panel.
PNS::PNS_MODE GetRouterMode()
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 SELECTION_CONDITION HasType(KICAD_T aType)
Create a functor that tests if among the selected items there is at least one of a given type.
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:208
int Size() const
Returns the number of selected parts.
Definition: selection.h:115
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:170
TOOL_DISPATCHER * m_toolDispatcher
Definition: tools_holder.h:172
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
Definition: tools_holder.h:54
ACTIONS * m_actions
Definition: tools_holder.h:171
Represent a single user action.
Definition: tool_action.h:68
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:156
void SetHasPosition(bool aHasPosition)
Returns if the action associated with this event should be treated as immediate regardless of the cur...
Definition: tool_event.h:244
Master controller class:
Definition: tool_manager.h:55
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagate an event to tools that requested events of matching type(s).
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:142
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:196
void ResetTools(TOOL_BASE::RESET_REASON aReason)
Reset all tools (i.e.
std::vector< TOOL_BASE * > Tools()
Definition: tool_manager.h:231
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()
Initializes all registered tools.
void ShutdownAllTools()
Shutdown all tools with a currently registered event loop in this tool manager by waking them up with...
A modified version of the wxInfoBar class that allows us to:
Definition: wx_infobar.h:75
void RemoveAllButtons()
Remove all the buttons that have been added by the user.
Definition: wx_infobar.cpp:301
@ 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:291
void ShowMessage(const wxString &aMessage, int aFlags=wxICON_INFORMATION) override
Show the info bar with the provided message and icon.
Definition: wx_infobar.cpp:154
Handle actions specific to filling copper zones.
PROGRESS_REPORTER * GetProgressReporter()
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:283
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:243
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition: confirm.cpp:308
This file is part of the common library.
#define CHECK(x)
#define ENABLE(x)
#define DIALOG_DRC_WINDOW_NAME
Definition: dialog_drc.h:41
bool InvokeExportSVG(PCB_EDIT_FRAME *aCaller, BOARD *aBoard)
Function InvokeExportSVG shows the Export SVG dialog.
#define _HKI(x)
#define _(s)
Declaration of the eda_3d_viewer class.
static constexpr EDA_ANGLE & ANGLE_90
Definition: eda_angle.h:431
#define KICAD_DEFAULT_DRAWFRAME_STYLE
#define PCB_EDIT_FRAME_NAME
GERBVIEW_FRAME::OnZipFileHistory GERBVIEW_FRAME::OnSelectDisplayMode EVT_CHOICE(ID_GBR_AUX_TOOLBAR_PCB_APERATTRIBUTES_CHOICE, GERBVIEW_FRAME::OnSelectHighlightChoice) EVT_UPDATE_UI(ID_TOOLBARH_GERBVIEW_SELECT_ACTIVE_LAYER
KiCad executable names.
const wxString EESCHEMA_EXE
bool ExportBoardToHyperlynx(BOARD *aBoard, const wxFileName &aPath)
@ FP_ALLOW_SOLDERMASK_BRIDGES
Definition: footprint.h:75
EVT_UPDATE_UI(ID_LOAD_FOOTPRINT_FROM_BOARD, FOOTPRINT_EDIT_FRAME::OnUpdateLoadFootprintFromBoard) EVT_UPDATE_UI(ID_ADD_FOOTPRINT_TO_BOARD
#define CURRENT_EDIT_TOOL(action)
@ FRAME_PCB_EDITOR
Definition: frame_type.h:40
@ FRAME_FOOTPRINT_VIEWER_MODAL
Definition: frame_type.h:43
@ FRAME_FOOTPRINT_VIEWER
Definition: frame_type.h:42
@ FRAME_SCH
Definition: frame_type.h:34
@ FRAME_FOOTPRINT_EDITOR
Definition: frame_type.h:41
@ ID_MAIN_MENUBAR
Definition: gerbview_id.h:38
int ExecuteFile(const wxString &aEditorName, const wxString &aFileName, wxProcess *aCallback)
Call the executable file aEditorName with the parameter aFileName.
Definition: gestfich.cpp:117
bool m_ShowEventCounters
Shows debugging event counters in various places.
const std::string LegacyPcbFileExtension
const std::string LegacySchematicFileExtension
const std::string KiCadPcbFileExtension
const std::string KiCadSchematicFileExtension
const wxChar *const traceAutoSave
Flag to enable auto save feature debug tracing.
@ ID_ON_GRID_SELECT
Definition: id.h:145
@ ID_GEN_PLOT_DXF
Definition: id.h:96
@ ID_FILE_LIST_CLEAR
Definition: id.h:87
@ ID_EDA_SOCKET_EVENT
Definition: id.h:164
@ ID_GEN_PLOT_PS
Definition: id.h:92
@ ID_EDA_SOCKET_EVENT_SERV
Definition: id.h:163
@ ID_GEN_PLOT_GERBER
Definition: id.h:94
@ ID_ON_ZOOM_SELECT
Definition: id.h:143
@ ID_GEN_PLOT
Definition: id.h:91
@ ID_GEN_PLOT_SVG
Definition: id.h:95
@ ID_GEN_PLOT_HPGL
Definition: id.h:93
@ ID_FILEMAX
Definition: id.h:85
@ ID_FILE1
Definition: id.h:84
@ ID_GRID_SETTINGS
Definition: id.h:146
@ ID_GEN_PLOT_PDF
Definition: id.h:97
@ ID_AUTO_SAVE_TIMER
Definition: id.h:79
std::map< wxString, ENV_VAR_ITEM > ENV_VAR_MAP
PROJECT & Prj()
Definition: kicad.cpp:575
KIWAY Kiway
int GetNetnameLayer(int aLayer)
Returns a netname layer corresponding to the given layer.
Definition: layer_ids.h:972
GAL_LAYER_ID
GAL layers are "virtual" layers, i.e.
Definition: layer_ids.h:190
@ LAYER_GRID
Definition: layer_ids.h:205
@ LAYER_ZONES
Control for copper zone opacity/visibility (color ignored)
Definition: layer_ids.h:231
@ LAYER_RATSNEST
Definition: layer_ids.h:204
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:59
@ F_Paste
Definition: layer_ids.h:101
@ B_Mask
Definition: layer_ids.h:106
@ B_Cu
Definition: layer_ids.h:95
@ F_Mask
Definition: layer_ids.h:107
@ B_Paste
Definition: layer_ids.h:100
@ UNDEFINED_LAYER
Definition: layer_ids.h:60
@ F_Cu
Definition: layer_ids.h:64
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
Definition: macros.h:96
@ MAIL_SCH_GET_NETLIST
Definition: mail_type.h:49
@ REPAINT
Item needs to be redrawn.
Definition: view_item.h:52
@ GEOMETRY
Position or shape has changed.
Definition: view_item.h:49
@ ALL
All except INITIAL_ADD.
Definition: view_item.h:53
@ TARGET_NONCACHED
Auxiliary rendering target (noncached)
Definition: definitions.h:49
void SetShutdownBlockReason(wxWindow *aWindow, const wxString &aReason)
Sets the block reason why the window/application is preventing OS shutdown.
Definition: gtk/app.cpp:83
bool SupportsShutdownBlockReason()
Whether or not the window supports setting a shutdown block reason.
Definition: gtk/app.cpp:72
@ RM_MarkObstacles
Ignore collisions, mark obstacles.
@ RM_Walkaround
Only walk around.
@ RM_Shove
Only shove.
#define FOOTPRINT_DIFF_DIALOG_NAME
EVT_MENU_RANGE(ID_POPUP_PCB_SELECT_WIDTH_START_RANGE, ID_POPUP_PCB_SELECT_WIDTH_END_RANGE, PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event) EVT_UPDATE_UI_RANGE(ID_POPUP_PCB_SELECT_WIDTH1
ID_POPUP_PCB_SELECT_WIDTH8
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
Class to handle a set of BOARD_ITEMs.
@ 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 Refresh()
Update the board display after modifying it by a python script (note: it is automatically called by a...
@ SHOW_WITH_VIA_ALWAYS
see class PGM_BASE
#define PROJECT_VAR_NAME
A variable name whose value holds the current project directory.
Definition: project.h:39
LAST_PATH_TYPE
For storing PcbNew MRU paths of various types.
Definition: project_file.h:47
@ RPT_SEVERITY_EXCLUSION
#define CURRENT_TOOL(action)
#define SKIP_SET_DIRTY
#define SKIP_UNDO
std::function< bool(const SELECTION &)> SELECTION_CONDITION
< Functor type that checks a specific condition for selected items.
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:115
const int scale
wxString UnescapeString(const wxString &aSource)
const double IU_PER_MILS
Definition: base_units.h:78
A filename or source description, a problem input line, a line number, a byte offset,...
Definition: ki_exception.h:119
TRACK_CLEARANCE_MODE m_TrackClearance
@ AS_GLOBAL
Global action (toolbar/main menu event, global shortcut)
Definition: tool_action.h:45
@ AS_ACTIVE
All active tools.
Definition: tool_action.h:44
@ TA_MODEL_CHANGE
Definition: tool_event.h:116
@ TC_COMMAND
Definition: tool_event.h:52
wxLogTrace helper definitions.
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:93
@ PCB_GROUP_T
class PCB_GROUP, a set of BOARD_ITEMs
Definition: typeinfo.h:106
@ PCB_ZONE_T
class ZONE, a copper pour area
Definition: typeinfo.h:103
@ PCB_TEXT_T
class PCB_TEXT, text on a layer
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:94
@ PCB_TRACE_T
class PCB_TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:92
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.