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