KiCad PCB EDA Suite
Loading...
Searching...
No Matches
sch_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) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 */
20
21#include <algorithm>
22#include <api/api_handler_sch.h>
23#include <api/api_server.h>
24#include <base_units.h>
25#include <bitmaps.h>
26#include <confirm.h>
27#include <connection_graph.h>
29#include <dialogs/dialog_erc.h>
35#include <wx/srchctrl.h>
36#include <mail_type.h>
37#include <wx/clntdata.h>
38#include <wx/panel.h>
39#include <wx/sizer.h>
40#include <wx/menu.h>
44#include <api/api_utils.h>
45#include <local_history.h>
46#include <eeschema_id.h>
47#include <executable_names.h>
50#include <gestfich.h>
52#include <string_utils.h>
53#include <kiface_base.h>
54#include <kiplatform/app.h>
55#include <kiplatform/ui.h>
56#include <kiway.h>
57#include <symbol_edit_frame.h>
58#include <symbol_viewer_frame.h>
59#include <pgm_base.h>
60#include <core/profile.h>
63#include <sch_edit_frame.h>
65#include <sch_painter.h>
66#include <sch_marker.h>
67#include <sch_sheet_pin.h>
68#include <sch_commit.h>
69#include <sch_rule_area.h>
72#include <advanced_config.h>
74#include <sim/simulator_frame.h>
75#include <tool/action_manager.h>
76#include <tool/action_toolbar.h>
77#include <tool/common_control.h>
78#include <tool/common_tools.h>
79#include <tool/embed_tool.h>
80#include <tool/picker_tool.h>
82#include <tool/selection.h>
84#include <tool/tool_manager.h>
85#include <tool/zoom_tool.h>
86#include <tools/sch_actions.h>
94#include <sch_io/sch_io_mgr.h>
95#include <sch_io/sch_io.h>
97#include <tools/sch_edit_tool.h>
101#include <tools/sch_group_tool.h>
103#include <tools/sch_move_tool.h>
107#include <trace_helpers.h>
108#include <unordered_set>
109#include <view/view_controls.h>
110#include <widgets/wx_infobar.h>
117#include <wx/cmdline.h>
118#include <wx/app.h>
119#include <wx/filedlg.h>
120#include <wx/socket.h>
121#include <wx/debug.h>
123#include <widgets/wx_aui_utils.h>
126#include <toolbars_sch_editor.h>
127#include <wx/log.h>
128#include <wx/choicdlg.h>
129#include <wx/textdlg.h>
130#include <wx/generic/treectlg.h>
131
132
133#define DIFF_SYMBOLS_DIALOG_NAME wxT( "DiffSymbolsDialog" )
134
135
136BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, SCH_BASE_FRAME )
139
140 EVT_SIZE( SCH_EDIT_FRAME::OnSize )
141
144
145 EVT_MENU( wxID_EXIT, SCH_EDIT_FRAME::OnExit )
146 EVT_MENU( wxID_CLOSE, SCH_EDIT_FRAME::OnExit )
147
150
151 // Drop files event
152 EVT_DROP_FILES( SCH_EDIT_FRAME::OnDropFiles )
153END_EVENT_TABLE()
154
155
156wxDEFINE_EVENT( EDA_EVT_SCHEMATIC_CHANGING, wxCommandEvent );
157wxDEFINE_EVENT( EDA_EVT_SCHEMATIC_CHANGED, wxCommandEvent );
158
159
160SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
161 SCH_BASE_FRAME( aKiway, aParent, FRAME_SCH, wxT( "Eeschema" ), wxDefaultPosition,
163 m_ercDialog( nullptr ),
164 m_diffSymbolDialog( nullptr ),
165 m_symbolFieldsTableDialog( nullptr ),
166 m_netNavigator( nullptr ),
167 m_netNavigatorFilter( nullptr ),
171 m_designBlocksPane( nullptr ),
172 m_remoteSymbolPane( nullptr ),
173 m_currentVariantCtrl( nullptr )
174{
175 m_maximizeByDefault = true;
176 m_schematic = new SCHEMATIC( &Prj() );
177 m_schematic->SetSchematicHolder( this );
179
180 m_showBorderAndTitleBlock = true; // true to show sheet references
181 m_supportsAutoSave = true;
183 m_aboutTitle = _HKI( "KiCad Schematic Editor" );
184 m_show_search = false;
185 // Ensure timer has an owner before binding so it generates events.
186 m_crossProbeFlashTimer.SetOwner( this );
187 Bind( wxEVT_TIMER, &SCH_EDIT_FRAME::OnCrossProbeFlashTimer, this, m_crossProbeFlashTimer.GetId() );
188
189 // Give an icon
190 wxIcon icon;
191 wxIconBundle icon_bundle;
192
193 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_eeschema, 48 ) );
194 icon_bundle.AddIcon( icon );
195 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_eeschema, 128 ) );
196 icon_bundle.AddIcon( icon );
197 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_eeschema, 256 ) );
198 icon_bundle.AddIcon( icon );
199 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_eeschema_32 ) );
200 icon_bundle.AddIcon( icon );
201 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_eeschema_16 ) );
202 icon_bundle.AddIcon( icon );
203
204 SetIcons( icon_bundle );
205
207
208 setupTools();
211
215
216 // Ensure the "Line modes" toolbar group shows the current angle mode on startup
217 if( GetToolManager() )
219
221
222 m_hierarchy = new HIERARCHY_PANE( this );
223
224 // Initialize common print setup dialog settings.
225 m_pageSetupData.GetPrintData().SetPrintMode( wxPRINT_MODE_PRINTER );
226 m_pageSetupData.GetPrintData().SetQuality( wxPRINT_QUALITY_MEDIUM );
227 m_pageSetupData.GetPrintData().SetBin( wxPRINTBIN_AUTO );
228 m_pageSetupData.GetPrintData().SetNoCopies( 1 );
229
230 m_searchPane = new SCH_SEARCH_PANE( this );
231 m_propertiesPanel = new SCH_PROPERTIES_PANEL( this, this );
233 m_gitCommitPane = new GIT_COMMIT_PANE( this );
234
235 m_propertiesPanel->SetSplitterProportion( eeconfig()->m_AuiPanels.properties_splitter );
236
239
240 m_auimgr.SetManagedWindow( this );
241
243
244 // Fetch a COPY of the config as a lot of these initializations are going to overwrite our
245 // data.
246 EESCHEMA_SETTINGS::AUI_PANELS aui_cfg = eeconfig()->m_AuiPanels;
247 EESCHEMA_SETTINGS::APPEARANCE appearance_cfg = eeconfig()->m_Appearance;
248
249 // Rows; layers 4 - 6
250 m_auimgr.AddPane( m_tbTopMain, EDA_PANE().HToolbar().Name( wxS( "TopMainToolbar" ) )
251 .Top().Layer( 6 ) );
252
253 m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( wxS( "MsgPanel" ) )
254 .Bottom().Layer( 6 ) );
255
256 // Columns; layers 1 - 3
257 m_auimgr.AddPane( m_hierarchy, EDA_PANE().Palette().Name( SchematicHierarchyPaneName() )
258 .Caption( _( "Schematic Hierarchy" ) )
259 .Left().Layer( 3 ).Position( 1 )
260 .TopDockable( false )
261 .BottomDockable( false )
262 .CloseButton( true )
263 .MinSize( FromDIP( wxSize( 120, 60 ) ) )
264 .BestSize( FromDIP( wxSize( 200, 200 ) ) )
265 .FloatingSize( FromDIP( wxSize( 200, 200 ) ) )
266 .FloatingPosition( FromDIP( wxPoint( 50, 50 ) ) )
267 .Show( false ) );
268
271
274
276
277 m_auimgr.AddPane( m_tbLeft, EDA_PANE().VToolbar().Name( wxS( "LeftToolbar" ) )
278 .Left().Layer( 2 ) );
279
280 m_auimgr.AddPane( m_tbRight, EDA_PANE().VToolbar().Name( wxS( "RightToolbar" ) )
281 .Right().Layer( 2 ) );
282
283 // Center
284 m_auimgr.AddPane( GetCanvas(), EDA_PANE().Canvas().Name( wxS( "DrawFrame" ) )
285 .Center() );
286
287 m_auimgr.AddPane( m_searchPane, EDA_PANE()
288 .Name( SearchPaneName() )
289 .Bottom()
290 .Caption( _( "Search" ) )
291 .PaneBorder( false )
292 .MinSize( FromDIP( wxSize( 180, 60 ) ) )
293 .BestSize( FromDIP( wxSize( 180, 100 ) ) )
294 .FloatingSize( FromDIP( wxSize( 480, 200 ) ) )
295 .CloseButton( true )
296 .DestroyOnClose( false )
297 .Show( m_show_search ) );
298
299 m_auimgr.AddPane( m_gitCommitPane,
300 EDA_PANE()
301 .Name( GitCommitPaneName() )
302 .Right()
303 .Layer( 5 )
304 .Caption( _( "Version Control" ) )
305 .PaneBorder( false )
306 .MinSize( wxSize( m_gitCommitPane->GetMinDockWidth(), FromDIP( 120 ) ) )
307 .BestSize( wxSize( std::max( m_gitCommitPane->GetMinDockWidth(), FromDIP( 300 ) ),
308 FromDIP( 300 ) ) )
309 .FloatingSize( FromDIP( wxSize( 300, 400 ) ) )
310 .DestroyOnClose( false )
311 .CloseButton( true )
312 .Hide() );
313
315
316 // A saved layout brings its own minimum, so the one the panel needs is set again.
317 m_auimgr.GetPane( GitCommitPaneName() ).min_size.x = m_gitCommitPane->GetMinDockWidth();
319
320 wxAuiPaneInfo& hierarchy_pane = m_auimgr.GetPane( SchematicHierarchyPaneName() );
321 wxAuiPaneInfo& netNavigatorPane = m_auimgr.GetPane( NetNavigatorPaneName() );
322 wxAuiPaneInfo& propertiesPane = m_auimgr.GetPane( PropertiesPaneName() );
323 wxAuiPaneInfo& selectionFilterPane = m_auimgr.GetPane( wxS( "SelectionFilter" ) );
324 wxAuiPaneInfo& designBlocksPane = m_auimgr.GetPane( DesignBlocksPaneName() );
325 wxAuiPaneInfo& remoteSymbolPane = m_auimgr.GetPane( RemoteSymbolPaneName() );
326
327 hierarchy_pane.Show( aui_cfg.show_schematic_hierarchy );
328 netNavigatorPane.Show( aui_cfg.show_net_nav_panel );
329 propertiesPane.Show( aui_cfg.show_properties );
330 designBlocksPane.Show( aui_cfg.design_blocks_show );
331 m_auimgr.GetPane( GitCommitPaneName() ).Show( aui_cfg.show_git_commit_pane );
332
333 if( m_remoteSymbolPane && !m_remoteSymbolPane->HasDataSources() )
334 remoteSymbolPane.Show( false );
335 else
336 remoteSymbolPane.Show( aui_cfg.remote_symbol_show );
337
339
340 // The selection filter doesn't need to grow in the vertical direction when docked
341 selectionFilterPane.dock_proportion = 0;
342
343 // wx 3.3.3 turns a -1 min height into 1, and a legacy perspective restores one
344 selectionFilterPane.min_size.y = m_selectionFilterPanel->GetBestSize().y;
345
346 if( aui_cfg.hierarchy_panel_float_width > 0 && aui_cfg.hierarchy_panel_float_height > 0 )
347 {
348 // Show at end, after positioning
349 hierarchy_pane.FloatingSize( aui_cfg.hierarchy_panel_float_width,
351 }
352
353 if( aui_cfg.net_nav_panel_float_size.GetWidth() > 0
354 && aui_cfg.net_nav_panel_float_size.GetHeight() > 0 )
355 {
356 netNavigatorPane.FloatingSize( aui_cfg.net_nav_panel_float_size );
357 netNavigatorPane.FloatingPosition( aui_cfg.net_nav_panel_float_pos );
358 }
359
360 if( aui_cfg.properties_panel_width > 0 )
361 SetAuiPaneSize( m_auimgr, propertiesPane, aui_cfg.properties_panel_width, -1 );
362
363 if( aui_cfg.schematic_hierarchy_float )
364 hierarchy_pane.Float();
365
366 if( aui_cfg.search_panel_height > 0 && ( aui_cfg.search_panel_dock_direction == wxAUI_DOCK_TOP
367 || aui_cfg.search_panel_dock_direction == wxAUI_DOCK_BOTTOM ) )
368 {
369 wxAuiPaneInfo& searchPane = m_auimgr.GetPane( SearchPaneName() );
370 searchPane.Direction( aui_cfg.search_panel_dock_direction );
371 SetAuiPaneSize( m_auimgr, searchPane, -1, aui_cfg.search_panel_height );
372 }
373
374 else if( aui_cfg.search_panel_width > 0 && ( aui_cfg.search_panel_dock_direction == wxAUI_DOCK_LEFT
375 || aui_cfg.search_panel_dock_direction == wxAUI_DOCK_RIGHT ) )
376 {
377 wxAuiPaneInfo& searchPane = m_auimgr.GetPane( SearchPaneName() );
378 searchPane.Direction( aui_cfg.search_panel_dock_direction );
379 SetAuiPaneSize( m_auimgr, searchPane, aui_cfg.search_panel_width, -1 );
380 }
381
382 if( aui_cfg.float_net_nav_panel )
383 netNavigatorPane.Float();
384
385 if( aui_cfg.design_blocks_show )
386 SetAuiPaneSize( m_auimgr, designBlocksPane, aui_cfg.design_blocks_panel_docked_width, -1 );
387
388 if( aui_cfg.remote_symbol_show )
389 {
390 SetAuiPaneSize( m_auimgr, remoteSymbolPane, aui_cfg.remote_symbol_panel_docked_width, -1 );
391 }
392
393 if( aui_cfg.hierarchy_panel_docked_width > 0 )
394 {
395 // If the net navigator is not show, let the hierarchy navigator take all of the vertical
396 // space.
397 if( !aui_cfg.show_net_nav_panel )
398 {
399 SetAuiPaneSize( m_auimgr, hierarchy_pane, aui_cfg.hierarchy_panel_docked_width, -1 );
400 }
401 else
402 {
403 SetAuiPaneSize( m_auimgr, hierarchy_pane,
406
407 SetAuiPaneSize( m_auimgr, netNavigatorPane,
408 aui_cfg.net_nav_panel_docked_size.GetWidth(),
409 aui_cfg.net_nav_panel_docked_size.GetHeight() );
410 }
411
412 // wxAUI hack: force width by setting MinSize() and then Fixed()
413 // thanks to ZenJu https://github.com/wxWidgets/wxWidgets/issues/13180
414 hierarchy_pane.MinSize( aui_cfg.hierarchy_panel_docked_width, 60 );
415 hierarchy_pane.Fixed();
416 netNavigatorPane.MinSize( aui_cfg.net_nav_panel_docked_size.GetWidth(), 60 );
417 netNavigatorPane.Fixed();
418 m_auimgr.Update();
419
420 // now make it resizable again
421 hierarchy_pane.Resizable();
422 netNavigatorPane.Resizable();
423 m_auimgr.Update();
424
425 // Note: DO NOT call m_auimgr.Update() anywhere after this; it will nuke the size
426 // back to minimum.
427 hierarchy_pane.MinSize( FromDIP( wxSize( 120, 60 ) ) );
428 netNavigatorPane.MinSize( FromDIP( wxSize( 120, 60 ) ) );
429 }
430 else
431 {
432 m_auimgr.Update();
433 }
434
435 CallAfter( [this]()
436 {
437 wxAuiPaneInfo& remotePane = m_auimgr.GetPane( RemoteSymbolPaneName() );
438
439 if( remotePane.IsShown() && m_remoteSymbolPane )
440 m_remoteSymbolPane->Activate();
441 } );
442
444
445 GetCanvas()->GetGAL()->SetAxesEnabled( false );
446
447 KIGFX::SCH_VIEW* view = GetCanvas()->GetView();
448 static_cast<KIGFX::SCH_PAINTER*>( view->GetPainter() )->SetSchematic( m_schematic );
449
452
453 view->SetLayerVisible( LAYER_ERC_ERR, appearance_cfg.show_erc_errors );
454 view->SetLayerVisible( LAYER_ERC_WARN, appearance_cfg.show_erc_warnings );
456 view->SetLayerVisible( LAYER_OP_VOLTAGES, appearance_cfg.show_op_voltages );
457 view->SetLayerVisible( LAYER_OP_CURRENTS, appearance_cfg.show_op_currents );
458
460
462 m_netNavigator->Bind( wxEVT_TREE_SEL_CHANGING, &SCH_EDIT_FRAME::onNetNavigatorSelChanging, this );
463 m_netNavigator->Bind( wxEVT_TREE_SEL_CHANGED, &SCH_EDIT_FRAME::onNetNavigatorSelection, this );
464 m_netNavigator->Bind( wxEVT_SIZE, &SCH_EDIT_FRAME::onResizeNetNavigator, this );
465
466 setupUnits( eeconfig() );
467
468 // Net list generator
470
471 updateTitle();
472 m_toolManager->GetTool<SCH_NAVIGATE_TOOL>()->ResetHistory();
473
474 m_apiHandler = std::make_unique<API_HANDLER_SCH>( this );
477
478 if( Kiface().IsSingle() )
479 {
480 m_apiHandlerCommon = std::make_unique<API_HANDLER_COMMON>();
482 m_apiLibrariesHandler = std::make_unique<API_HANDLER_LIBRARIES>( LIBRARY_TABLE_TYPE::DESIGN_BLOCK );
484 }
485
486 // Default shutdown reason until a file is loaded
487 KIPLATFORM::APP::SetShutdownBlockReason( this, _( "New schematic file is unsaved" ) );
488
489 // Init for dropping files
493 m_acceptedExts.emplace( wxS( "jpeg" ), &SCH_ACTIONS::ddAddImage );
494 m_acceptedExts.emplace( wxS( "dxf" ), &SCH_ACTIONS::ddImportGraphics );
496 DragAcceptFiles( true );
497
498 // Ensure the window is on top
499 Raise();
500
501 // Now that all sizes are fixed, set the initial hierarchy_pane floating position to the
502 // top-left corner of the canvas
503 wxPoint canvas_pos = GetCanvas()->GetScreenPosition();
504 hierarchy_pane.FloatingPosition( canvas_pos.x + 10, canvas_pos.y + 10 );
505
506 Bind( wxEVT_CHOICE, &SCH_EDIT_FRAME::onVariantSelected, this );
507 Bind( EDA_EVT_CLOSE_DIALOG_BOOK_REPORTER, &SCH_EDIT_FRAME::onCloseSymbolDiffDialog, this );
508 Bind( EDA_EVT_CLOSE_ERC_DIALOG, &SCH_EDIT_FRAME::onCloseErcDialog, this );
509 Bind( EDA_EVT_CLOSE_DIALOG_SYMBOL_FIELDS_TABLE, &SCH_EDIT_FRAME::onCloseSymbolFieldsTableDialog, this );
510}
511
512void SCH_EDIT_FRAME::StartCrossProbeFlash( const std::vector<SCH_ITEM*>& aItems )
513{
514 if( !eeconfig()->m_CrossProbing.flash_selection )
515 {
516 wxLogTrace( traceCrossProbeFlash, "StartCrossProbeFlash: aborted (setting disabled) items=%zu", aItems.size() );
517 return;
518 }
519
520 if( aItems.empty() )
521 {
522 wxLogTrace( traceCrossProbeFlash, "StartCrossProbeFlash: aborted (no items)" );
523 return;
524 }
525
527 {
528 wxLogTrace( traceCrossProbeFlash, "StartCrossProbeFlash: restarting existing flash (phase=%d)",
531 }
532
533 wxLogTrace( traceCrossProbeFlash, "StartCrossProbeFlash: starting with %zu items", aItems.size() );
535
536 for( SCH_ITEM* it : aItems )
537 m_crossProbeFlashItems.push_back( it->m_Uuid );
538
541
542 if( !m_crossProbeFlashTimer.GetOwner() )
543 m_crossProbeFlashTimer.SetOwner( this );
544
545 [[maybe_unused]] bool started = m_crossProbeFlashTimer.Start( 500, wxTIMER_CONTINUOUS );
546 wxLogTrace( traceCrossProbeFlash, "StartCrossProbeFlash: timer start=%d id=%d", (int) started,
547 m_crossProbeFlashTimer.GetId() );
548}
549
550
551void SCH_EDIT_FRAME::OnCrossProbeFlashTimer( wxTimerEvent& aEvent )
552{
553 wxLogTrace( traceCrossProbeFlash, "Timer(SCH) fired: phase=%d running=%d items=%zu", m_crossProbeFlashPhase,
555
557 {
558 wxLogTrace( traceCrossProbeFlash, "Timer fired without active flashing or tools (ignored)" );
559 return;
560 }
561
563
564 if( !selTool )
565 return;
566
567 bool prevGuard = m_syncingPcbToSchSelection;
569
570 if( m_crossProbeFlashPhase % 2 == 0 )
571 {
572 selTool->ClearSelection( true );
573 wxLogTrace( traceCrossProbeFlash, "Phase %d: cleared selection", m_crossProbeFlashPhase );
574 }
575 else
576 {
577 for( const KIID& id : m_crossProbeFlashItems )
578 {
579 if( SCH_ITEM* item = Schematic().ResolveItem( id, nullptr, true ) )
580 selTool->AddItemToSel( item, true );
581 }
582
583 wxLogTrace( traceCrossProbeFlash, "Phase %d: restored %zu items", m_crossProbeFlashPhase,
584 m_crossProbeFlashItems.size() );
585 }
586
587 if( GetCanvas() )
588 {
590 wxLogTrace( traceCrossProbeFlash, "Phase %d: forced canvas refresh", m_crossProbeFlashPhase );
591 }
592
593 m_syncingPcbToSchSelection = prevGuard;
595
596 if( m_crossProbeFlashPhase > 6 )
597 {
598 for( const KIID& id : m_crossProbeFlashItems )
599 {
600 if( SCH_ITEM* item = Schematic().ResolveItem( id, nullptr, true ) )
601 selTool->AddItemToSel( item, true );
602 }
603
604 m_crossProbeFlashing = false;
606 wxLogTrace( traceCrossProbeFlash, "Flashing complete. Final selection size=%zu",
607 m_crossProbeFlashItems.size() );
608 }
609}
610
611
613{
614 m_crossProbeFlashing = false;
616
618
619 // Ensure that teardowns without doCloseWindow are fully unregistered
620 if( m_schematic )
622
623 if( Kiface().IsSingle() )
624 {
627 }
628
629 // A forced teardown (wx deletes every top level window at session end) skips doCloseWindow,
630 // leaving live tools. When we SetScreen(nullptr), we dispatch another tool call, potentially
631 // crashing when the frame is gone
632 if( m_toolManager )
633 {
634 GetCanvas()->SetEvtHandlerEnabled( false );
636 m_toolManager->ShutdownAllTools();
637
638 delete m_toolManager;
639 m_toolManager = nullptr;
640 }
641
642 m_hierarchy->Unbind( wxEVT_SIZE, &SCH_EDIT_FRAME::OnResizeHierarchyNavigator, this );
643
644 // Ensure m_canvasType is up to date, to save it in config
646
647 SetScreen( nullptr );
648
649 if( m_schematic )
650 m_schematic->RemoveAllListeners();
651
652 // Canvas outlives m_schematic; detach tracker consumers before delete.
653 if( GetCanvas() && GetCanvas()->GetView() )
655
656 // Delete all items not in draw list before deleting schematic
657 // to avoid dangling pointers stored in these items
660
661 delete m_schematic;
662 m_schematic = nullptr;
663
664 // Close the project if we are standalone, so it gets cleaned up properly
665 if( Kiface().IsSingle() )
666 {
667 try
668 {
669 GetSettingsManager()->UnloadProject( &Prj(), false );
670 }
671 catch( const std::runtime_error& e )
672 {
673 wxFAIL_MSG( wxString::Format( wxT( "Settings exception occurred: %s" ), e.what() ) );
674 }
675 }
676
677 // We passed ownership of these to wxAuiManager.
678 // delete m_hierarchy;
679 // delete m_selectionFilterPanel;
680}
681
682
684{
685 aEvent.Skip();
686
687 // 1st Call: Handle the size update during the first resize event.
689
690 // Defer the second size capture
691 CallAfter( [this]()
692 {
694 } );
695}
696
697
699{
700 // Called when resizing the Hierarchy Navigator panel
701 // Store the current pane size
702 // It allows to retrieve the last defined pane size when switching between
703 // docked and floating pane state
704 // Note: *DO NOT* call m_auimgr.Update() here: it crashes KiCad at least on Windows
705
706 EESCHEMA_SETTINGS* cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
707 wxAuiPaneInfo& hierarchy_pane = m_auimgr.GetPane( SchematicHierarchyPaneName() );
708
709 if( cfg && m_hierarchy->IsShownOnScreen() )
710 {
711 cfg->m_AuiPanels.hierarchy_panel_float_width = hierarchy_pane.floating_size.x;
712 cfg->m_AuiPanels.hierarchy_panel_float_height = hierarchy_pane.floating_size.y;
713
714 // initialize hierarchy_panel_docked_width and best size only if the hierarchy_pane
715 // width is > 0 (i.e. if its size is already set and has meaning)
716 // if it is floating, its size is not initialized (only floating_size is initialized)
717 // initializing hierarchy_pane.best_size is useful when switching to float pane and
718 // after switching to the docked pane, to retrieve the last docked pane width
719 if( hierarchy_pane.rect.width > 50 ) // 50 is a good margin
720 {
721 cfg->m_AuiPanels.hierarchy_panel_docked_width = hierarchy_pane.rect.width;
722 hierarchy_pane.best_size.x = hierarchy_pane.rect.width;
723 }
724 }
725}
726
727
729{
730 // Create the manager and dispatcher & route draw panel events to the dispatcher
732 m_toolManager->SetEnvironment( &Schematic(), GetCanvas()->GetView(),
733 GetCanvas()->GetViewControls(), config(), this );
734 m_actions = new SCH_ACTIONS();
736
737 // Register tools
738 m_toolManager->RegisterTool( new COMMON_CONTROL );
739 m_toolManager->RegisterTool( new COMMON_TOOLS );
740 m_toolManager->RegisterTool( new ZOOM_TOOL );
741 m_toolManager->RegisterTool( new SCH_SELECTION_TOOL );
742 m_toolManager->RegisterTool( new PICKER_TOOL );
743 m_toolManager->RegisterTool( new SCH_DRAWING_TOOLS );
744 m_toolManager->RegisterTool( new EE_GRAPHIC_TOOL );
745 m_toolManager->RegisterTool( new SCH_LINE_WIRE_BUS_TOOL );
746 m_toolManager->RegisterTool( new SCH_MOVE_TOOL );
747 m_toolManager->RegisterTool( new SCH_ALIGN_TOOL );
748 m_toolManager->RegisterTool( new SCH_EDIT_TOOL );
749 m_toolManager->RegisterTool( new SCH_EDIT_TABLE_TOOL );
750 m_toolManager->RegisterTool( new SCH_GROUP_TOOL );
751 m_toolManager->RegisterTool( new SCH_INSPECTION_TOOL );
752 m_toolManager->RegisterTool( new SCH_DESIGN_BLOCK_CONTROL );
753 m_toolManager->RegisterTool( new SCH_EDITOR_CONTROL );
754 m_toolManager->RegisterTool( new SCH_FIND_REPLACE_TOOL );
755 m_toolManager->RegisterTool( new SCH_POINT_EDITOR );
756 m_toolManager->RegisterTool( new SCH_NAVIGATE_TOOL );
757 m_toolManager->RegisterTool( new PROPERTIES_TOOL );
758 m_toolManager->RegisterTool( new EMBED_TOOL );
759 m_toolManager->InitTools();
760
761 // Run the selection tool, it is supposed to be always active
763
765}
766
767
769{
771
772 ACTION_MANAGER* mgr = m_toolManager->GetActionManager();
773 SCH_EDITOR_CONDITIONS cond( this );
774
775 wxASSERT( mgr );
776
777 auto hasElements =
778 [ this ] ( const SELECTION& aSel )
779 {
780 return GetScreen() &&
781 ( !GetScreen()->Items().empty() || !SELECTION_CONDITIONS::Idle( aSel ) );
782 };
783
784 auto searchPaneCond =
785 [this] ( const SELECTION& )
786 {
787 return m_auimgr.GetPane( SearchPaneName() ).IsShown();
788 };
789
790 auto gitCommitPaneCond = [this]( const SELECTION& )
791 {
792 return IsGitCommitPaneShown();
793 };
794
795 auto propertiesCond =
796 [this] ( const SELECTION& )
797 {
798 return m_auimgr.GetPane( PropertiesPaneName() ).IsShown();
799 };
800
801 auto hierarchyNavigatorCond =
802 [ this ] ( const SELECTION& aSel )
803 {
804 return m_auimgr.GetPane( SchematicHierarchyPaneName() ).IsShown();
805 };
806
807 auto netNavigatorCond =
808 [ this ] (const SELECTION& aSel )
809 {
810 return m_auimgr.GetPane( NetNavigatorPaneName() ).IsShown();
811 };
812
813 auto designBlockCond =
814 [ this ] (const SELECTION& aSel )
815 {
816 return m_auimgr.GetPane( DesignBlocksPaneName() ).IsShown();
817 };
818
819 auto remoteSymbolCond =
820 [ this ] (const SELECTION& aSel )
821 {
822 return m_auimgr.GetPane( RemoteSymbolPaneName() ).IsShown();
823 };
824
825 auto undoCond =
826 [ this ] (const SELECTION& aSel )
827 {
829 return true;
830
831 return GetUndoCommandCount() > 0;
832 };
833
834 auto groupWithDesignBlockLink =
835 [] ( const SELECTION& aSel )
836 {
837 if( aSel.Size() != 1 )
838 return false;
839
840 if( aSel[0]->Type() != SCH_GROUP_T )
841 return false;
842
843 SCH_GROUP* group = static_cast<SCH_GROUP*>( aSel.GetItem( 0 ) );
844
845 return group->HasDesignBlockLink();
846 };
847
848#define ENABLE( x ) ACTION_CONDITIONS().Enable( x )
849#define CHECK( x ) ACTION_CONDITIONS().Check( x )
850
852 mgr->SetConditions( ACTIONS::undo, ENABLE( undoCond ) );
854
855 mgr->SetConditions( SCH_ACTIONS::showSearch, CHECK( searchPaneCond ) );
856 mgr->SetConditions( SCH_ACTIONS::showHierarchy, CHECK( hierarchyNavigatorCond ) );
857 mgr->SetConditions( SCH_ACTIONS::showNetNavigator, CHECK( netNavigatorCond ) );
858 mgr->SetConditions( ACTIONS::showProperties, CHECK( propertiesCond ) );
859 mgr->SetConditions( ACTIONS::showGitCommitPane, CHECK( gitCommitPaneCond ) );
860 mgr->SetConditions( SCH_ACTIONS::showDesignBlockPanel, CHECK( designBlockCond ) );
861 mgr->SetConditions( SCH_ACTIONS::showRemoteSymbolPanel, CHECK( remoteSymbolCond ) );
864
865 mgr->SetConditions( ACTIONS::cut, ENABLE( hasElements ) );
866 mgr->SetConditions( ACTIONS::copy, ENABLE( hasElements ) );
867 mgr->SetConditions( ACTIONS::copyAsText, ENABLE( hasElements ) );
870 mgr->SetConditions( ACTIONS::doDelete, ENABLE( hasElements ) );
871 mgr->SetConditions( ACTIONS::duplicate, ENABLE( hasElements ) );
878 mgr->SetConditions( ACTIONS::selectAll, ENABLE( hasElements ) );
879 mgr->SetConditions( ACTIONS::unselectAll, ENABLE( hasElements ) );
880
882 ENABLE( SELECTION_CONDITIONS::NotEmpty ).HotkeyEnable( hasElements ) );
884 ENABLE( SELECTION_CONDITIONS::NotEmpty ).HotkeyEnable( hasElements ) );
886 ENABLE( SELECTION_CONDITIONS::NotEmpty ).HotkeyEnable( hasElements ) );
888 ENABLE( SELECTION_CONDITIONS::NotEmpty ).HotkeyEnable( hasElements ) );
891
892 mgr->SetConditions( SCH_ACTIONS::placeLinkedDesignBlock, ENABLE( groupWithDesignBlockLink ) );
893 mgr->SetConditions( SCH_ACTIONS::saveToLinkedDesignBlock, ENABLE( groupWithDesignBlockLink ) );
894
899
900 auto showHiddenPinsCond =
901 [this]( const SELECTION& )
902 {
903 return GetShowAllPins();
904 };
905
906 auto showHiddenFieldsCond =
907 [this]( const SELECTION& )
908 {
910 return cfg && cfg->m_Appearance.show_hidden_fields;
911 };
912
913 auto showDirectiveLabelsCond =
914 [this]( const SELECTION& )
915 {
917 return cfg && cfg->m_Appearance.show_directive_labels;
918 };
919
920 auto showERCErrorsCond =
921 [this]( const SELECTION& )
922 {
924 return cfg && cfg->m_Appearance.show_erc_errors;
925 };
926
927 auto showERCWarningsCond =
928 [this]( const SELECTION& )
929 {
931 return cfg && cfg->m_Appearance.show_erc_warnings;
932 };
933
934 auto showERCExclusionsCond =
935 [this]( const SELECTION& )
936 {
938 return cfg && cfg->m_Appearance.show_erc_exclusions;
939 };
940
941 auto markSimExclusionsCond =
942 [this]( const SELECTION& )
943 {
945 return cfg && cfg->m_Appearance.mark_sim_exclusions;
946 };
947
948 auto showOPVoltagesCond =
949 [this]( const SELECTION& )
950 {
952 return cfg && cfg->m_Appearance.show_op_voltages;
953 };
954
955 auto showOPCurrentsCond =
956 [this]( const SELECTION& )
957 {
959 return cfg && cfg->m_Appearance.show_op_currents;
960 };
961
962 auto showPinAltModeIconsCond =
963 [this]( const SELECTION& )
964 {
966 return cfg && cfg->m_Appearance.show_pin_alt_icons;
967 };
968
969 auto showAnnotateAutomaticallyCond =
970 [this]( const SELECTION& )
971 {
973 };
974
975 auto remapSymbolsCondition =
976 [&]( const SELECTION& aSel )
977 {
978 SCH_SCREENS schematic( Schematic().Root() );
979
980 // The remapping can only be performed on legacy projects.
981 return schematic.HasNoFullyDefinedLibIds();
982 };
983
984 auto belowRootSheetCondition =
985 [this]( const SELECTION& aSel )
986 {
987 SCH_NAVIGATE_TOOL* navigateTool = m_toolManager->GetTool<SCH_NAVIGATE_TOOL>();
988 return navigateTool && navigateTool->CanGoUp();
989 };
990
991 mgr->SetConditions( SCH_ACTIONS::leaveSheet, ENABLE( belowRootSheetCondition ) );
992
993 /* Some of these are bound by default to arrow keys which will get a different action if we
994 * disable the buttons. So always leave them enabled so the action is consistent.
995 * https://gitlab.com/kicad/code/kicad/-/issues/14783
996 mgr->SetConditions( SCH_ACTIONS::navigateUp, ENABLE( belowRootSheetCondition ) );
997 mgr->SetConditions( SCH_ACTIONS::navigateForward, ENABLE( navHistoryHasForward ) );
998 mgr->SetConditions( SCH_ACTIONS::navigateBack, ENABLE( navHistoryHsBackward ) );
999 */
1000
1001 mgr->SetConditions( SCH_ACTIONS::remapSymbols, ENABLE( remapSymbolsCondition ) );
1002 mgr->SetConditions( SCH_ACTIONS::toggleHiddenPins, CHECK( showHiddenPinsCond ) );
1003 mgr->SetConditions( SCH_ACTIONS::toggleHiddenFields, CHECK( showHiddenFieldsCond ) );
1004 mgr->SetConditions( SCH_ACTIONS::toggleDirectiveLabels, CHECK( showDirectiveLabelsCond ) );
1005 mgr->SetConditions( SCH_ACTIONS::toggleERCErrors, CHECK( showERCErrorsCond ) );
1006 mgr->SetConditions( SCH_ACTIONS::toggleERCWarnings, CHECK( showERCWarningsCond ) );
1007 mgr->SetConditions( SCH_ACTIONS::toggleERCExclusions, CHECK( showERCExclusionsCond ) );
1008 mgr->SetConditions( SCH_ACTIONS::markSimExclusions, CHECK( markSimExclusionsCond ) );
1009 mgr->SetConditions( SCH_ACTIONS::toggleOPVoltages, CHECK( showOPVoltagesCond ) );
1010 mgr->SetConditions( SCH_ACTIONS::toggleOPCurrents, CHECK( showOPCurrentsCond ) );
1011 mgr->SetConditions( SCH_ACTIONS::togglePinAltIcons, CHECK( showPinAltModeIconsCond ) );
1012 mgr->SetConditions( SCH_ACTIONS::toggleAnnotateAuto, CHECK( showAnnotateAutomaticallyCond ) );
1014
1017
1018#define CURRENT_TOOL( action ) mgr->SetConditions( action, CHECK( cond.CurrentTool( action ) ) )
1019
1053
1054#undef CURRENT_TOOL
1055#undef CHECK
1056#undef ENABLE
1057}
1058
1059
1061{
1062 // we cannot store a pointer to an item in the display list here since
1063 // that item may be deleted, such as part of a line concatenation or other.
1064 // So simply always keep a copy of the object which is to be repeated.
1065
1066 if( aItem )
1067 {
1068 m_items_to_repeat.clear();
1069
1070 AddCopyForRepeatItem( aItem );
1071 }
1072}
1073
1074
1076{
1077 // we cannot store a pointer to an item in the display list here since
1078 // that item may be deleted, such as part of a line concatenation or other.
1079 // So simply always keep a copy of the object which is to be repeated.
1080
1081 if( aItem )
1082 {
1083 std::unique_ptr<SCH_ITEM> repeatItem( static_cast<SCH_ITEM*>( aItem->Duplicate( IGNORE_PARENT_GROUP ) ) );
1084
1085 // Clone() preserves the flags & parent, we want 'em cleared.
1086 repeatItem->ClearFlags();
1087 repeatItem->SetParent( nullptr );
1088
1089 m_items_to_repeat.emplace_back( std::move( repeatItem ) );
1090 }
1091}
1092
1093
1094EDA_ITEM* SCH_EDIT_FRAME::ResolveItem( const KIID& aId, bool aAllowNullptrReturn ) const
1095{
1096 return Schematic().ResolveItem( aId, nullptr, aAllowNullptrReturn );
1097}
1098
1099
1104
1105
1110
1111
1113{
1114 return *m_schematic;
1115}
1116
1117
1119{
1120 return GetCurrentSheet().Last()->GetName();
1121}
1122
1123
1125{
1127}
1128
1129
1131{
1132 m_schematic->CreateDefaultScreens();
1133 SetScreen( Schematic().RootScreen() );
1134
1135 if( GetScreen() == nullptr )
1136 {
1137 SCH_SCREEN* screen = new SCH_SCREEN( m_schematic );
1138 SetScreen( screen );
1139 }
1140}
1141
1142
1144{
1145 return m_schematic->CurrentSheet();
1146}
1147
1148
1150{
1151 if( aSheet != GetCurrentSheet() )
1152 {
1153 ClearFocus();
1154
1155 wxLogTrace( traceSchCurrentSheet,
1156 "SCH_EDIT_FRAME::SetCurrentSheet: Changing from path='%s' (size=%zu) to path='%s' (size=%zu)",
1157 GetCurrentSheet().Path().AsString(),
1158 GetCurrentSheet().size(),
1159 aSheet.Path().AsString(),
1160 aSheet.size() );
1161
1162 Schematic().SetCurrentSheet( aSheet );
1164 GetCanvas()->DisplaySheet( aSheet.LastScreen() );
1165 }
1166}
1167
1168
1170{
1172
1173 for( SCH_ITEM* item : screen->Items() )
1174 item->ClearCaches();
1175
1176 for( const std::pair<const wxString, LIB_SYMBOL*>& libSymbol : screen->GetLibSymbols() )
1177 {
1178 wxCHECK2( libSymbol.second, continue );
1179 libSymbol.second->ClearCaches();
1180 }
1181
1182 if( Schematic().Settings().m_IntersheetRefsShow )
1184
1185 ClearFocus();
1186
1187 GetCanvas()->DisplaySheet( GetCurrentSheet().LastScreen() );
1188
1189 // The modern canvas only re-emits cached geometry for dirty items, so the new sheet's static
1190 // pool would otherwise stay empty
1192
1193 if( SCH_SELECTION_TOOL* selectionTool = m_toolManager->GetTool<SCH_SELECTION_TOOL>() )
1194 selectionTool->Reset( TOOL_BASE::REDRAW );
1195
1197}
1198
1199
1200bool SCH_EDIT_FRAME::canCloseWindow( wxCloseEvent& aEvent )
1201{
1202 // Exit interactive editing
1203 // Note this this will commit *some* pending changes. For instance, the SCH_POINT_EDITOR
1204 // will cancel any drag currently in progress, but commit all changes from previous drags.
1205 if( m_toolManager )
1207
1208 // Shutdown blocks must be determined and vetoed as early as possible
1209 if( KIPLATFORM::APP::SupportsShutdownBlockReason() && aEvent.GetId() == wxEVT_QUERY_END_SESSION
1210 && IsContentModified() )
1211 {
1212 return false;
1213 }
1214
1215 if( Kiface().IsSingle() )
1216 {
1217 auto* symbolEditor = (SYMBOL_EDIT_FRAME*) Kiway().Player( FRAME_SCH_SYMBOL_EDITOR, false );
1218
1219 if( symbolEditor && !symbolEditor->Close() ) // Can close symbol editor?
1220 return false;
1221
1222 auto* symbolViewer = (SYMBOL_VIEWER_FRAME*) Kiway().Player( FRAME_SCH_VIEWER, false );
1223
1224 if( symbolViewer && !symbolViewer->Close() ) // Can close symbol viewer?
1225 return false;
1226
1227 // SYMBOL_CHOOSER_FRAME is always modal so this shouldn't come up, but better safe than
1228 // sorry.
1229 auto* chooser = (SYMBOL_CHOOSER_FRAME*) Kiway().Player( FRAME_SYMBOL_CHOOSER, false );
1230
1231 if( chooser && !chooser->Close() ) // Can close symbol chooser?
1232 return false;
1233 }
1234 else
1235 {
1236 auto* symbolEditor = (SYMBOL_EDIT_FRAME*) Kiway().Player( FRAME_SCH_SYMBOL_EDITOR, false );
1237
1238 if( symbolEditor && symbolEditor->IsSymbolFromSchematic() )
1239 {
1240 if( !symbolEditor->CanCloseSymbolFromSchematic( true ) )
1241 return false;
1242 }
1243 }
1244
1245 if( !Kiway().PlayerClose( FRAME_SIMULATOR, false ) ) // Can close the simulator?
1246 return false;
1247
1249 && !m_symbolFieldsTableDialog->Close( false ) ) // Can close the symbol fields table?
1250 {
1251 return false;
1252 }
1253
1254 // We may have gotten multiple events; don't clean up twice
1255 if( !Schematic().IsValid() )
1256 return false;
1257
1258 if( IsContentModified() )
1259 {
1260 wxFileName fileName = Schematic().RootScreen()->GetFileName();
1261 wxString msg = _( "Save changes to '%s' before closing?" );
1262
1263 if( !HandleUnsavedChanges( this, wxString::Format( msg, fileName.GetFullName() ),
1264 [&]() -> bool
1265 {
1266 return SaveProject();
1267 } ) )
1268 {
1269 return false;
1270 }
1271
1272 // If user selected 'No' (discard), create duplicate commit of last saved state and
1273 // move Last_Save tag forward so history shows an explicit discard event.
1274 if( GetLastUnsavedChangesResponse() == wxID_NO )
1275 {
1276 wxString projPath = Prj().GetProjectPath();
1277
1278 if( !projPath.IsEmpty() && Kiway().LocalHistory().HistoryExists( projPath ) )
1279 {
1280 Kiway().LocalHistory().CommitDuplicateOfLastSave( projPath, wxS( "Schematic" ),
1281 wxS( "Discard unsaved schematic changes" ) );
1282 }
1283 }
1284 }
1285
1286 return true;
1287}
1288
1289
1291{
1292 m_crossProbeFlashing = false;
1294
1297
1298 // Unregister the autosave saver before any cleanup that might invalidate m_schematic
1299 if( m_schematic )
1301
1303
1304 SCH_SHEET_LIST sheetlist = Schematic().Hierarchy();
1305
1306 if( !Prj().IsNullProject() )
1307 {
1308 std::vector<wxString> sheetSrcs;
1309 sheetSrcs.reserve( sheetlist.size() );
1310
1311 for( const SCH_SHEET_PATH& path : sheetlist )
1312 {
1313 SCH_SCREEN* screen = path.LastScreen();
1314
1315 // Only sweep autosaves for sheets actually dirtied in this session.
1316 // A clean sheet's autosave, if any, is a previous-session leftover the
1317 // user explicitly deferred in the recovery dialog.
1318 if( screen && screen->IsContentModified() )
1319 sheetSrcs.push_back( Prj().AbsolutePath( screen->GetFileName() ) );
1320 }
1321
1322 Kiway().LocalHistory().RemoveAutosaveFiles( Prj().GetProjectPath(), sheetSrcs );
1323 }
1324
1325 // Close modeless dialogs. They're trouble when they get destroyed after the frame.
1326 Unbind( EDA_EVT_CLOSE_DIALOG_BOOK_REPORTER, &SCH_EDIT_FRAME::onCloseSymbolDiffDialog, this );
1327 Unbind( EDA_EVT_CLOSE_ERC_DIALOG, &SCH_EDIT_FRAME::onCloseErcDialog, this );
1328 Unbind( EDA_EVT_CLOSE_DIALOG_SYMBOL_FIELDS_TABLE, &SCH_EDIT_FRAME::onCloseSymbolFieldsTableDialog, this );
1329 m_netNavigator->Unbind( wxEVT_TREE_SEL_CHANGING, &SCH_EDIT_FRAME::onNetNavigatorSelChanging, this );
1330 m_netNavigator->Unbind( wxEVT_TREE_SEL_CHANGED, &SCH_EDIT_FRAME::onNetNavigatorSelection, this );
1331
1332 if( m_diffSymbolDialog )
1333 {
1334 m_diffSymbolDialog->Destroy();
1335 m_diffSymbolDialog = nullptr;
1336 }
1337
1338 if( m_ercDialog )
1339 {
1340 m_ercDialog->Destroy();
1341 m_ercDialog = nullptr;
1342 }
1343
1345 {
1346 m_symbolFieldsTableDialog->Destroy();
1347 m_symbolFieldsTableDialog = nullptr;
1348 }
1349
1350 // Make sure local settings are persisted
1351 if( Prj().GetLocalSettings().ShouldAutoSave() )
1353
1354 delete m_toolManager;
1355 m_toolManager = nullptr;
1356
1357 wxAuiPaneInfo& hierarchy_pane = m_auimgr.GetPane( SchematicHierarchyPaneName() );
1358
1359 if( hierarchy_pane.IsShown() && hierarchy_pane.IsFloating() )
1360 {
1361 hierarchy_pane.Show( false );
1362 m_auimgr.Update();
1363 }
1364
1365 sheetlist.ClearModifyStatus();
1366
1367 wxString fileName = Prj().AbsolutePath( Schematic().RootScreen()->GetFileName() );
1368
1369 if( !Schematic().GetFileName().IsEmpty() && !Schematic().RootScreen()->IsEmpty() )
1370 UpdateFileHistory( fileName );
1371
1372 // Clear the view before freeing any schematic items. VIEW::Clear() walks m_allItems and
1373 // touches each item's private data, so the items must still be alive when this runs.
1374 SetScreen( nullptr );
1375
1376 Schematic().RootScreen()->Clear( true );
1377
1378 // all sub sheets are deleted, only the main sheet is usable
1380
1381 Schematic().Reset();
1382
1383 // Prevents any rogue events from continuing (i.e. search panel tries to redraw)
1384 Show( false );
1385
1386 Destroy();
1387}
1388
1389
1391{
1392 m_searchPane->FocusSearch();
1393}
1394
1395
1397{
1398 return Schematic().ErcSettings().GetSeverity( aErrorCode );
1399}
1400
1401
1403{
1405
1406 if( GetScreen() )
1407 {
1409 Kiway().LocalHistory().NoteFileChange( GetScreen()->GetFileName() );
1410 }
1411
1412 if( m_isClosing )
1413 return;
1414
1415 if( GetCanvas() )
1416 GetCanvas()->Refresh();
1417
1418 if( GetScreen() && !GetTitle().StartsWith( wxS( "*" ) ) )
1419 updateTitle();
1420}
1421
1422
1424{
1425 if( Kiface().IsSingle() )
1426 {
1427 DisplayError( this, _( "Cannot update the PCB because the Schematic Editor is opened in stand-alone "
1428 "mode. In order to create/update PCBs from schematics, launch the main KiCad "
1429 "application and create a project." ) );
1430 return;
1431 }
1432
1433 KIWAY_PLAYER* frame = Kiway().Player( FRAME_PCB_EDITOR, false );
1434 wxEventBlocker blocker( this );
1435
1436 if( !frame )
1437 {
1438 wxFileName fn = Prj().GetProjectFullName();
1439 fn.SetExt( FILEEXT::PcbFileExtension );
1440
1441 frame = Kiway().Player( FRAME_PCB_EDITOR, true );
1442
1443 // If Kiway() cannot create the Pcbnew frame, it shows a error message, and
1444 // frame is null
1445 if( !frame )
1446 return;
1447
1448 frame->OpenProjectFiles( std::vector<wxString>( 1, fn.GetFullPath() ) );
1449 }
1450
1451 if( !frame->IsVisible() )
1452 frame->Show( true );
1453
1454 // On Windows, Raise() does not bring the window on screen, when iconized
1455 if( frame->IsIconized() )
1456 frame->Iconize( false );
1457
1458 frame->Raise();
1459
1460 std::string payload;
1462}
1463
1464
1465void SCH_EDIT_FRAME::UpdateHierarchyNavigator( bool aRefreshNetNavigator, bool aClear )
1466{
1467 m_netNavigatorStale = true;
1468 m_toolManager->GetTool<SCH_NAVIGATE_TOOL>()->CleanHistory();
1469 m_hierarchy->UpdateHierarchyTree( aClear );
1470
1471 if( aRefreshNetNavigator )
1473}
1474
1475
1477{
1478 // Update only the hierarchy navigation tree labels.
1479 // The tree list is expected to be up to date
1480 m_hierarchy->UpdateLabelsHierarchyTree();
1481}
1482
1483
1485{
1486 m_hierarchy->UpdateHierarchySelection();
1487}
1488
1489
1490void SCH_EDIT_FRAME::OnLoadFile( wxCommandEvent& event )
1491{
1492 wxString filename = GetFileFromHistory( event.GetId(), _( "Schematic" ) );
1493
1494 if( !filename.IsEmpty() )
1495 OpenProjectFiles( std::vector<wxString>( 1, filename ), KICTL_KICAD_ONLY );
1496}
1497
1498
1499void SCH_EDIT_FRAME::OnClearFileHistory( wxCommandEvent& aEvent )
1500{
1502}
1503
1504
1506{
1507 // Only standalone mode can directly load a new document
1508 if( !Kiface().IsSingle() )
1509 return;
1510
1511 wxString pro_dir = m_mruPath;
1512
1513 wxFileDialog dlg( this, _( "New Schematic" ), pro_dir, wxEmptyString, FILEEXT::KiCadSchematicFileWildcard(),
1514 wxFD_SAVE );
1515
1517
1518 if( dlg.ShowModal() != wxID_CANCEL )
1519 {
1520 // Enforce the extension, wxFileDialog is inept.
1521 wxFileName create_me = EnsureFileExtension( dlg.GetPath(), FILEEXT::KiCadSchematicFileExtension );
1522
1523 if( create_me.FileExists() )
1524 {
1525 wxString msg;
1526 msg.Printf( _( "Schematic file '%s' already exists." ), create_me.GetFullName() );
1527 DisplayError( this, msg );
1528 return ;
1529 }
1530
1531 // OpenProjectFiles() requires absolute
1532 wxASSERT_MSG( create_me.IsAbsolute(), wxS( "wxFileDialog returned non-absolute path" ) );
1533
1534 OpenProjectFiles( std::vector<wxString>( 1, create_me.GetFullPath() ), KICTL_CREATE );
1535 m_mruPath = create_me.GetPath();
1536 }
1537}
1538
1539
1541{
1542 // Only standalone mode can directly load a new document
1543 if( !Kiface().IsSingle() )
1544 return;
1545
1546 wxString pro_dir = m_mruPath;
1547 wxString wildcards = FILEEXT::AllSchematicFilesWildcard()
1549 + wxS( "|" ) + FILEEXT::LegacySchematicFileWildcard();
1550
1551 wxFileDialog dlg( this, _( "Open Schematic" ), pro_dir, wxEmptyString, wildcards,
1552 wxFD_OPEN | wxFD_FILE_MUST_EXIST );
1553
1555
1556 if( dlg.ShowModal() != wxID_CANCEL )
1557 {
1558 OpenProjectFiles( std::vector<wxString>( 1, dlg.GetPath() ), KICTL_KICAD_ONLY );
1560 }
1561
1562 // Since we know we're single-top here: trigger library reload
1563 CallAfter(
1564 [&]()
1565 {
1566 KIFACE *schface = Kiway().KiFACE( KIWAY::FACE_SCH );
1567 schface->PreloadLibraries( &Kiway() );
1568
1570 } );
1571}
1572
1573
1575{
1577
1578 // Drop the symbol fields table so export paths re-bind to the new project (#22395).
1580 {
1581 m_symbolFieldsTableDialog->Destroy();
1582 m_symbolFieldsTableDialog = nullptr;
1583 }
1584
1585 // Register schematic saver for autosave history
1587 [this]( const wxString& aProjectPath, std::vector<HISTORY_FILE_DATA>& aFileData )
1588 {
1589 m_schematic->SaveToHistory( aProjectPath, aFileData );
1590 },
1591 m_schematic->GetHistoryLifetimeToken() );
1592
1593 m_designBlocksPane->ProjectChanged();
1594}
1595
1596
1598{
1599 // Use the project's board, not the active sheet's name, which may belong to another project.
1600 wxString projectName = Prj().GetProjectFullName();
1601
1602 wxFileName kicad_board =
1603 projectName.IsEmpty() ? Prj().AbsolutePath( Schematic().GetFileName() ) : wxFileName( projectName );
1604
1605 if( kicad_board.IsOk() && !kicad_board.GetName().IsEmpty() )
1606 {
1607 kicad_board.SetExt( FILEEXT::PcbFileExtension );
1608 wxFileName legacy_board( kicad_board );
1609 legacy_board.SetExt( FILEEXT::LegacyPcbFileExtension );
1610 wxFileName& boardfn = legacy_board;
1611
1612 if( !legacy_board.FileExists() || kicad_board.FileExists() )
1613 boardfn = kicad_board;
1614
1615 if( Kiface().IsSingle() )
1616 {
1617 ExecuteFile( PCBNEW_EXE, boardfn.GetFullPath() );
1618 }
1619 else
1620 {
1621 wxEventBlocker blocker(this);
1622 KIWAY_PLAYER* frame = Kiway().Player( FRAME_PCB_EDITOR, false );
1623
1624 if( !frame )
1625 {
1626 frame = Kiway().Player( FRAME_PCB_EDITOR, true );
1627
1628 // frame can be null if Cvpcb cannot be run. No need to show a warning
1629 // Kiway() generates the error messages
1630 if( !frame )
1631 return;
1632
1633 frame->OpenProjectFiles( std::vector<wxString>( 1, boardfn.GetFullPath() ) );
1634 }
1635
1636 if( !frame->IsVisible() )
1637 frame->Show( true );
1638
1639 // On Windows, Raise() does not bring the window on screen, when iconized
1640 if( frame->IsIconized() )
1641 frame->Iconize( false );
1642
1643 frame->Raise();
1644 }
1645 }
1646 else
1647 {
1649 }
1650}
1651
1652
1654{
1655 wxFileName fn = Prj().AbsolutePath( Schematic().GetFileName() );
1656 fn.SetExt( FILEEXT::NetlistFileExtension );
1657
1658 if( !ReadyToNetlist( _( "Assigning footprints requires a fully annotated schematic." ) ) )
1659 return;
1660
1661 try
1662 {
1663 KIWAY_PLAYER* player = Kiway().Player( FRAME_CVPCB, false ); // test open already.
1664
1665 if( !player )
1666 {
1667 player = Kiway().Player( FRAME_CVPCB, true );
1668
1669 // player can be null if Cvpcb cannot be run. No need to show a warning
1670 // Kiway() generates the error messages
1671 if( !player )
1672 return;
1673
1674 player->Show( true );
1675 }
1676
1678
1679 player->Raise();
1680 }
1681 catch( const IO_ERROR& )
1682 {
1683 DisplayError( this, _( "Could not open CvPcb" ) );
1684 }
1685}
1686
1687
1688void SCH_EDIT_FRAME::OnExit( wxCommandEvent& event )
1689{
1690 if( event.GetId() == wxID_EXIT )
1691 Kiway().OnKiCadExit();
1692
1693 if( event.GetId() == wxID_CLOSE || Kiface().IsSingle() )
1694 Close( false );
1695}
1696
1697
1699{
1700 SCHEMATIC_SETTINGS& settings = m_schematic->Settings();
1701 SIM_LIB_MGR simLibMgr( &Prj() );
1702 NULL_REPORTER devnull;
1703 SCH_SHEET_PATH& sheetPath = GetCurrentSheet();
1704 wxString variant = m_schematic->GetCurrentVariant();
1705
1706 // Patch for bug early in V7.99 dev
1707 if( settings.m_OPO_VRange.EndsWith( 'A' ) )
1708 settings.m_OPO_VRange[ settings.m_OPO_VRange.Length() - 1 ] = 'V';
1709
1710 // Update items which may have ${OP} text variables
1711 //
1713 [&]( KIGFX::VIEW_ITEM* aItem ) -> int
1714 {
1715 int flags = 0;
1716
1717 auto invalidateTextVars =
1718 [&flags]( EDA_TEXT* text )
1719 {
1720 if( text->HasTextVars() )
1721 {
1722 text->ClearRenderCache();
1723 text->ClearBoundingBoxCache();
1725 }
1726 };
1727
1728 if( SCH_ITEM* item = dynamic_cast<SCH_ITEM*>( aItem ) )
1729 {
1730 item->RunOnChildren(
1731 [&invalidateTextVars]( SCH_ITEM* aChild )
1732 {
1733 if( EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( aChild ) )
1734 invalidateTextVars( text );
1735 },
1737 }
1738
1739 if( EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( aItem ) )
1740 invalidateTextVars( text );
1741
1742 return flags;
1743 } );
1744
1745 // Update OP overlay items
1746 //
1747 for( SCH_ITEM* item : GetScreen()->Items() )
1748 {
1749 if( sheetPath.GetExcludedFromSim( variant ) )
1750 continue;
1751
1752 if( item->Type() == SCH_LINE_T )
1753 {
1754 SCH_LINE* line = static_cast<SCH_LINE*>( item );
1755
1756 if( !line->GetOperatingPoint().IsEmpty() )
1757 GetCanvas()->GetView()->Update( line );
1758
1759 line->SetOperatingPoint( wxEmptyString );
1760
1761 // update value from netlist, below
1762 }
1763 else if( item->Type() == SCH_SYMBOL_T )
1764 {
1765 SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( item );
1766 wxString ref = symbol->GetRef( &sheetPath );
1767 std::vector<SCH_PIN*> pins = symbol->GetPins( &sheetPath );
1768
1769 // Power symbols and other symbols which have the reference starting with "#" are
1770 // not included in simulation
1771 if( ref.StartsWith( '#' ) || symbol->ResolveExcludedFromSim( &sheetPath, variant ) )
1772 continue;
1773
1774 for( SCH_PIN* pin : pins )
1775 {
1776 if( !pin->GetOperatingPoint().IsEmpty() )
1777 GetCanvas()->GetView()->Update( pin );
1778
1779 pin->SetOperatingPoint( wxEmptyString );
1780 }
1781
1782 if( pins.size() == 2 )
1783 {
1784 wxString op = m_schematic->GetOperatingPoint( ref, settings.m_OPO_IPrecision, settings.m_OPO_IRange );
1785
1786 if( !op.IsEmpty() && op != wxS( "--" ) && op != wxS( "?" ) )
1787 {
1788 pins[0]->SetOperatingPoint( op );
1789 GetCanvas()->GetView()->Update( symbol );
1790 }
1791 }
1792 else
1793 {
1794 std::vector<EMBEDDED_FILES*> embeddedFilesStack;
1795 embeddedFilesStack.push_back( m_schematic->GetEmbeddedFiles() );
1796
1797 if( EMBEDDED_FILES* symbolEmbeddedFiles = symbol->GetEmbeddedFiles() )
1798 {
1799 embeddedFilesStack.push_back( symbolEmbeddedFiles );
1800 symbol->GetLibSymbolRef()->AppendParentEmbeddedFiles( embeddedFilesStack );
1801 }
1802
1803 simLibMgr.SetFilesStack( std::move( embeddedFilesStack ) );
1804
1805 SIM_MODEL& model = simLibMgr.CreateModel( &sheetPath, *symbol, true, 0, variant, devnull ).model;
1806
1807 SPICE_ITEM spiceItem;
1808 spiceItem.refName = ref;
1809 ref = model.SpiceGenerator().ItemName( spiceItem );
1810
1811 for( const auto& modelPin : model.GetPins() )
1812 {
1813 SCH_PIN* symbolPin = symbol->GetPin( modelPin.get().symbolPinNumber );
1814 wxString netChainName = ref + wxS( ":" ) + modelPin.get().modelPinName;
1815 wxString op = m_schematic->GetOperatingPoint( netChainName, settings.m_OPO_IPrecision,
1816 settings.m_OPO_IRange );
1817
1818 if( symbolPin && !op.IsEmpty() && op != wxS( "--" ) && op != wxS( "?" ) )
1819 {
1820 symbolPin->SetOperatingPoint( op );
1821 GetCanvas()->GetView()->Update( symbol );
1822 }
1823 }
1824 }
1825 }
1826 }
1827
1828 for( const auto& [ key, subgraphList ] : m_schematic->m_connectionGraph->GetNetMap() )
1829 {
1830 wxString op = m_schematic->GetOperatingPoint( key.Name, settings.m_OPO_VPrecision, settings.m_OPO_VRange );
1831
1832 if( !op.IsEmpty() && op != wxS( "--" ) && op != wxS( "?" ) )
1833 {
1834 for( CONNECTION_SUBGRAPH* subgraph : subgraphList )
1835 {
1836 SCH_LINE* longestWire = nullptr;
1837 double length = 0.0;
1838
1839 if( subgraph->GetSheet().GetExcludedFromSim( variant ) )
1840 continue;
1841
1842 for( SCH_ITEM* item : subgraph->GetItems() )
1843 {
1844 if( item->Type() == SCH_LINE_T )
1845 {
1846 SCH_LINE* line = static_cast<SCH_LINE*>( item );
1847
1848 if( line->IsWire() && line->GetLength() > length )
1849 {
1850 longestWire = line;
1851 length = line->GetLength();
1852 }
1853 }
1854 }
1855
1856 if( longestWire )
1857 {
1858 longestWire->SetOperatingPoint( op );
1859 GetCanvas()->GetView()->Update( longestWire );
1860 }
1861 }
1862 }
1863 }
1864}
1865
1866
1868{
1869 if( aItem->Type() == SCH_GLOBAL_LABEL_T || aItem->Type() == SCH_HIER_LABEL_T )
1870 {
1871 SCH_LABEL_BASE* label = static_cast<SCH_LABEL_BASE*>( aItem );
1872
1873 if( label->AutoRotateOnPlacement() )
1874 {
1875 SPIN_STYLE spin = aScreen->GetLabelOrientationForPoint( label->GetPosition(), label->GetSpinStyle(),
1876 &GetCurrentSheet() );
1877
1878 if( spin != label->GetSpinStyle() )
1879 {
1880 label->SetSpinStyle( spin );
1881
1882 for( SCH_ITEM* item : aScreen->Items().OfType( SCH_GLOBAL_LABEL_T ) )
1883 {
1884 SCH_LABEL_BASE* otherLabel = static_cast<SCH_LABEL_BASE*>( item );
1885
1886 if( otherLabel != label && otherLabel->GetText() == label->GetText() )
1887 otherLabel->AutoplaceFields( aScreen, AUTOPLACE_AUTO );
1888 }
1889 }
1890 }
1891 }
1892}
1893
1894
1896{
1897 SCH_SCREEN* screen = GetScreen();
1898
1899 wxCHECK( screen, /* void */ );
1900
1901 wxString title;
1902
1903 if( !screen->GetFileName().IsEmpty() )
1904 {
1905 wxFileName fn( Prj().AbsolutePath( screen->GetFileName() ) );
1906 bool readOnly = false;
1907 bool unsaved = false;
1908
1909 if( fn.IsOk() && screen->FileExists() )
1910 readOnly = screen->IsReadOnly();
1911 else
1912 unsaved = true;
1913
1914 if( IsContentModified() )
1915 title = wxT( "*" );
1916
1917 title += fn.GetName();
1918
1919 wxString sheetPath = GetCurrentSheet().PathHumanReadable( false, true );
1920
1921 if( sheetPath != fn.GetName() )
1922 title += wxString::Format( wxT( " [%s]" ), sheetPath );
1923
1924 if( readOnly )
1925 title += wxS( " " ) + _( "[Read Only]" );
1926
1927 if( unsaved )
1928 title += wxS( " " ) + _( "[Unsaved]" );
1929 }
1930 else
1931 {
1932 title = _( "[no schematic loaded]" );
1933 }
1934
1935 title += wxT( " \u2014 " ) + _( "Schematic Editor" );
1936
1937 SetTitle( title );
1938}
1939
1940
1942{
1944
1945 if( GetScreen() )
1946 GetScreen()->m_zoomInitialized = true;
1947}
1948
1949
1951 PROGRESS_REPORTER* aProgressReporter, bool aCleanupDone )
1952{
1953 wxString highlightedConn = GetHighlightedConnection();
1954 bool hasHighlightedConn = !highlightedConn.IsEmpty();
1955 bool itemsChanged = false;
1956
1957 std::function<void( SCH_ITEM* )> changeHandler =
1958 [&]( SCH_ITEM* aChangedItem ) -> void
1959 {
1960 itemsChanged = true;
1961 GetCanvas()->GetView()->Update( aChangedItem, KIGFX::REPAINT );
1962
1963 if( ADVANCED_CFG::GetCfg().m_ConnectivityEngine )
1964 return;
1965
1966 SCH_CONNECTION* connection = aChangedItem->Connection();
1967
1969 return;
1970
1971 if( !hasHighlightedConn )
1972 {
1973 // No highlighted connection, but connectivity has changed, so refresh
1974 // the list of all nets
1976 }
1977 else if( connection && ( connection->Name() == highlightedConn
1978 || connection->HasDriverChanged() ) )
1979 {
1981 }
1982 };
1983
1984 try
1985 {
1986 Schematic().RecalculateConnections( aCommit, aCleanupFlags,
1988 aProgressReporter,
1989 GetCanvas()->GetView(),
1990 &changeHandler,
1991 m_undoList.m_CommandsList.empty() ? nullptr
1992 : m_undoList.m_CommandsList.back(),
1993 aCleanupDone );
1994 }
1995 catch( const std::exception& error )
1996 {
1997 if( !ADVANCED_CFG::GetCfg().m_ConnectivityEngine )
1998 throw;
1999
2000 // The engine clears its publication before rethrowing; an edit must not unwind the tool
2001 wxLogTrace( wxS( "KICAD_CONNECTIVITY" ), wxS( "Connectivity recalculation failed: %s" ),
2002 wxString::FromUTF8( error.what() ) );
2003 ShowInfoBarError( _( "Unable to rebuild schematic connectivity." ), true );
2004 RefreshConnectivity( true );
2005 return false;
2006 }
2007
2008 // Dangling repairs notify even without a graph delta; text-only changes still need a refresh
2009 if( !ADVANCED_CFG::GetCfg().m_ConnectivityEngine
2010 || ( !itemsChanged && Schematic().Connectivity().Published().Changes().Empty() ) )
2011 {
2013 }
2014
2015 return true;
2016}
2017
2018
2020{
2021 SCH_COMMIT cleanup( m_toolManager );
2023 cleanup.Push( _( "Schematic Cleanup" ), SKIP_CONNECTIVITY );
2024}
2025
2026
2028{
2030 [this]( const SCH_CONNECTIVITY::CHANGE_SET& changes )
2031 {
2032 if( ADVANCED_CFG::GetCfg().m_ConnectivityEngine && Schematic().HasHierarchy() && GetScreen() )
2033 {
2034 RefreshConnectivity( false, &changes );
2035 GetCanvas()->Refresh();
2036 }
2037 } );
2038}
2039
2040
2042{
2043 const wxString highlightedConn = GetHighlightedConnection();
2044 const bool useEngine = ADVANCED_CFG::GetCfg().m_ConnectivityEngine;
2045 std::set<KIID> repaintItems;
2046 const auto* changes = aChanges;
2047
2048 if( useEngine )
2049 {
2050 const auto& facade = Schematic().Connectivity();
2051
2052 if( !changes )
2053 changes = &facade.Published().Changes();
2054
2055 if( const auto instance = facade.Keys().FindInstance( GetCurrentSheet().PathRef() ) )
2056 {
2057 for( const auto* items : { &changes->changedItems, &changes->driverChangedItems } )
2058 {
2059 for( const auto& key : *items )
2060 {
2061 if( key.inst == *instance )
2062 repaintItems.insert( key.item );
2063 }
2064 }
2065 }
2066 }
2067
2069 [&]( KIGFX::VIEW_ITEM* aItem ) -> int
2070 {
2071 int flags = aForce ? KIGFX::REPAINT : 0;
2072 SCH_ITEM* item = dynamic_cast<SCH_ITEM*>( aItem );
2073 SCH_CONNECTION* connection = item && !useEngine ? item->Connection() : nullptr;
2074
2075 auto invalidateTextVars =
2076 [&flags]( EDA_TEXT* text )
2077 {
2078 if( text->HasTextVars() )
2079 {
2080 text->ClearRenderCache();
2081 text->ClearBoundingBoxCache();
2083 }
2084 };
2085
2086 if( connection && connection->HasDriverChanged() )
2087 {
2088 connection->ClearDriverChanged();
2089 flags |= KIGFX::REPAINT;
2090 }
2091
2092 if( item && repaintItems.contains( item->m_Uuid ) )
2093 flags |= KIGFX::REPAINT;
2094
2095 if( item )
2096 {
2097 item->RunOnChildren(
2098 [&invalidateTextVars]( SCH_ITEM* aChild )
2099 {
2100 if( EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( aChild ) )
2101 invalidateTextVars( text );
2102 },
2104
2105 if( flags & KIGFX::GEOMETRY )
2106 GetScreen()->UpdateDisplayBounds( item );
2107 }
2108
2109 if( EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( aItem ) )
2110 invalidateTextVars( text );
2111
2112 return flags;
2113 } );
2114
2115 const bool changed = useEngine && !changes->Empty();
2116 // Legacy never finds an empty name, so it refreshes the all-nets navigator on every pass
2117 const bool exists = useEngine ? highlightedConn.IsEmpty()
2118 || Schematic().Connectivity().NetByName( highlightedConn ).has_value()
2119 : Schematic().ConnectionGraph()->FindFirstSubgraphByName( highlightedConn )
2120 != nullptr;
2121
2122 if( aForce || changed || m_highlightedConnChanged || !exists )
2123 {
2125
2126 if( useEngine && !aForce && !m_highlightedConnChanged && exists )
2127 {
2128 const auto& facade = Schematic().Connectivity();
2129 std::vector<wxString> names;
2130
2131 for( auto name : changes->netsChanged )
2132 names.push_back( facade.Keys().Name( name ) );
2133
2134 RefreshNetNavigator( nullptr, &names );
2135 }
2136 else
2137 {
2139 }
2140
2142 }
2143}
2144
2145
2150
2151
2153{
2154 GetCanvas()->GetView()->Update( aItem );
2155}
2156
2157
2164
2165
2166std::unique_ptr<GRID_HELPER> SCH_EDIT_FRAME::MakeGridHelper()
2167{
2168 return std::make_unique<EE_GRID_HELPER>( m_toolManager );
2169}
2170
2171
2173{
2175
2176 SCHEMATIC_SETTINGS& settings = Schematic().Settings();
2177
2179
2180 if( EESCHEMA_SETTINGS* cfg = GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" ) )
2181 {
2182 GetGalDisplayOptions().ReadWindowSettings( cfg->m_Window );
2183 GetRenderSettings()->SetDefaultFont( cfg->m_Appearance.default_font );
2184
2185 KIGFX::VIEW* view = GetCanvas()->GetView();
2186 view->SetLayerVisible( LAYER_ERC_ERR, cfg->m_Appearance.show_erc_errors );
2187 view->SetLayerVisible( LAYER_ERC_WARN, cfg->m_Appearance.show_erc_warnings );
2188 view->SetLayerVisible( LAYER_ERC_EXCLUSION, cfg->m_Appearance.show_erc_exclusions );
2189 view->SetLayerVisible( LAYER_OP_VOLTAGES, cfg->m_Appearance.show_op_voltages );
2190 view->SetLayerVisible( LAYER_OP_CURRENTS, cfg->m_Appearance.show_op_currents );
2191
2192 GetRenderSettings()->m_ShowPinAltIcons = cfg->m_Appearance.show_pin_alt_icons;
2193 GetRenderSettings()->m_ShowRemappedPinNumbers = cfg->m_Appearance.show_remapped_pin_numbers;
2194
2196
2197 }
2198
2200
2201 for( SCH_ITEM* item : screen->Items() )
2202 {
2203 item->ClearCaches();
2204
2205 if( item->Type() == SCH_LINE_T )
2206 {
2207 SCH_LINE* line = static_cast<SCH_LINE*>( item );
2208
2209 if( line->IsWire() || line->IsBus() )
2210 UpdateHopOveredWires( line );
2211 }
2212 }
2213
2214 for( const auto& [ libItemName, libSymbol ] : screen->GetLibSymbols() )
2215 libSymbol->ClearCaches();
2216
2218
2220 Layout();
2221 SendSizeEvent();
2222}
2223
2224
2226{
2227 // Store the current zoom level into the current screen before calling
2228 // DisplayCurrentSheet() that set the zoom to GetScreen()->m_LastZoomLevel
2230
2231 // Rebuild the sheet view (draw area and any other items):
2233}
2234
2235
2237{
2238 // call my base class
2240
2241 // tooltips in toolbars
2243
2244 // For some obscure reason, the AUI manager hides the first modified pane.
2245 // So force show panes
2246 wxAuiPaneInfo& design_blocks_pane_info = m_auimgr.GetPane( m_designBlocksPane );
2247 bool panel_shown = design_blocks_pane_info.IsShown();
2248 design_blocks_pane_info.Caption( _( "Design Blocks" ) );
2249 design_blocks_pane_info.Show( panel_shown );
2250
2251 m_auimgr.GetPane( m_hierarchy ).Caption( _( "Schematic Hierarchy" ) );
2252 m_auimgr.GetPane( m_selectionFilterPanel ).Caption( _( "Selection Filter" ) );
2253 m_auimgr.GetPane( m_propertiesPanel ).Caption( _( "Properties" ) );
2254 m_auimgr.GetPane( m_designBlocksPane ).Caption( _( "Design Blocks" ) );
2255 m_auimgr.GetPane( RemoteSymbolPaneName() ).Caption( _( "Remote Symbols" ) );
2256 m_auimgr.Update();
2257 m_hierarchy->UpdateHierarchyTree();
2258
2259 // status bar
2261
2262 updateTitle();
2263
2264 // This ugly hack is to fix an option(left) toolbar update bug that seems to only affect
2265 // windows. See https://bugs.launchpad.net/kicad/+bug/1816492. For some reason, calling
2266 // wxWindow::Refresh() does not resolve the issue. Only a resize event seems to force the
2267 // toolbar to update correctly.
2268#if defined( __WXMSW__ )
2269 PostSizeEvent();
2270#endif
2271}
2272
2273
2275{
2276 if( !GetHighlightedNetChain().IsEmpty() )
2277 {
2278 if( SCH_NETCHAIN* sig = m_schematic->NetChains().GetNetChainByName( GetHighlightedNetChain() ) )
2279 {
2280 wxString nets;
2281
2282 for( const wxString& n : sig->GetNets() )
2283 {
2284 if( !nets.IsEmpty() )
2285 nets += wxT( ", " );
2286
2287 nets += n;
2288 }
2289
2290 SetStatusText( wxString::Format( _( "Net chain members: %s" ), nets ) );
2291 return;
2292 }
2293 }
2294
2295 if( !GetHighlightedConnection().IsEmpty() )
2296 {
2297 SetStatusText( wxString::Format( _( "Highlighted net: %s" ),
2299 }
2300 else
2301 {
2302 SetStatusText( wxT( "" ) );
2303 }
2304}
2305
2306
2308{
2309 if( m_toolManager )
2311
2312 SCH_BASE_FRAME::SetScreen( aScreen );
2313
2314 // SetSheetNumberAndCount() dereferences the current sheet's screen, which is absent on the
2315 // unload paths that pass a null screen.
2316 if( aScreen )
2318
2319 GetCanvas()->DisplaySheet( static_cast<SCH_SCREEN*>( aScreen ) );
2320
2321 if( m_toolManager )
2323}
2324
2325
2326const BOX2I SCH_EDIT_FRAME::GetDocumentExtents( bool aIncludeAllVisible ) const
2327{
2328 BOX2I bBoxDoc;
2329
2330 if( !GetScreen() )
2331 return bBoxDoc;
2332
2333 if( aIncludeAllVisible )
2334 {
2335 // Get the whole page size and return that
2336 int sizeX = GetScreen()->GetPageSettings().GetWidthIU( schIUScale.IU_PER_MILS );
2337 int sizeY = GetScreen()->GetPageSettings().GetHeightIU( schIUScale.IU_PER_MILS );
2338 bBoxDoc = BOX2I( VECTOR2I( 0, 0 ), VECTOR2I( sizeX, sizeY ) );
2339 }
2340 else
2341 {
2342 // Get current drawing-sheet in a form we can compare to an EDA_ITEM
2344 EDA_ITEM* dsAsItem = static_cast<EDA_ITEM*>( ds );
2345
2346 // Calc the bounding box of all items on screen except the page border
2347 for( EDA_ITEM* item : GetScreen()->Items() )
2348 {
2349 if( item != dsAsItem ) // Ignore the drawing-sheet itself
2350 bBoxDoc.Merge( item->GetBoundingBox() );
2351 }
2352 }
2353
2354 return bBoxDoc;
2355}
2356
2357
2359{
2360 return Schematic().IsHierarchyModified();
2361}
2362
2363
2365{
2366 EESCHEMA_SETTINGS* cfg = eeconfig();
2367 return cfg && cfg->m_Appearance.show_hidden_pins;
2368}
2369
2370
2371void SCH_EDIT_FRAME::FocusOnItem( EDA_ITEM* aItem, bool aAllowScroll )
2372{
2373 // nullptr will clear the current focus
2374 if( aItem != nullptr && !aItem->IsSCH_ITEM() )
2375 return;
2376
2377 static KIID lastBrightenedItemID( niluuid );
2378
2379 SCH_ITEM* lastItem = Schematic().ResolveItem( lastBrightenedItemID, nullptr, true );
2380
2381 if( lastItem && lastItem != aItem )
2382 {
2383 lastItem->ClearBrightened();
2384
2385 UpdateItem( lastItem );
2386 lastBrightenedItemID = niluuid;
2387 }
2388
2389 if( aItem )
2390 {
2391 if( !aItem->IsBrightened() )
2392 {
2393 aItem->SetBrightened();
2394
2395 UpdateItem( aItem );
2396 lastBrightenedItemID = aItem->m_Uuid;
2397 }
2398
2399 FocusOnLocation( aItem->GetFocusPosition(), aAllowScroll );
2400 }
2401}
2402
2403
2405{
2406 return Schematic().GetFileName();
2407}
2408
2409
2411{
2412 return m_toolManager->GetTool<SCH_SELECTION_TOOL>()->GetSelection();
2413}
2414
2416 const KIID& aSchematicSymbolUUID )
2417{
2418 SCH_SHEET_PATH principalPath;
2419 SCH_SHEET_LIST sheets = Schematic().Hierarchy();
2420 SCH_ITEM* item = sheets.ResolveItem( aSchematicSymbolUUID, &principalPath, true );
2421 SCH_SYMBOL* principalSymbol = dynamic_cast<SCH_SYMBOL*>( item );
2422 SCH_COMMIT commit( m_toolManager );
2423
2424 if( !principalSymbol )
2425 return false;
2426
2427 wxString principalRef;
2428
2429 if( principalSymbol->IsAnnotated( &principalPath ) )
2430 principalRef = principalSymbol->GetRef( &principalPath, false );
2431
2432 std::vector< std::pair<SCH_SYMBOL*, SCH_SHEET_PATH> > allUnits;
2433
2434 for( const SCH_SHEET_PATH& path : sheets )
2435 {
2436 for( SCH_ITEM* candidate : path.LastScreen()->Items().OfType( SCH_SYMBOL_T ) )
2437 {
2438 SCH_SYMBOL* candidateSymbol = static_cast<SCH_SYMBOL*>( candidate );
2439
2440 if( candidateSymbol == principalSymbol
2441 || ( candidateSymbol->IsAnnotated( &path )
2442 && candidateSymbol->GetRef( &path, false ) == principalRef ) )
2443 {
2444 allUnits.emplace_back( candidateSymbol, path );
2445 }
2446 }
2447 }
2448
2449 for( auto& [ unit, path ] : allUnits )
2450 {
2451 // This needs to be done before the LIB_SYMBOL is changed to prevent stale
2452 // library symbols in the schematic file.
2453 path.LastScreen()->Remove( unit );
2454
2455 if( !unit->IsNew() )
2456 commit.Modify( unit, path.LastScreen() );
2457
2458 unit->SetLibSymbol( aSymbol.Flatten().release() );
2459 unit->UpdateFields( &GetCurrentSheet(),
2460 true, /* update style */
2461 true, /* update ref */
2462 true, /* update other fields */
2463 false, /* reset ref */
2464 false /* reset other fields */ );
2465
2466 path.LastScreen()->Append( unit );
2467 GetCanvas()->GetView()->Update( unit );
2468 }
2469
2470 // Clear any orphaned alternate pins.
2471 for( SCH_PIN* pin : principalSymbol->GetGraphicalPins( ALL_UNITS, ALL_BODY_STYLES ) )
2472 {
2473 wxString altName = pin->GetAlt();
2474
2475 if( altName.IsEmpty() )
2476 continue;
2477
2478 if( pin->GetAlternates().count( altName ) == 0 )
2479 pin->SetAlt( wxEmptyString );
2480 }
2481
2482 if( !commit.Empty() )
2483 commit.Push( _( "Save Symbol to Schematic" ) );
2484
2485 return true;
2486}
2487
2488
2489void SCH_EDIT_FRAME::UpdateItem( EDA_ITEM* aItem, bool isAddOrDelete, bool aUpdateRtree )
2490{
2491 SCH_BASE_FRAME::UpdateItem( aItem, isAddOrDelete, aUpdateRtree );
2492
2493 if( SCH_ITEM* sch_item = dynamic_cast<SCH_ITEM*>( aItem ) )
2494 sch_item->ClearCaches();
2495}
2496
2497
2499{
2500 wxCHECK( m_toolManager, /* void */ );
2501
2505
2506 wxCHECK( screen, /* void */ );
2507
2509
2510 SCH_BASE_FRAME::SetScreen( screen );
2511
2512 SetSheetNumberAndCount(); // will also update CurrentScreen()'s sheet number info
2513
2515
2516 // update the references, units, and intersheet-refs
2518
2519 // dangling state can also have changed if different units with different pin locations are
2520 // used
2523
2524 SCH_SELECTION_TOOL* selectionTool = m_toolManager->GetTool<SCH_SELECTION_TOOL>();
2525
2526 wxCHECK( selectionTool, /* void */ );
2527
2528 auto visit =
2529 [&]( EDA_ITEM* item )
2530 {
2532 && !m_findReplaceData->findString.IsEmpty()
2533 && item->Matches( *m_findReplaceData, &GetCurrentSheet() ) )
2534 {
2535 item->SetForceVisible( true );
2536 selectionTool->BrightenItem( item );
2537 }
2538 else if( item->IsBrightened() )
2539 {
2540 item->SetForceVisible( false );
2541 selectionTool->UnbrightenItem( item );
2542 }
2543 };
2544
2545 for( SCH_ITEM* item : screen->Items() )
2546 {
2547 visit( item );
2548
2549 item->RunOnChildren(
2550 [&]( SCH_ITEM* aChild )
2551 {
2552 visit( aChild );
2553 },
2555 }
2556
2557 if( !screen->m_zoomInitialized )
2558 {
2560 }
2561 else
2562 {
2563 // Set zoom to last used in this screen
2564 GetCanvas()->GetView()->SetScale( GetScreen()->m_LastZoomLevel );
2565 GetCanvas()->GetView()->SetCenter( GetScreen()->m_ScrollCenter );
2566 }
2567
2568 updateTitle();
2569
2570 HardRedraw(); // Ensure all items are redrawn (especially the drawing-sheet items)
2571
2572 // Allow tools to re-add their VIEW_ITEMs after the last call to Clear in HardRedraw
2574
2575 SCH_EDITOR_CONTROL* editTool = m_toolManager->GetTool<SCH_EDITOR_CONTROL>();
2576
2577 wxCHECK( editTool, /* void */ );
2578
2580 editTool->UpdateNetHighlighting( dummy );
2581
2582 m_hierarchy->UpdateHierarchySelection();
2583
2584 m_schematic->OnSchSheetChanged();
2585
2586 std::string sheetPath = TO_UTF8( GetCurrentSheet().PathAsString() );
2588}
2589
2590
2592{
2593 if( !m_diffSymbolDialog )
2594 {
2596 _( "Compare Symbol with Library" ) );
2597
2598 m_diffSymbolDialog->m_sdbSizerApply->SetLabel( _( "Update Symbol from Library..." ) );
2599 m_diffSymbolDialog->m_sdbSizerApply->PostSizeEventToParent();
2600 m_diffSymbolDialog->m_sdbSizerApply->Show();
2601 }
2602
2603 return m_diffSymbolDialog;
2604}
2605
2606
2607void SCH_EDIT_FRAME::onCloseSymbolDiffDialog( wxCommandEvent& aEvent )
2608{
2609 if( m_diffSymbolDialog && aEvent.GetString() == DIFF_SYMBOLS_DIALOG_NAME )
2610 {
2611 if( aEvent.GetId() == wxID_APPLY )
2612 {
2613 KIID symbolUUID = m_diffSymbolDialog->GetUserItemID();
2614
2615 CallAfter(
2616 [this, symbolUUID]()
2617 {
2618 EDA_ITEM* item = ResolveItem( symbolUUID );
2619
2620 if( SCH_SYMBOL* symbol = dynamic_cast<SCH_SYMBOL*>( item ) )
2621 {
2622 m_toolManager->RunAction<EDA_ITEM*>( ACTIONS::selectItem, symbol );
2623
2625 dlg.ShowQuasiModal();
2626 }
2627 } );
2628 }
2629
2630 m_diffSymbolDialog->Destroy();
2631 m_diffSymbolDialog = nullptr;
2632 }
2633}
2634
2635
2637{
2638 if( !m_ercDialog )
2639 m_ercDialog = new DIALOG_ERC( this );
2640
2641 return m_ercDialog;
2642}
2643
2644
2646{
2648
2649 if( m_ercDialog )
2650 {
2651 m_ercDialog->DeleteAllMarkers( true );
2652 }
2653 else
2654 {
2656 SCH_SCREENS screens( Schematic().Root() );
2658 }
2659}
2660
2661
2663{
2664 if( m_ercDialog )
2665 m_ercDialog->UpdateData();
2666
2667 for( SCH_ITEM* marker : GetScreen()->Items().OfType( SCH_MARKER_T ) )
2668 {
2669 GetCanvas()->GetView()->Remove( marker );
2670 GetCanvas()->GetView()->Add( marker );
2671 }
2672
2673 GetCanvas()->Refresh();
2674}
2675
2676
2677void SCH_EDIT_FRAME::onCloseErcDialog( wxCommandEvent& aEvent )
2678{
2679 if( m_ercDialog )
2680 {
2681 m_ercDialog->Destroy();
2682 m_ercDialog = nullptr;
2683 }
2684}
2685
2686
2688{
2690 {
2691 auto* dlg = new DIALOG_SYMBOL_FIELDS_TABLE( this );
2692
2693 if( dlg->WasAborted() )
2694 {
2695 dlg->Destroy();
2696 return nullptr;
2697 }
2698
2700 }
2701
2703}
2704
2705
2707{
2708 return m_netNavigator;
2709}
2710
2711
2713{
2715 {
2716 m_symbolFieldsTableDialog->Destroy();
2717 m_symbolFieldsTableDialog = nullptr;
2718 }
2719}
2720
2721
2722void SCH_EDIT_FRAME::AddSchematicChangeListener( wxEvtHandler* aListener )
2723{
2724 auto it = std::find( m_schematicChangeListeners.begin(), m_schematicChangeListeners.end(), aListener );
2725
2726 // Don't add duplicate listeners.
2727 if( it == m_schematicChangeListeners.end() )
2728 m_schematicChangeListeners.push_back( aListener );
2729}
2730
2731
2733{
2734 auto it = std::find( m_schematicChangeListeners.begin(), m_schematicChangeListeners.end(), aListener );
2735
2736 // Don't add duplicate listeners.
2737 if( it != m_schematicChangeListeners.end() )
2738 m_schematicChangeListeners.erase( it );
2739}
2740
2741
2743{
2744 wxPanel* panel = new wxPanel( this );
2745
2746 wxBoxSizer* sizer = new wxBoxSizer( wxVERTICAL );
2747
2748 // Create horizontal sizer for search control and gear button
2749 wxBoxSizer* searchSizer = new wxBoxSizer( wxHORIZONTAL );
2750
2751 m_netNavigatorFilter = new wxSearchCtrl( panel, wxID_ANY );
2752 m_netNavigatorFilter->SetDescriptiveText( _( "Filter nets" ) );
2753 m_netNavigatorFilter->ShowCancelButton( false );
2754 searchSizer->Add( m_netNavigatorFilter, 1, wxEXPAND | wxRIGHT, FromDIP( 2 ) );
2755
2756 m_netNavigatorMenuButton = new BITMAP_BUTTON( panel, wxID_ANY );
2758 m_netNavigatorMenuButton->SetPadding( 2 );
2759 searchSizer->Add( m_netNavigatorMenuButton, 0, wxALIGN_CENTER_VERTICAL );
2760
2761 sizer->Add( searchSizer, 0, wxEXPAND | wxALL, FromDIP( 2 ) );
2762
2763 m_netNavigator = new NET_NAVIGATOR_TREE( panel, wxID_ANY, wxPoint( 0, 0 ), FromDIP( wxSize( 160, 250 ) ),
2764 wxTR_DEFAULT_STYLE | wxNO_BORDER );
2765 sizer->Add( m_netNavigator, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, FromDIP( 2 ) );
2766
2767 panel->SetSizer( sizer );
2768
2769 panel->Bind( wxEVT_SHOW,
2770 [this]( wxShowEvent& event )
2771 {
2772 event.Skip();
2773
2774 if( event.IsShown() )
2775 {
2776 CallAfter(
2777 [this]
2778 {
2781 } );
2782 }
2783 } );
2784
2785 m_netNavigator->Bind( wxEVT_DPI_CHANGED, &SCH_EDIT_FRAME::onNetNavigatorDPIChanged, this );
2786 m_netNavigatorFilter->Bind( wxEVT_COMMAND_TEXT_UPDATED, &SCH_EDIT_FRAME::onNetNavigatorFilterChanged, this );
2787 m_netNavigatorFilter->Bind( wxEVT_KEY_DOWN, &SCH_EDIT_FRAME::onNetNavigatorKey, this );
2788 m_netNavigator->Bind( wxEVT_KEY_DOWN, &SCH_EDIT_FRAME::onNetNavigatorKey, this );
2789 m_netNavigator->Bind( wxEVT_TREE_ITEM_MENU, &SCH_EDIT_FRAME::onNetNavigatorItemMenu, this );
2790 m_netNavigator->Bind( wxEVT_CONTEXT_MENU, &SCH_EDIT_FRAME::onNetNavigatorContextMenu, this );
2791
2792 m_netNavigatorMenuButton->Bind( wxEVT_LEFT_DOWN,
2793 [this]( wxMouseEvent& event )
2794 {
2795 wxMenu menu;
2796 wxMenuItem* wildcardItem = menu.AppendRadioItem( ID_NET_NAVIGATOR_SEARCH_WILDCARD,
2797 _( "Wildcard Search" ) );
2798 wxMenuItem* regexItem = menu.AppendRadioItem( ID_NET_NAVIGATOR_SEARCH_REGEX,
2799 _( "Regex Search" ) );
2800
2801 EESCHEMA_SETTINGS* cfg = eeconfig();
2802
2804 wildcardItem->Check();
2805 else
2806 regexItem->Check();
2807
2808 PopupMenu( &menu );
2809 } );
2810
2816
2817 return panel;
2818}
2819
2820
2821void SCH_EDIT_FRAME::SetHighlightedConnection( const wxString& aConnection, const NET_NAVIGATOR_ITEM_DATA* aSelection,
2822 bool aForceNetNavigatorRefresh )
2823{
2824 bool connectionChanged = aConnection != m_highlightedConn;
2825
2826 m_highlightedConn = aConnection;
2827
2828 if( connectionChanged || aForceNetNavigatorRefresh )
2829 RefreshNetNavigator( aSelection );
2830
2831 if( connectionChanged && m_hierarchy )
2832 m_hierarchy->UpdateNetHighlight( aConnection );
2833}
2834
2835
2837{
2839
2840 if( m_netNavigator )
2841 {
2842 NET_NAVIGATOR_ITEM_DATA itemData;
2843 wxTreeItemId selection = m_netNavigator->GetSelection();
2844 bool refreshSelection = selection.IsOk() && selection != m_netNavigator->GetRootItem();
2845
2846 if( refreshSelection )
2847 {
2849 dynamic_cast<NET_NAVIGATOR_ITEM_DATA*>( m_netNavigator->GetItemData( selection ) );
2850
2851 wxCHECK( tmp, /* void */ );
2852 itemData = *tmp;
2853 }
2854
2855 m_netNavigator->DeleteAllItems();
2856 RefreshNetNavigator( refreshSelection ? &itemData : nullptr );
2857 }
2858}
2859
2860
2862{
2863 if( !m_netNavigator )
2864 return;
2865
2866 wxString newFilter = m_netNavigatorFilter ? m_netNavigatorFilter->GetValue() : wxString();
2867
2868 if( newFilter == m_netNavigatorFilterValue )
2869 return;
2870
2871 m_netNavigatorFilterValue = newFilter;
2872
2873 NET_NAVIGATOR_ITEM_DATA selectionData;
2874 NET_NAVIGATOR_ITEM_DATA* selectionPtr = nullptr;
2875
2876 wxTreeItemId selection = m_netNavigator->GetSelection();
2877
2878 if( selection.IsOk() )
2879 {
2880 if( NET_NAVIGATOR_ITEM_DATA* tmp =
2881 dynamic_cast<NET_NAVIGATOR_ITEM_DATA*>( m_netNavigator->GetItemData( selection ) ) )
2882 {
2883 selectionData = *tmp;
2884 selectionPtr = &selectionData;
2885 }
2886 }
2887
2888 RefreshNetNavigator( selectionPtr );
2889
2890 aEvent.Skip();
2891}
2892
2893
2894void SCH_EDIT_FRAME::onNetNavigatorKey( wxKeyEvent& aEvent )
2895{
2896 if( aEvent.GetKeyCode() == WXK_ESCAPE )
2897 {
2898 // Clear the search string and refresh
2900 m_netNavigatorFilter->SetValue( wxEmptyString );
2901
2902 m_netNavigatorFilterValue = wxEmptyString;
2903
2905
2906 // Don't skip the event - we handled it
2907 return;
2908 }
2909
2910 aEvent.Skip();
2911}
2912
2913
2914
2916{
2917 showNetNavigatorMenu( aEvent.GetItem() );
2918}
2919
2920
2921void SCH_EDIT_FRAME::onNetNavigatorContextMenu( wxContextMenuEvent& aEvent )
2922{
2923 if( !m_netNavigator )
2924 return;
2925
2926 wxPoint screenPos = aEvent.GetPosition();
2927
2928 if( screenPos == wxDefaultPosition )
2929 screenPos = wxGetMousePosition();
2930
2931 wxPoint clientPos = m_netNavigator->ScreenToClient( screenPos );
2932 int flags = 0;
2933 wxTreeItemId item = m_netNavigator->HitTest( clientPos, flags );
2934
2935 showNetNavigatorMenu( item );
2936}
2937
2938
2939void SCH_EDIT_FRAME::showNetNavigatorMenu( const wxTreeItemId& aItem )
2940{
2941 if( !m_netNavigator )
2942 return;
2943
2944 wxMenu menu;
2945
2946 menu.Append( ID_NET_NAVIGATOR_EXPAND_ALL, _( "Expand All" ) );
2947 menu.Append( ID_NET_NAVIGATOR_COLLAPSE_ALL, _( "Collapse All" ) );
2948
2949 wxMenuItem* findInInspector = new wxMenuItem( &menu, ID_NET_NAVIGATOR_FIND_IN_INSPECTOR,
2950 _( "Find in Net Inspector" ) );
2951 menu.Append( findInInspector );
2952
2953 wxString netName;
2954
2955 if( aItem.IsOk() )
2956 {
2957 wxTreeItemId netItem = aItem;
2958
2959 if( m_netNavigator->GetItemParent( netItem ) != m_netNavigator->GetRootItem() )
2960 {
2961 wxTreeItemId parent = m_netNavigator->GetItemParent( netItem );
2962
2963 while( parent.IsOk() && parent != m_netNavigator->GetRootItem() )
2964 {
2965 netItem = parent;
2966 parent = m_netNavigator->GetItemParent( netItem );
2967 }
2968
2969 if( parent == m_netNavigator->GetRootItem() )
2970 {
2971 if( wxStringClientData* data =
2972 dynamic_cast<wxStringClientData*>( m_netNavigator->GetItemData( netItem ) ) )
2973 {
2974 netName = data->GetData();
2975 }
2976 }
2977 }
2978 else if( m_netNavigator->GetItemParent( netItem ) == m_netNavigator->GetRootItem() )
2979 {
2980 if( wxStringClientData* data =
2981 dynamic_cast<wxStringClientData*>( m_netNavigator->GetItemData( netItem ) ) )
2982 {
2983 netName = data->GetData();
2984 }
2985 }
2986 else if( !m_highlightedConn.IsEmpty() && netItem == m_netNavigator->GetRootItem() )
2987 {
2988 netName = m_highlightedConn;
2989 }
2990 }
2991 else if( !m_highlightedConn.IsEmpty() && m_netNavigator->GetRootItem().IsOk() )
2992 {
2993 netName = m_highlightedConn;
2994 }
2995
2996 if( netName.IsEmpty() )
2997 {
2998 findInInspector->Enable( false );
3000 }
3001 else
3002 {
3003 m_netNavigatorMenuNetName = netName;
3004 }
3005
3006 PopupMenu( &menu );
3007}
3008
3009
3010void SCH_EDIT_FRAME::onNetNavigatorMenuCommand( wxCommandEvent& aEvent )
3011{
3012 if( !m_netNavigator )
3013 return;
3014
3015 switch( aEvent.GetId() )
3016 {
3018 m_netNavigator->ExpandAll();
3019 break;
3020
3022 m_netNavigator->CollapseAll();
3023
3024 if( m_netNavigator->GetRootItem().IsOk() )
3025 m_netNavigator->Expand( m_netNavigator->GetRootItem() );
3026 break;
3027
3029 if( !m_netNavigatorMenuNetName.IsEmpty() )
3031 break;
3032
3035 if( EESCHEMA_SETTINGS* cfg = eeconfig() )
3036 {
3037 cfg->m_AuiPanels.net_nav_search_mode_wildcard = ( aEvent.GetId() == ID_NET_NAVIGATOR_SEARCH_WILDCARD );
3038
3039 // Refresh the navigator with current filter
3041 }
3042
3043 break;
3044
3045 default:
3046 aEvent.Skip();
3047 return;
3048 }
3049
3051
3052 aEvent.Skip( false );
3053}
3054
3055
3057{
3058 wxAuiPaneInfo& hierarchyPane = m_auimgr.GetPane( SchematicHierarchyPaneName() );
3059 wxAuiPaneInfo& netNavigatorPane = m_auimgr.GetPane( NetNavigatorPaneName() );
3060 wxAuiPaneInfo& propertiesPane = m_auimgr.GetPane( PropertiesPaneName() );
3061 wxAuiPaneInfo& selectionFilterPane = m_auimgr.GetPane( wxS( "SelectionFilter" ) );
3062
3063 // Don't give the selection filter its own visibility controls; instead show it if
3064 // anything else is visible
3065 bool showFilter = ( hierarchyPane.IsShown() && hierarchyPane.IsDocked() )
3066 || ( netNavigatorPane.IsShown() && netNavigatorPane.IsDocked() )
3067 || ( propertiesPane.IsShown() && propertiesPane.IsDocked() );
3068
3069 selectionFilterPane.Show( showFilter );
3070}
3071
3072
3074{
3075 wxLogTrace( traceApi, "SCH frame: EDA_EVT_PLUGIN_AVAILABILITY_CHANGED" );
3078 aEvt.Skip();
3079}
3080
3081
3083{
3084 EESCHEMA_SETTINGS* cfg = eeconfig();
3085
3086 // Ensure m_show_search is up to date (the pane can be closed outside the menu)
3087 m_show_search = m_auimgr.GetPane( SearchPaneName() ).IsShown();
3088
3090
3091 wxAuiPaneInfo& searchPaneInfo = m_auimgr.GetPane( SearchPaneName() );
3092 searchPaneInfo.Show( m_show_search );
3093
3094 if( m_show_search )
3095 {
3096 searchPaneInfo.Direction( cfg->m_AuiPanels.search_panel_dock_direction );
3097
3098 if( cfg->m_AuiPanels.search_panel_dock_direction == wxAUI_DOCK_TOP
3099 || cfg->m_AuiPanels.search_panel_dock_direction == wxAUI_DOCK_BOTTOM )
3100 {
3101 SetAuiPaneSize( m_auimgr, searchPaneInfo, -1, cfg->m_AuiPanels.search_panel_height );
3102 }
3103 else if( cfg->m_AuiPanels.search_panel_dock_direction == wxAUI_DOCK_LEFT
3104 || cfg->m_AuiPanels.search_panel_dock_direction == wxAUI_DOCK_RIGHT )
3105 {
3106 SetAuiPaneSize( m_auimgr, searchPaneInfo, cfg->m_AuiPanels.search_panel_width, -1 );
3107 }
3108
3109 m_searchPane->FocusSearch();
3110 m_searchPane->RefreshSearch();
3111 }
3112 else
3113 {
3114 cfg->m_AuiPanels.search_panel_height = m_searchPane->GetSize().y;
3115 cfg->m_AuiPanels.search_panel_width = m_searchPane->GetSize().x;
3116 cfg->m_AuiPanels.search_panel_dock_direction = searchPaneInfo.dock_direction;
3117 m_auimgr.Update();
3118 }
3119}
3120
3121
3123{
3124 if( !m_propertiesPanel )
3125 return;
3126
3127 bool show = !m_propertiesPanel->IsShownOnScreen();
3128
3129 wxAuiPaneInfo& propertiesPaneInfo = m_auimgr.GetPane( PropertiesPaneName() );
3130 propertiesPaneInfo.Show( show );
3131
3133
3134 EESCHEMA_SETTINGS* settings = eeconfig();
3135
3136 if( show )
3137 {
3138 SetAuiPaneSize( m_auimgr, propertiesPaneInfo, settings->m_AuiPanels.properties_panel_width, -1 );
3139 }
3140 else
3141 {
3142 settings->m_AuiPanels.properties_panel_width = m_propertiesPanel->GetSize().x;
3143 m_auimgr.Update();
3144 }
3145}
3146
3147
3149{
3150 EESCHEMA_SETTINGS* cfg = eeconfig();
3151
3152 wxCHECK( cfg, /* void */ );
3153
3154 wxAuiPaneInfo& hierarchy_pane = m_auimgr.GetPane( SchematicHierarchyPaneName() );
3155
3156 hierarchy_pane.Show( !hierarchy_pane.IsShown() );
3157
3159
3160 if( hierarchy_pane.IsShown() )
3161 {
3162 if( hierarchy_pane.IsFloating() )
3163 {
3164 hierarchy_pane.FloatingSize( cfg->m_AuiPanels.hierarchy_panel_float_width,
3166 m_auimgr.Update();
3167 }
3168 else if( cfg->m_AuiPanels.hierarchy_panel_docked_width > 0 )
3169 {
3170 // SetAuiPaneSize also updates m_auimgr
3172 }
3173 }
3174 else
3175 {
3176 if( hierarchy_pane.IsFloating() )
3177 {
3178 cfg->m_AuiPanels.hierarchy_panel_float_width = hierarchy_pane.floating_size.x;
3179 cfg->m_AuiPanels.hierarchy_panel_float_height = hierarchy_pane.floating_size.y;
3180 }
3181 else
3182 {
3184 }
3185
3186 m_auimgr.Update();
3187 }
3188}
3189
3190
3192{
3193 EESCHEMA_SETTINGS* cfg = eeconfig();
3194
3195 wxCHECK( cfg, /* void */ );
3196
3197 wxAuiPaneInfo& db_library_pane = m_auimgr.GetPane( DesignBlocksPaneName() );
3198
3199 db_library_pane.Show( !db_library_pane.IsShown() );
3200
3201 if( db_library_pane.IsShown() )
3202 {
3203 if( db_library_pane.IsFloating() )
3204 {
3205 db_library_pane.FloatingSize( cfg->m_AuiPanels.design_blocks_panel_float_width,
3207 m_auimgr.Update();
3208 }
3209 else
3210 {
3211 // SetAuiPaneSize also updates m_auimgr
3212 SetAuiPaneSize( m_auimgr, db_library_pane,
3214 }
3215 }
3216 else
3217 {
3218 if( db_library_pane.IsFloating() )
3219 {
3220 cfg->m_AuiPanels.design_blocks_panel_float_width = db_library_pane.floating_size.x;
3221 cfg->m_AuiPanels.design_blocks_panel_float_height = db_library_pane.floating_size.y;
3222 }
3223 else
3224 {
3226 }
3227
3228 m_auimgr.Update();
3229 }
3230}
3231
3232
3234{
3235 EESCHEMA_SETTINGS* cfg = eeconfig();
3236
3237 wxCHECK( cfg, /* void */ );
3238
3239 wxAuiPaneInfo& remotePane = m_auimgr.GetPane( RemoteSymbolPaneName() );
3240
3241 remotePane.Show( !remotePane.IsShown() );
3242
3243 if( remotePane.IsShown() )
3244 {
3245 if( m_remoteSymbolPane )
3246 m_remoteSymbolPane->Activate();
3247
3248 if( remotePane.IsFloating() )
3249 {
3250 remotePane.FloatingSize( cfg->m_AuiPanels.remote_symbol_panel_float_width,
3252 m_auimgr.Update();
3253 }
3255 {
3256 SetAuiPaneSize( m_auimgr, remotePane,
3258 }
3259 }
3260 else
3261 {
3262 if( remotePane.IsFloating() )
3263 {
3264 cfg->m_AuiPanels.remote_symbol_panel_float_width = remotePane.floating_size.x;
3265 cfg->m_AuiPanels.remote_symbol_panel_float_height = remotePane.floating_size.y;
3266 }
3267 else if( m_remoteSymbolPane )
3268 {
3270 }
3271
3272 m_auimgr.Update();
3273 }
3274}
3275
3276
3278{
3279 wxCHECK( aSchematic, /* void */ );
3281 m_netNavigatorStale = true;
3283
3284 if( m_netNavigator )
3285 m_netNavigator->DeleteAllItems();
3286
3287 if( m_schematic )
3288 {
3291 SetScreen( nullptr );
3292 m_schematic->SetProject( nullptr );
3293
3294 // Detach before the outgoing schematic (and its tracker) is freed.
3295 if( GetCanvas() && GetCanvas()->GetView() )
3297
3299 }
3300
3301 aSchematic->SetProject( &Prj() );
3302 delete m_schematic;
3303
3304 m_schematic = aSchematic;
3305 m_schematic->SetSchematicHolder( this );
3306
3307 KIGFX::SCH_VIEW* view = GetCanvas()->GetView();
3308 static_cast<KIGFX::SCH_PAINTER*>( view->GetPainter() )->SetSchematic( m_schematic );
3309 m_toolManager->SetEnvironment( m_schematic, GetCanvas()->GetView(), GetCanvas()->GetViewControls(), config(),
3310 this );
3312}
3313
3314
3316{
3318 return;
3319
3320 m_currentVariantCtrl->SetSelection( m_currentVariantCtrl->GetCount() - 1 );
3321
3322 wxCommandEvent dummy( wxEVT_CHOICE, ID_TOOLBAR_SCH_SELECT_VARAIANT );
3324}
3325
3326
3328{
3329 wxArrayString choices = Schematic().GetVariantNamesForUI();
3330
3331 // Default variant cannot be edited.
3332 choices.RemoveAt( 0 );
3333
3334 if( choices.IsEmpty() )
3335 {
3336 GetInfoBar()->ShowMessageFor( _( "No design variants to edit." ), 10000, wxICON_ERROR );
3337 return;
3338 }
3339
3340 wxSingleChoiceDialog chooser( this, _( "Select variant to edit description:" ) + wxS( " " ),
3341 _( "Edit Variant Description" ), choices );
3342 chooser.Layout();
3343
3344 if( chooser.ShowModal() == wxID_CANCEL )
3345 return;
3346
3347 wxString variantName = chooser.GetStringSelection();
3348
3349 if( variantName.IsEmpty() )
3350 return;
3351
3352 wxString currentDesc = Schematic().GetVariantDescription( variantName );
3353
3354 wxDialog dlg( this, wxID_ANY, wxString::Format( _( "Edit Description for '%s'" ), variantName ), wxDefaultPosition,
3355 wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER );
3356
3357 wxBoxSizer* mainSizer = new wxBoxSizer( wxVERTICAL );
3358
3359 wxStaticText* label = new wxStaticText( &dlg, wxID_ANY, _( "Description:" ) );
3360 mainSizer->Add( label, 0, wxLEFT | wxRIGHT | wxTOP | wxEXPAND, 10 );
3361
3362 mainSizer->AddSpacer( 3 );
3363
3364 wxTextCtrl* descCtrl = new wxTextCtrl( &dlg, wxID_ANY, currentDesc, wxDefaultPosition, wxSize( 400, 60 ),
3365 wxTE_MULTILINE );
3366 mainSizer->Add( descCtrl, 1, wxLEFT | wxRIGHT | wxBOTTOM | wxEXPAND, 10 );
3367
3368 wxStdDialogButtonSizer* btnSizer = new wxStdDialogButtonSizer();
3369 btnSizer->AddButton( new wxButton( &dlg, wxID_OK ) );
3370 btnSizer->AddButton( new wxButton( &dlg, wxID_CANCEL ) );
3371 btnSizer->Realize();
3372 mainSizer->Add( btnSizer, 0, wxALL | wxALIGN_RIGHT, 5 );
3373
3374 dlg.SetSizer( mainSizer );
3375 dlg.Fit();
3376 dlg.Centre();
3377
3378 if( dlg.ShowModal() == wxID_CANCEL )
3379 return;
3380
3381 wxString newDesc = descCtrl->GetValue().Trim().Trim( false );
3382
3383 Schematic().SetVariantDescription( variantName, newDesc );
3384 OnModify();
3385 GetCanvas()->Refresh();
3386}
3387
3388
3390{
3392 return;
3393
3394 wxArrayString choices = Schematic().GetVariantNamesForUI();
3395
3396 // Default variant cannot be removed.
3397 choices.RemoveAt( 0 );
3398
3399 // wxSingleChoiceDialog will ellipsize the title bar if the contents aren't wide enough. The set
3400 // of spaces in the control label are to prevent this.
3401 wxSingleChoiceDialog dlg( this, _( "Select variant name to remove:" ) + wxS( " " ),
3402 _( "Remove Design Variant" ), choices );
3403 dlg.Layout();
3404
3405 if( dlg.ShowModal() == wxID_CANCEL )
3406 return;
3407
3408 wxString variantName = dlg.GetStringSelection();
3409
3410 if( variantName.IsEmpty() )
3411 return;
3412
3414 SCH_COMMIT commit( this );
3415 bool append = false;
3416
3417 Schematic().DeleteVariant( variantName, &commit );
3418
3419 if( !commit.Empty() )
3420 {
3421 commit.Push();
3422 append = true;
3423 }
3424
3425 PICKED_ITEMS_LIST undoCmd;
3426 undoCmd.PushItem( ITEM_PICKER( GetScreen(), undoItem, UNDO_REDO::VARIANTS ) );
3427 undoCmd.SetDescription( _( "Delete Variant" ) );
3428 SaveCopyInUndoList( undoCmd, UNDO_REDO::VARIANTS, append );
3429
3430 OnModify();
3431
3432 if( Schematic().GetCurrentVariant() == variantName )
3433 SetCurrentVariant( wxEmptyString );
3434
3435 UpdateVariantSelectionCtrl( Schematic().GetVariantNamesForUI() );
3436
3437 GetCanvas()->Refresh();
3438}
3439
3440
3441bool SCH_EDIT_FRAME::ValidateNewVariantName( const wxString& aName, const wxString& aExcludeName )
3442{
3443 if( aName.IsEmpty() )
3444 {
3445 GetInfoBar()->ShowMessageFor( _( "Variant name cannot be empty." ), 10000, wxICON_ERROR );
3446 return false;
3447 }
3448
3449 if( aName.CmpNoCase( GetDefaultVariantName() ) == 0 )
3450 {
3451 GetInfoBar()->ShowMessageFor( wxString::Format( _( "'%s' is a reserved variant name." ),
3453 10000, wxICON_ERROR );
3454 return false;
3455 }
3456
3457 for( const wxString& existingName : Schematic().GetVariantNames() )
3458 {
3459 if( existingName.CmpNoCase( aName ) == 0 && existingName.CmpNoCase( aExcludeName ) != 0 )
3460 {
3461 GetInfoBar()->ShowMessageFor( wxString::Format( _( "Variant '%s' already exists." ), existingName ),
3462 10000, wxICON_ERROR );
3463 return false;
3464 }
3465 }
3466
3467 return true;
3468}
3469
3470
3472{
3473 wxArrayString choices = Schematic().GetVariantNamesForUI();
3474
3475 // Default variant cannot be renamed.
3476 choices.RemoveAt( 0 );
3477
3478 if( choices.IsEmpty() )
3479 {
3480 GetInfoBar()->ShowMessageFor( _( "No variants to rename." ), 10000, wxICON_INFORMATION );
3481 return;
3482 }
3483
3484 wxSingleChoiceDialog selDlg( this, _( "Select variant to rename:" ) + wxS( " " ),
3485 _( "Rename Design Variant" ), choices );
3486 selDlg.Layout();
3487
3488 if( selDlg.ShowModal() == wxID_CANCEL )
3489 return;
3490
3491 wxString oldName = selDlg.GetStringSelection();
3492
3493 if( oldName.IsEmpty() )
3494 return;
3495
3496 wxTextEntryDialog nameDlg( this, _( "Enter new variant name:" ), _( "Rename Design Variant" ),
3497 oldName, wxOK | wxCANCEL | wxCENTER );
3498
3499 if( nameDlg.ShowModal() == wxID_CANCEL )
3500 return;
3501
3502 wxString newName = nameDlg.GetValue().Trim().Trim( false );
3503
3504 if( newName == oldName )
3505 return;
3506
3507 if( !ValidateNewVariantName( newName, oldName ) )
3508 return;
3509
3510 // The model retargets the current variant to the new name, so capture whether the toolbar was
3511 // showing the variant being renamed before the rename runs.
3512 bool wasCurrent = Schematic().GetCurrentVariant() == oldName;
3513
3515 SCH_COMMIT commit( this );
3516 bool append = false;
3517
3518 Schematic().RenameVariant( oldName, newName, &commit );
3519
3520 if( !commit.Empty() )
3521 {
3522 commit.Push();
3523 append = true;
3524 }
3525
3526 PICKED_ITEMS_LIST undoCmd;
3527 undoCmd.PushItem( ITEM_PICKER( GetScreen(), undoItem, UNDO_REDO::VARIANTS ) );
3528 undoCmd.SetDescription( _( "Rename Variant" ) );
3529 SaveCopyInUndoList( undoCmd, UNDO_REDO::VARIANTS, append );
3530
3531 // The registry entry changes even when no symbol carries an override, so always mark dirty.
3532 OnModify();
3533
3534 UpdateVariantSelectionCtrl( Schematic().GetVariantNamesForUI() );
3535
3536 // The renamed label just disappeared from the control, so a plain repopulate falls back to the
3537 // default selection. Re-selecting the new name resyncs the toolbar and (via SetCurrentVariant)
3538 // repaints ${VARIANT} text; a non-current rename needs no redraw.
3539 if( wasCurrent )
3540 SetCurrentVariant( newName );
3541}
3542
3543
3545{
3546 wxArrayString choices = Schematic().GetVariantNamesForUI();
3547
3548 // Default variant cannot be copied.
3549 choices.RemoveAt( 0 );
3550
3551 if( choices.IsEmpty() )
3552 {
3553 GetInfoBar()->ShowMessageFor( _( "No variants to copy." ), 10000, wxICON_INFORMATION );
3554 return;
3555 }
3556
3557 wxSingleChoiceDialog selDlg( this, _( "Select variant to copy:" ) + wxS( " " ),
3558 _( "Copy Design Variant" ), choices );
3559 selDlg.Layout();
3560
3561 if( selDlg.ShowModal() == wxID_CANCEL )
3562 return;
3563
3564 wxString sourceName = selDlg.GetStringSelection();
3565
3566 if( sourceName.IsEmpty() )
3567 return;
3568
3569 wxTextEntryDialog nameDlg( this, _( "Enter name for the copied variant:" ), _( "Copy Design Variant" ),
3570 sourceName + wxS( "_copy" ), wxOK | wxCANCEL | wxCENTER );
3571
3572 if( nameDlg.ShowModal() == wxID_CANCEL )
3573 return;
3574
3575 wxString newName = nameDlg.GetValue().Trim().Trim( false );
3576
3577 if( !ValidateNewVariantName( newName, wxEmptyString ) )
3578 return;
3579
3581 SCH_COMMIT commit( this );
3582 bool append = false;
3583
3584 Schematic().CopyVariant( sourceName, newName, &commit );
3585
3586 if( !commit.Empty() )
3587 {
3588 commit.Push();
3589 append = true;
3590 }
3591
3592 PICKED_ITEMS_LIST undoCmd;
3593 undoCmd.PushItem( ITEM_PICKER( GetScreen(), undoItem, UNDO_REDO::VARIANTS ) );
3594 undoCmd.SetDescription( _( "Copy Variant" ) );
3595 SaveCopyInUndoList( undoCmd, UNDO_REDO::VARIANTS, append );
3596
3597 // The new registry entry changes project state even when no symbol carries an override.
3598 OnModify();
3599
3600 UpdateVariantSelectionCtrl( Schematic().GetVariantNamesForUI() );
3601
3602 // Switching to the freshly-created variant already refreshes properties and redraws.
3603 SetCurrentVariant( newName );
3604}
3605
3606
3608{
3609 // Delegate to base auto-save behavior (commits pending local history) for now.
3611}
3612
3613
3615{
3617
3618 if( !mgr )
3619 return false;
3620
3621 TOOL_BASE* currentTool = mgr->GetCurrentTool();
3622 SCH_POINT_EDITOR* pointEditor = mgr->GetTool<SCH_POINT_EDITOR>();
3623
3624 // The point editor is the active tool whenever a point-editable item is selected, even while
3625 // idle, so it is safe to snapshot unless a drag is actively mutating the model.
3626 if( currentTool == pointEditor )
3627 return pointEditor && pointEditor->IsDragging();
3628
3629 return currentTool != mgr->GetTool<SCH_SELECTION_TOOL>();
3630}
3631
3632
3634{
3636 return false;
3637
3639}
3640
3641
3643{
3644 // Serializing the schematic on the UI thread freezes the editor; defer it while the user
3645 // is mid-operation (any tool other than passive selection or point editing is active) so
3646 // the snapshot waits for the timer to retry once the edit finishes.
3648}
const char * name
const KICOMMON_API wxEventTypeTag< wxCommandEvent > EDA_EVT_PLUGIN_AVAILABILITY_CHANGED
Notifies other parts of KiCad when plugin availability changes.
constexpr EDA_IU_SCALE schIUScale
Definition base_units.h:130
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:100
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap, int aMinHeight)
Definition bitmap.cpp:106
@ icon_eeschema_16
@ icon_eeschema_32
BOX2< VECTOR2I > BOX2I
Definition box2.h:914
static TOOL_ACTION toggleGrid
Definition actions.h:194
static TOOL_ACTION paste
Definition actions.h:76
static TOOL_ACTION cancelInteractive
Definition actions.h:68
static TOOL_ACTION unselectAll
Definition actions.h:79
static TOOL_ACTION selectItem
Select an item (specified as the event parameter).
Definition actions.h:223
static TOOL_ACTION copy
Definition actions.h:74
static TOOL_ACTION selectSetLasso
Definition actions.h:217
static TOOL_ACTION selectSetRect
Set lasso selection mode.
Definition actions.h:216
static TOOL_ACTION group
Definition actions.h:235
static TOOL_ACTION pasteSpecial
Definition actions.h:77
static TOOL_ACTION ungroup
Definition actions.h:236
static TOOL_ACTION toggleBoundingBoxes
Definition actions.h:153
static TOOL_ACTION showSearch
Definition actions.h:112
static TOOL_ACTION undo
Definition actions.h:71
static TOOL_ACTION selectionActivate
Activation of the selection tool.
Definition actions.h:210
static TOOL_ACTION duplicate
Definition actions.h:80
static TOOL_ACTION showGitCommitPane
Definition actions.h:263
static TOOL_ACTION doDelete
Definition actions.h:81
static TOOL_ACTION selectionTool
Definition actions.h:247
static TOOL_ACTION save
Definition actions.h:54
static TOOL_ACTION zoomFitScreen
Definition actions.h:138
static TOOL_ACTION redo
Definition actions.h:72
static TOOL_ACTION deleteTool
Definition actions.h:82
static TOOL_ACTION zoomTool
Definition actions.h:142
static TOOL_ACTION selectionClear
Clear the current selection.
Definition actions.h:220
static TOOL_ACTION showProperties
Definition actions.h:262
static TOOL_ACTION cut
Definition actions.h:73
static TOOL_ACTION copyAsText
Definition actions.h:75
static TOOL_ACTION toggleGridOverrides
Definition actions.h:195
static TOOL_ACTION selectAll
Definition actions.h:78
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.
Handles how to draw a screen (a board, a schematic ...)
Definition base_screen.h:37
bool IsContentModified() const
Definition base_screen.h:56
void SetContentModified(bool aModified=true)
Definition base_screen.h:55
A bitmap button widget that behaves like an AUI toolbar item's button when it is drawn.
constexpr BOX2< Vec > & Merge(const BOX2< Vec > &aRect)
Modify the position and size of the rectangle in order to contain aRect.
Definition box2.h:594
bool Empty() const
Definition commit.h:145
COMMIT & Modify(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr, RECURSE_MODE aRecurse=RECURSE_MODE::NO_RECURSE)
Modify a given item in the model.
Definition commit.h:102
Handle actions that are shared between different applications.
Handles action that are shared between different applications.
CONNECTION_SUBGRAPH * FindFirstSubgraphByName(const wxString &aNetName)
Retrieve a subgraph for the given net name, if one exists.
A subgraph is a set of items that are electrically connected on a single sheet.
Dialog to update or change schematic library symbols.
virtual bool doAutoSave()
This should be overridden by the derived class to handle the auto save feature.
virtual APP_SETTINGS_BASE * config() const
Return the settings object used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME.
virtual void ProjectChanged()
Notification event that the project has changed.
UNDO_REDO_CONTAINER m_undoList
void ShowChangedLanguage() override
Redraw the menus and what not in current language.
static const wxString GitCommitPaneName()
Named here rather than beside the editors' other panes, because the project manager docks this one to...
virtual void setupUIConditions()
Setup the UI conditions for the various actions and their controls in this frame.
virtual void ClearUndoRedoList()
Clear the undo and redo list using ClearUndoORRedoList()
SETTINGS_MANAGER * GetSettingsManager() const
virtual void OnModify()
Must be called after a model change in order to set the "modify" flag and do other frame-specific pro...
ACTION_TOOLBAR * m_tbRight
TOOLBAR_SETTINGS * m_toolbarSettings
void ShowInfoBarError(const wxString &aErrorMsg, bool aShowCloseButton=false, INFOBAR_MESSAGE_TYPE aType=INFOBAR_MESSAGE_TYPE::GENERIC)
Show the WX_INFOBAR displayed on the top of the canvas with a message and an error icon on the left o...
void UpdateFileHistory(const wxString &FullFileName, FILE_HISTORY *aFileHistory=nullptr)
Update the list of recently opened files.
wxAuiManager m_auimgr
virtual bool CanAcceptApiCommands()
Check if this frame is ready to accept API commands.
virtual void RecreateToolbars()
ACTION_TOOLBAR * m_tbLeft
virtual void OnSize(wxSizeEvent &aEvent)
virtual void ClearFileHistory()
Remove all files from the file history.
virtual void OnDropFiles(wxDropFilesEvent &aEvent)
Handle event fired when a file is dropped to the window.
std::map< const wxString, TOOL_ACTION * > m_acceptedExts
Associate file extensions with action to execute.
wxString GetFileFromHistory(int cmdId, const wxString &type, FILE_HISTORY *aFileHistory=nullptr)
Fetch the file name from the file history list.
virtual int GetUndoCommandCount() const
ACTION_TOOLBAR * m_tbTopMain
wxString m_aboutTitle
bool m_isClosing
Set by the close window event handler after frames are asked if they can close.
void ReCreateMenuBar()
Recreate the menu bar.
WX_INFOBAR * GetInfoBar()
GIT_COMMIT_PANE * m_gitCommitPane
EDA_DRAW_PANEL_GAL::GAL_TYPE m_canvasType
The current canvas type.
void OnSelectGrid(wxCommandEvent &event)
Command event handler for selecting grid sizes.
void setupUnits(APP_SETTINGS_BASE *aCfg)
void setArcModeConditions(const TOOL_ACTION &aDrawArc, const std::function< bool(const SELECTION &)> &aEnable)
Check each arc mode's tool action while the arc tool runs in that mode.
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 void resolveCanvasType()
Determine the canvas type to load (with prompt if required) and initializes m_canvasType.
static const wxString PropertiesPaneName()
EDA_MSG_PANEL * m_messagePanel
virtual void SetScreen(BASE_SCREEN *aScreen)
static const wxString RemoteSymbolPaneName()
virtual void UpdateMsgPanel()
Redraw the message panel.
void FocusOnLocation(const VECTOR2I &aPos, bool aAllowScroll=true)
Useful to focus on a particular location, in find functions.
virtual void ClearFocus()
SEARCH_PANE * m_searchPane
void unitsChangeRefresh() override
Called when when the units setting has changed to allow for any derived classes to handle refreshing ...
static const wxString DesignBlocksPaneName()
std::unique_ptr< EDA_SEARCH_DATA > m_findReplaceData
PROPERTIES_PANEL * m_propertiesPanel
bool m_showBorderAndTitleBlock
GAL_TYPE GetBackend() const
Return the type of backend currently used by GAL canvas.
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
void SetEventDispatcher(TOOL_DISPATCHER *aEventDispatcher)
Set a dispatcher that processes events and forwards them to tools.
A base class for most all the KiCad significant classes used in schematics and boards.
Definition eda_item.h:98
virtual const VECTOR2I GetFocusPosition() const
Similar to GetPosition() but allows items to return their visual center rather than their anchor.
Definition eda_item.h:355
const KIID m_Uuid
Definition eda_item.h:599
KICAD_T Type() const
Returns the type of object.
Definition eda_item.h:110
void ClearBrightened()
Definition eda_item.h:154
void SetBrightened()
Definition eda_item.h:151
bool IsBrightened() const
Definition eda_item.h:136
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:94
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition eda_text.h:118
SELECTION_CONDITION BoundingBoxes()
SELECTION_CONDITION RedoAvailable()
Create a functor that tests if there are any items in the redo queue.
SELECTION_CONDITION CurrentTool(const TOOL_ACTION &aTool)
Create a functor testing if the specified tool is the current active tool in the frame.
SELECTION_CONDITION GridVisible()
Create a functor testing if the grid is visible in a frame.
SELECTION_CONDITION GridOverrides()
Create a functor testing if the grid overrides wires is enabled in a frame.
PANEL_ANNOTATE m_AnnotatePanel
Tool responsible for drawing graphical shapes (rectangles, circles, arcs, beziers,...
bool empty() const
Definition sch_rtree.h:182
EE_TYPE OfType(KICAD_T aType) const
Definition sch_rtree.h:248
SEVERITY GetSeverity(int aErrorCode) const
void ReadWindowSettings(WINDOW_SETTINGS &aCfg)
Read GAL config options from application-level config.
Docked panel for committing: the branch to commit to, a summary and description, the commit options,...
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
void RegisterHandler(API_HANDLER *aHandler)
Adds a new request handler to the server.
void DeregisterHandler(API_HANDLER *aHandler)
APP_SETTINGS_BASE * KifaceSettings() const
Definition kiface_base.h:92
void SetDefaultFont(const wxString &aFont)
Contains methods for drawing schematic-specific items.
Definition sch_painter.h:66
void SetSchematic(SCHEMATIC *aSchematic)
Definition sch_painter.h:76
void Update(const KIGFX::VIEW_ITEM *aItem, int aUpdateFlags) const override
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
Definition sch_view.cpp:73
DS_PROXY_VIEW_ITEM * GetDrawingSheet() const
Definition sch_view.h:133
void SetScale(double aScale, VECTOR2D aAnchor={ 0, 0 }) override
Set the scaling factor, zooming around a given anchor point.
Definition sch_view.cpp:115
void DetachTextVarTracker()
Drop every cached reference into the currently-attached SCHEMATIC's TEXT_VAR_TRACKER: unregister the ...
Definition sch_view.cpp:59
An abstract base class for deriving all objects that can be added to a VIEW.
Definition view_item.h:82
bool IsSCH_ITEM() const
Definition view_item.h:97
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:298
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Add a VIEW_ITEM to the view.
Definition view.cpp:365
virtual void Remove(VIEW_ITEM *aItem)
Remove a VIEW_ITEM from the view.
Definition view.cpp:488
void SetLayerVisible(int aLayer, bool aVisible=true)
Control the visibility of a particular layer.
Definition view.h:431
void UpdateAllItems(int aUpdateFlags)
Update all items in the view according to the given flags.
Definition view.cpp:2475
PAINTER * GetPainter() const
Return the painter object used by the view for drawing VIEW_ITEM objects.
Definition view.h:242
void SetCenter(const VECTOR2D &aCenter)
Set the center point of the VIEW (i.e.
Definition view.cpp:971
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:2492
wxString AsString() const
Definition kiid.cpp:423
Definition kiid.h:46
KIWAY_PLAYER(KIWAY *aKiway, wxWindow *aParent, FRAME_T aFrameType, const wxString &aTitle, const wxPoint &aPos, const wxSize &aSize, long aStyle, const wxString &aFrameName, const EDA_IU_SCALE &aIuScale)
bool Destroy() override
Our version of Destroy() which is virtual from wxWidgets.
virtual bool OpenProjectFiles(const std::vector< wxString > &aFileList, int aCtl=0)
Open a project or set of files given by aFileList.
void OnSockRequestServer(wxSocketEvent &evt)
void OnSockRequest(wxSocketEvent &evt)
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition kiway.h:348
void OnKiCadExit()
Definition kiway.cpp:803
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
Definition kiway.cpp:401
virtual void ExpressMail(FRAME_T aDestination, MAIL_T aCommand, std::string &aPayload, wxWindow *aSource=nullptr, bool aFromOtherThread=false)
Send aPayload to aDestination from aSource.
Definition kiway.cpp:499
virtual KIFACE * KiFACE(FACE_T aFaceId, bool doLoad=true)
Return the KIFACE* given a FACE_T.
Definition kiway.cpp:214
@ FACE_SCH
eeschema DSO
Definition kiway.h:355
LOCAL_HISTORY & LocalHistory()
Return the LOCAL_HISTORY associated with this KIWAY.
Definition kiway.h:457
Define a library symbol object.
Definition lib_symbol.h:114
void AppendParentEmbeddedFiles(std::vector< EMBEDDED_FILES * > &aStack) const
std::unique_ptr< LIB_SYMBOL > Flatten() const
Return a flattened symbol inheritance to the caller.
bool CommitDuplicateOfLastSave(const wxString &aProjectPath, const wxString &aFileType, const wxString &aMessage)
Create a new commit duplicating the tree pointed to by Last_Save_<fileType> and move the Last_Save_<f...
void NoteFileChange(const wxString &aFile)
Record that a file has been modified and should be included in the next snapshot.
void RegisterSaver(const void *aSaverObject, const std::function< void(const wxString &, std::vector< HISTORY_FILE_DATA > &)> &aSaver, const std::weak_ptr< void > &aLifetime={})
Register a saver callback invoked during autosave history commits.
void UnregisterSaver(const void *aSaverObject)
Unregister a previously registered saver callback.
void RemoveAutosaveFiles(const wxString &aProjectPath) const
Remove every autosave file under the project at aProjectPath regardless of which source it shadowed.
Tree view item data for the net navigator.
The net navigator's tree control.
A singleton reporter that reports to nowhere.
Definition reporter.h:267
int GetHeightIU(double aIUScale) const
Get the page height in IU.
Definition page_info.h:163
int GetWidthIU(double aIUScale) const
Get the page width in IU.
Definition page_info.h:154
void PreloadDesignBlockLibraries(KIWAY *aKiway)
Starts a background job to preload the global and project design block libraries.
Definition pgm_base.cpp:908
KICAD_API_SERVER & GetApiServer()
Definition pgm_base.h:141
A holder to handle information on schematic or board items.
void PushItem(const ITEM_PICKER &aItem)
Push aItem to the top of the list.
void SetDescription(const wxString &aDescription)
A progress reporter interface for use in multi-threaded environments.
virtual const wxString GetProjectFullName() const
Return the full path and name of the project.
Definition project.cpp:270
virtual const wxString GetProjectPath() const
Return the full path of the project.
Definition project.cpp:276
virtual const wxString AbsolutePath(const wxString &aFileName) const
Fix up aFileName if it is relative to the project's directory to be an absolute path and filename.
Definition project.cpp:500
Action handler for the Properties panel.
These are loaded from Eeschema settings but then overwritten by the project settings.
Holds all the data relating to one schematic.
Definition schematic.h:149
void SetCurrentSheet(const SCH_SHEET_PATH &aPath)
Definition schematic.h:317
void Reset()
Initialize this schematic to a blank one, unloading anything existing.
void DeleteVariant(const wxString &aVariantName, SCH_COMMIT *aCommit=nullptr)
Delete all information for aVariantName.
void RecomputeIntersheetRefs()
Update the schematic's page reference map for all global labels, and refresh the labels so that they ...
wxString GetVariantDescription(const wxString &aVariantName) const
Return the description for a variant.
wxString GetFileName() const
Helper to retrieve the filename from the root sheet screen.
void CopyVariant(const wxString &aSourceVariant, const wxString &aNewVariant, SCH_COMMIT *aCommit=nullptr)
Copy a variant from aSourceVariant to aNewVariant.
SCHEMATIC_SETTINGS & Settings() const
SCH_ITEM * ResolveItem(const KIID &aID, SCH_SHEET_PATH *aPathOut=nullptr, bool aAllowNullptrReturn=false) const
Definition schematic.h:202
void RecordERCExclusions()
Scan existing markers and record data from any that are Excluded.
SCH_SHEET_LIST Hierarchy() const
Return the full schematic flattened hierarchical sheet list.
void RenameVariant(const wxString &aOldName, const wxString &aNewName, SCH_COMMIT *aCommit=nullptr)
Rename a variant from aOldName to aNewName.
SCH_CONNECTIVITY::FACADE & Connectivity() const
Definition schematic.h:324
void SetProject(PROJECT *aPrj)
bool IsHierarchyModified() const
True when any sheet in the hierarchy has unsaved changes.
wxString GetCurrentVariant() const
Return the current variant being edited.
void CleanUpConnections(SCH_COMMIT *aCommit, SCH_CLEANUP_FLAGS aCleanupFlags, const std::set< SCH_SCREEN * > &aLocalScreens={})
CONNECTION_GRAPH * ConnectionGraph() const
Definition schematic.h:327
SCH_SCREEN * RootScreen() const
Helper to retrieve the screen of the root sheet.
void SetVariantDescription(const wxString &aVariantName, const wxString &aDescription)
Set the description for a variant.
void RecalculateConnections(SCH_COMMIT *aCommit, SCH_CLEANUP_FLAGS aCleanupFlags, TOOL_MANAGER *aToolManager, PROGRESS_REPORTER *aProgressReporter=nullptr, KIGFX::SCH_VIEW *aSchView=nullptr, std::function< void(SCH_ITEM *)> *aChangedItemHandler=nullptr, PICKED_ITEMS_LIST *aLastChangeList=nullptr, bool aCleanupDone=false)
Generate the connection data for the entire schematic hierarchy.
wxArrayString GetVariantNamesForUI() const
Return an array of variant names for using in wxWidgets UI controls.
void SetSheetNumberAndCount()
Set the m_ScreenNumber and m_NumberOfScreens members for screens.
ERC_SETTINGS & ErcSettings() const
Gather all the actions that are shared by tools.
Definition sch_actions.h:46
static TOOL_ACTION rotateCCW
static TOOL_ACTION placeClassLabel
Definition sch_actions.h:85
static TOOL_ACTION placeSheetPin
Definition sch_actions.h:91
static TOOL_ACTION saveSheetAsDesignBlock
static TOOL_ACTION mirrorV
static TOOL_ACTION drawSheetFromFile
Definition sch_actions.h:89
static TOOL_ACTION toggleOPCurrents
static TOOL_ACTION saveToLinkedDesignBlock
Definition sch_actions.h:77
static TOOL_ACTION saveSelectionAsDesignBlock
static TOOL_ACTION placeGlobalLabel
Definition sch_actions.h:86
static TOOL_ACTION drawEllipseArc
static TOOL_ACTION drawTextBox
Definition sch_actions.h:99
static TOOL_ACTION toggleAnnotateAuto
static TOOL_ACTION ddAddImage
static TOOL_ACTION drawArc
static TOOL_ACTION drawSheet
Definition sch_actions.h:88
static TOOL_ACTION toggleERCWarnings
static TOOL_ACTION toggleDirectiveLabels
static TOOL_ACTION highlightNetTool
static TOOL_ACTION leaveSheet
static TOOL_ACTION ddImportGraphics
static TOOL_ACTION toggleHiddenFields
static TOOL_ACTION drawRectangle
static TOOL_ACTION drawLines
static TOOL_ACTION placeHierLabel
Definition sch_actions.h:87
static TOOL_ACTION alignTop
static TOOL_ACTION alignRight
static TOOL_ACTION drawEllipse
static TOOL_ACTION placeLabel
Definition sch_actions.h:84
static TOOL_ACTION drawCircle
static TOOL_ACTION placeBusWireEntry
Definition sch_actions.h:83
static TOOL_ACTION showRemoteSymbolPanel
static TOOL_ACTION drawBezier
static TOOL_ACTION drawWire
Definition sch_actions.h:78
static TOOL_ACTION remapSymbols
static TOOL_ACTION rotateCW
static TOOL_ACTION alignBottom
static TOOL_ACTION showHierarchy
static TOOL_ACTION showNetNavigator
static TOOL_ACTION placeJunction
Definition sch_actions.h:82
static TOOL_ACTION markSimExclusions
static TOOL_ACTION drawRuleArea
static TOOL_ACTION placeSymbol
Definition sch_actions.h:72
static TOOL_ACTION placeImage
static TOOL_ACTION alignLeft
static TOOL_ACTION toggleERCErrors
static TOOL_ACTION alignCenterX
static TOOL_ACTION angleSnapModeChanged
static TOOL_ACTION drawPolygon
static TOOL_ACTION placeLinkedDesignBlock
Definition sch_actions.h:76
static TOOL_ACTION drawSheetFromDesignBlock
Definition sch_actions.h:90
static TOOL_ACTION mirrorH
static TOOL_ACTION placeDesignBlock
Definition sch_actions.h:75
static TOOL_ACTION toggleOPVoltages
static TOOL_ACTION drawBus
Definition sch_actions.h:79
static TOOL_ACTION drawTable
static TOOL_ACTION ddAppendFile
static TOOL_ACTION placeSchematicText
Definition sch_actions.h:98
static TOOL_ACTION showDesignBlockPanel
static TOOL_ACTION togglePinAltIcons
static TOOL_ACTION toggleERCExclusions
static TOOL_ACTION updateNetHighlighting
static TOOL_ACTION alignCenterY
static TOOL_ACTION placeNoConnect
Definition sch_actions.h:81
static TOOL_ACTION toggleHiddenPins
static TOOL_ACTION syncSheetPins
Definition sch_actions.h:95
static TOOL_ACTION placePower
Definition sch_actions.h:74
A shim class between EDA_DRAW_FRAME and several derived classes: SYMBOL_EDIT_FRAME,...
SCH_BASE_FRAME(KIWAY *aKiway, wxWindow *aParent, FRAME_T aWindowType, const wxString &aTitle, const wxPoint &aPosition, const wxSize &aSize, long aStyle, const wxString &aFrameName)
SCH_RENDER_SETTINGS * GetRenderSettings()
void doCloseWindow() override
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
DIALOG_SCH_FIND * m_findReplaceDialog
void CommonSettingsChanged(int aFlags) override
Notification event that some of the common (suite-wide) settings have changed.
EESCHEMA_SETTINGS * eeconfig() const
PANEL_SCH_SELECTION_FILTER * m_selectionFilterPanel
virtual void UpdateItem(EDA_ITEM *aItem, bool isAddOrDelete=false, bool aUpdateRtree=false)
Mark an item for refresh.
Commit for the schematic and symbol editors.
Definition sch_commit.h:54
void Push(const wxString &aMessage=wxEmptyString, int aCommitFlags=0) override
Execute the changes.
Each graphical item can have a SCH_CONNECTION describing its logical connection (to a bus or net).
bool HasDriverChanged() const
wxString Name(bool aIgnoreSheet=false) const
std::optional< NET_GROUP > NetByName(const wxString &aName) const
const PUBLICATION & Published() const
SUBSCRIPTION Subscribe(std::function< void(const CHANGE_SET &)> aListener)
const CHANGE_SET & Changes() const
Handle design block actions in the schematic editor.
Tool responsible for drawing/placing items (symbols, wires, buses, labels, etc.).
KIGFX::SCH_VIEW * GetView() const override
Return a pointer to the KIGFX::VIEW instance used in the panel.
void DisplaySheet(SCH_SCREEN *aScreen)
Group generic conditions for PCB editor states.
int UpdateNetHighlighting(const TOOL_EVENT &aEvent)
Update net highlighting after an edit.
Schematic editor (Eeschema) main window.
void DefaultExecFlags()
Reset the execution flags to defaults for external netlist and bom generators.
void OnCrossProbeFlashTimer(wxTimerEvent &aEvent)
bool ValidateNewVariantName(const wxString &aName, const wxString &aExcludeName)
Validate a user-entered variant name for the rename/copy dialogs.
void ToggleProperties() override
bool interactiveOperationInProgress() const
Return true when a tool other than passive selection or an idle point editor is active.
bool IsContentModified() const override
Get if the current schematic has been modified but not saved.
void RefreshOperatingPointDisplay()
Refresh the display of any operating points.
wxPageSetupDialogData m_pageSetupData
wxString m_netNavigatorConnection
SELECTION & GetCurrentSelection() override
Get the current selection from the canvas area.
std::vector< std::unique_ptr< SCH_ITEM > > m_items_to_repeat
For the repeat-last-item cmd.
void FocusOnItem(EDA_ITEM *aItem, bool aAllowScroll=true) override
Focus on a particular canvas item.
void onResizeNetNavigator(wxSizeEvent &aEvent)
void updateSelectionFilterVisbility() override
Selection filter panel doesn't have a dedicated visibility control, so show it if any other AUI panel...
bool SaveSymbolToSchematic(const LIB_SYMBOL &aSymbol, const KIID &aSchematicSymbolUUID)
Update a schematic symbol from a LIB_SYMBOL.
void onNetNavigatorSelChanging(wxTreeEvent &aEvent)
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag and update other data struc...
void showNetNavigatorMenu(const wxTreeItemId &aItem)
void ShowAllIntersheetRefs(bool aShow)
void SaveProjectLocalSettings() override
Save changes to the project settings to the project (.pro) file.
bool OpenProjectFiles(const std::vector< wxString > &aFileSet, int aCtl=0) override
Open a project or set of files given by aFileList.
void doCloseWindow() override
std::unique_ptr< API_HANDLER_SCH > m_apiHandler
NET_NAVIGATOR_TREE * m_netNavigator
DIALOG_BOOK_REPORTER * m_diffSymbolDialog
void ToggleLibraryTree() override
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
wxWindow * createHighlightedNetNavigator()
void onCloseErcDialog(wxCommandEvent &aEvent)
void UpdateHierarchySelection()
Update the hierarchy navigation tree selection (cross-probe from schematic to hierarchy pane).
void SaveCopyInUndoList(SCH_SCREEN *aScreen, SCH_ITEM *aItemToCopy, UNDO_REDO aTypeCommand, bool aAppend)
Create a copy of the current schematic item, and put it in the undo list.
bool m_syncingPcbToSchSelection
void RefreshNetNavigator(const NET_NAVIGATOR_ITEM_DATA *aSelection=nullptr, const std::vector< wxString > *aChangedNets=nullptr)
void SetScreen(BASE_SCREEN *aScreen) override
friend class SCH_EDITOR_CONTROL
void RefreshConnectivity(bool aForce=false, const SCH_CONNECTIVITY::CHANGE_SET *aChanges=nullptr)
bool doAutoSave() override
Save the schematic files that have been modified and not yet saved.
wxChoice * m_currentVariantCtrl
void SetCurrentVariant(const wxString &aVariantName)
void CommonSettingsChanged(int aFlags) override
Called after the preferences dialog is run.
void UpdateVariantSelectionCtrl(const wxArrayString &aVariantNames)
Update the variant name control on the main toolbar.
void ShowChangedLanguage() override
Redraw the menus and what not in current language.
bool canRunAutoSave() const override
Return true when it is safe to run an autosave snapshot right now.
BITMAP_BUTTON * m_netNavigatorMenuButton
bool RecalculateConnections(SCH_COMMIT *aCommit, SCH_CLEANUP_FLAGS aCleanupFlags, PROGRESS_REPORTER *aProgressReporter=nullptr, bool aCleanupDone=false)
Generate the connection data for the entire schematic hierarchy.
std::unique_ptr< API_HANDLER_COMMON > m_apiHandlerCommon
bool ReadyToNetlist(const wxString &aAnnotateMessage, bool *aUserCancelled=nullptr)
Check if we are ready to write a netlist file for the current schematic.
void onNetNavigatorKey(wxKeyEvent &aEvent)
void configureToolbars() override
std::vector< wxEvtHandler * > m_schematicChangeListeners
void HardRedraw() override
Rebuild the GAL and redraw the screen.
void OnClearFileHistory(wxCommandEvent &aEvent)
bool GetShowAllPins() const override
Allow edit frame to show/hide hidden pins.
bool CanAcceptApiCommands() override
Check if this frame is ready to accept API commands.
PANEL_REMOTE_SYMBOL * m_remoteSymbolPane
SCHEMATIC * m_schematic
The currently loaded schematic.
void onNetNavigatorFilterChanged(wxCommandEvent &aEvent)
void onCloseSymbolFieldsTableDialog(wxCommandEvent &aEvent)
SCH_SHEET_PATH & GetCurrentSheet() const
wxString m_netNavigatorFilterValue
void ProjectChanged() override
Notification event that the project has changed.
void OnLoadFile(wxCommandEvent &event)
SCHEMATIC & Schematic() const
void updateTitle()
Set the main window title bar text.
void SetSchematic(SCHEMATIC *aSchematic)
void ToggleSearch()
Toggle the show/hide state of Search pane.
bool LoadProjectSettings()
Load the KiCad project file (*.pro) settings specific to Eeschema.
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
wxSearchCtrl * m_netNavigatorFilter
wxString GetFullScreenDesc() const override
static const wxString SearchPaneName()
DIALOG_BOOK_REPORTER * GetSymbolDiffDialog()
bool canCloseWindow(wxCloseEvent &aCloseEvent) override
void onNetNavigatorContextMenu(wxContextMenuEvent &aEvent)
void RecomputeIntersheetRefs()
Update the schematic's page reference map for all global labels, and refresh the labels so that they ...
const wxString & GetHighlightedNetChain() const
DIALOG_ERC * GetErcDialog()
void sendNetlistToCvpcb()
Send the KiCad netlist over to CVPCB.
SCH_DESIGN_BLOCK_PANE * m_designBlocksPane
void UpdateHierarchyNavigator(bool aRefreshNetNavigator=true, bool aClear=false)
Update the hierarchy navigation tree and history.
SCH_EDIT_FRAME(KIWAY *aKiway, wxWindow *aParent)
void ToggleSchematicHierarchy()
Toggle the show/hide state of the left side schematic navigation panel.
std::vector< KIID > m_crossProbeFlashItems
Items to flash.
void LoadDrawingSheet()
Load the drawing sheet file.
void onNetNavigatorMenuCommand(wxCommandEvent &aEvent)
void SetSheetNumberAndCount()
Set the m_ScreenNumber and m_NumberOfScreens members for screens.
std::vector< LIB_ID > m_designBlockHistoryList
void OnPageSettingsChange() override
Called when modifying the page settings.
void ClearRepeatItemsList()
Clear the list of items which are to be repeated with the insert key.
const BOX2I GetDocumentExtents(bool aIncludeAllVisible=true) const override
Return bounding box of document with option to not include some items.
std::unique_ptr< API_HANDLER_LIBRARIES > m_apiLibrariesHandler
void CaptureHierarchyPaneSize()
void StartCrossProbeFlash(const std::vector< SCH_ITEM * > &aItems)
void initScreenZoom()
Initialize the zoom value of the current screen and mark the screen as zoom-initialized.
void UpdateLabelsHierarchyNavigator()
Update the hierarchy navigation tree labels.
SCH_CONNECTIVITY::SUBSCRIPTION m_connectivitySubscription
static const wxString SchematicHierarchyPaneName()
void SetHighlightedConnection(const wxString &aConnection, const NET_NAVIGATOR_ITEM_DATA *aSelection=nullptr, bool aForceNetNavigatorRefresh=false)
void setupUIConditions() override
Setup the UI conditions for the various actions and their controls in this frame.
EDA_ITEM * ResolveItem(const KIID &aId, bool aAllowNullptrReturn=false) const override
Fetch an item by KIID.
wxString m_netNavigatorMenuNetName
void unitsChangeRefresh() override
Called when when the units setting has changed to allow for any derived classes to handle refreshing ...
void RemoveSchematicChangeListener(wxEvtHandler *aListener)
Remove aListener to from the schematic changed listener list.
void SetCurrentSheet(const SCH_SHEET_PATH &aSheet)
void DisplayCurrentSheet()
Draw the current sheet on the display.
~SCH_EDIT_FRAME() override
void onVariantSelected(wxCommandEvent &aEvent)
const wxString & GetHighlightedConnection() const
DIALOG_ERC * m_ercDialog
void UpdateItem(EDA_ITEM *aItem, bool isAddOrDelete=false, bool aUpdateRtree=false) override
Mark an item for refresh.
void UpdateNetHighlightStatus()
wxString GetScreenDesc() const override
Return a human-readable description of the current screen.
void onNetNavigatorItemMenu(wxTreeEvent &aEvent)
void AddCopyForRepeatItem(const SCH_ITEM *aItem)
DIALOG_SYMBOL_FIELDS_TABLE * GetSymbolFieldsTableDialog()
void OnResizeHierarchyNavigator(wxSizeEvent &aEvent)
wxString GetCurrentFileName() const override
Get the full filename + path of the currently opened file in the frame.
wxString m_highlightedConn
The highlighted net or bus or empty string.
wxGenericTreeCtrl * GetNetNavigator()
static const wxString NetNavigatorPaneName()
void onNetNavigatorDPIChanged(wxDPIChangedEvent &aEvent)
void onCloseSymbolDiffDialog(wxCommandEvent &aEvent)
void IntersheetRefUpdate(SCH_GLOBALLABEL *aItem) override
Callback from schematic ref update.
void OnExit(wxCommandEvent &event)
void AutoRotateItem(SCH_SCREEN *aScreen, SCH_ITEM *aItem)
Automatically set the rotation of an item (if the item supports it).
wxTimer m_crossProbeFlashTimer
Timer to toggle selection visibility.
void AddSchematicChangeListener(wxEvtHandler *aListener)
Add aListener to post EDA_EVT_SCHEMATIC_CHANGED command events to.
HIERARCHY_PANE * m_hierarchy
DIALOG_SYMBOL_FIELDS_TABLE * m_symbolFieldsTableDialog
std::unique_ptr< GRID_HELPER > MakeGridHelper() override
void UpdateHopOveredWires(SCH_ITEM *aItem)
SEVERITY GetSeverity(int aErrorCode) const override
void onPluginAvailabilityChanged(wxCommandEvent &aEvt)
void onNetNavigatorSelection(wxTreeEvent &aEvent)
void FindNetInInspector(const wxString &aNetName)
void SaveCopyForRepeatItem(const SCH_ITEM *aItem)
Clone aItem and owns that clone in this container.
Handle actions specific to the schematic editor.
A set of SCH_ITEMs (i.e., without duplicates).
Definition sch_group.h:48
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition sch_item.h:170
SCH_ITEM * Duplicate(bool addToParentGroup, SCH_COMMIT *aCommit=nullptr, bool aDoClone=false) const
Routine to create a new copy of given item.
Definition sch_item.cpp:191
virtual void RunOnChildren(const std::function< void(SCH_ITEM *)> &aFunction, RECURSE_MODE aMode)
Definition sch_item.h:683
SCH_CONNECTION * Connection(const SCH_SHEET_PATH *aSheet=nullptr) const
Retrieve the connection associated with this object in the given sheet.
Definition sch_item.cpp:580
bool ResolveExcludedFromSim(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
Definition sch_item.cpp:374
bool AutoRotateOnPlacement() const
autoRotateOnPlacement
SPIN_STYLE GetSpinStyle() const
void AutoplaceFields(SCH_SCREEN *aScreen, AUTOPLACE_ALGO aAlgo) override
virtual void SetSpinStyle(SPIN_STYLE aSpinStyle)
Tool responsible for drawing/placing items (symbols, wires, buses, labels, etc.)
static bool IsDrawingLineWireOrBus(const SELECTION &aSelection)
Segment description base class to describe items which have 2 end points (track, wire,...
Definition sch_line.h:39
void SetOperatingPoint(const wxString &aText)
Definition sch_line.h:379
bool IsWire() const
Return true if the line is a wire.
bool IsBus() const
Return true if the line is a bus.
double GetLength() const
Definition sch_line.cpp:341
const wxString & GetOperatingPoint() const
Definition sch_line.h:378
Handle actions specific to the schematic editor.
A net chain is a collection of nets that are connected together through passive components.
void SetOperatingPoint(const wxString &aText)
Definition sch_pin.h:413
Tool that displays edit points allowing to modify items by dragging the points.
bool IsDragging() const
Return true while a point is actively being dragged (the model is mid-mutation between grab and relea...
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
Definition sch_screen.h:826
void DeleteAllMarkers(enum MARKER_BASE::MARKER_T aMarkerType, bool aIncludeExclusions)
Delete all electronic rules check markers of aMarkerType from all the screens in the list.
const PAGE_INFO & GetPageSettings() const
Definition sch_screen.h:144
void Clear(bool aFree=true)
Delete all draw items and clears the project settings.
void TestDanglingEnds(const SCH_SHEET_PATH *aPath=nullptr, std::function< void(SCH_ITEM *)> *aChangedHandler=nullptr) const
Test all of the connectable objects in the schematic for unused connection points.
const std::map< wxString, LIB_SYMBOL * > & GetLibSymbols() const
Fetch a list of unique LIB_SYMBOL object pointers required to properly render each SCH_SYMBOL in this...
Definition sch_screen.h:565
double m_LastZoomLevel
last value for the zoom level, useful in Eeschema when changing the current displayed sheet to reuse ...
Definition sch_screen.h:747
void UpdateDisplayBounds(SCH_ITEM *aItem)
Refresh display bounds only; the item's source and membership must be unchanged.
EE_RTREE & Items()
Get the full RTree, usually for iterating.
Definition sch_screen.h:122
const wxString & GetFileName() const
Definition sch_screen.h:157
bool IsReadOnly() const
Definition sch_screen.h:160
bool m_zoomInitialized
Definition sch_screen.h:778
bool FileExists() const
Definition sch_screen.h:163
SPIN_STYLE GetLabelOrientationForPoint(const VECTOR2I &aPosition, SPIN_STYLE aDefaultOrientation, const SCH_SHEET_PATH *aSheet) const
int ClearSelection(const TOOL_EVENT &aEvent)
Clear current selection event handler.
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
SCH_ITEM * ResolveItem(const KIID &aID, SCH_SHEET_PATH *aPathOut=nullptr, bool aAllowNullptrReturn=false) const
Fetch a SCH_ITEM by ID.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
KIID_PATH Path() const
Get the sheet path as an KIID_PATH.
void UpdateAllScreenReferences() const
Update all the symbol references for this sheet path.
SCH_SCREEN * LastScreen()
wxString PathHumanReadable(bool aUseShortRootName=true, bool aStripTrailingSeparator=false, bool aEscapeSheetNames=false) const
Return the sheet path in a human readable form made from the sheet names.
bool GetExcludedFromSim() const
SCH_SHEET * Last() const
Return a pointer to the last SCH_SHEET of the list.
void clear()
Forwarded method from std::vector.
size_t size() const
Forwarded method from std::vector.
wxString GetName() const
Definition sch_sheet.h:148
Schematic symbol object.
Definition sch_symbol.h:75
EMBEDDED_FILES * GetEmbeddedFiles() override
SCH_SYMBOLs don't currently support embedded files, but their LIB_SYMBOL counterparts do.
bool IsAnnotated(const SCH_SHEET_PATH *aSheet) const
Check if the symbol has a valid annotation (reference) for the given sheet path.
std::vector< const SCH_PIN * > GetPins(const SCH_SHEET_PATH *aSheet) const
Retrieve a list of the SCH_PINs for the given sheet path.
std::vector< SCH_PIN * > GetGraphicalPins(int aUnit, int aBodyStyle) const override
SCH_PIN * GetPin(const wxString &number) const
Find a symbol pin by number.
std::unique_ptr< LIB_SYMBOL > & GetLibSymbolRef()
Definition sch_symbol.h:184
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const override
VECTOR2I GetPosition() const override
Definition sch_text.h:143
static SELECTION_CONDITION HasType(KICAD_T aType)
Create a functor that tests if among the selected items there is at least one of a given type.
static 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 bool ShowAlways(const SELECTION &aSelection)
The default condition function (always returns true).
void BrightenItem(EDA_ITEM *aItem)
int AddItemToSel(const TOOL_EVENT &aEvent)
void UnbrightenItem(EDA_ITEM *aItem)
bool UnloadProject(PROJECT *aProject, bool aSave=true)
Save, unload and unregister the given PROJECT.
SIM_MODEL & CreateModel(SIM_MODEL::TYPE aType, std::span< const wxString > aPins, REPORTER &aReporter)
void SetFilesStack(std::vector< EMBEDDED_FILES * > aFilesStack)
Definition sim_lib_mgr.h:45
Spin style for labels of all kinds on schematics.
Definition sch_label.h:38
Symbol library viewer main window.
The symbol library editor main window.
Symbol library viewer main window.
TOOL_MANAGER * m_toolManager
TOOL_DISPATCHER * m_toolDispatcher
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
ACTIONS * m_actions
Base abstract interface for all kinds of tools.
Definition tool_base.h:62
@ REDRAW
Full drawing refresh.
Definition tool_base.h:79
@ MODEL_RELOAD
Model changes (the sheet for a schematic)
Definition tool_base.h:76
Generic, UI-independent tool event.
Definition tool_event.h:167
Master controller class:
T * GetTool()
Return the tool of given type or nullptr if there is no such tool registered.
bool RunAction(const std::string &aActionName, T aParam)
Run the specified action immediately, pausing the current action to run the new one.
TOOL_BASE * GetCurrentTool() const
Return the tool that is on the top of the active tools stack (was invoked the most recently).
void ShowMessageFor(const wxString &aMessage, int aTime, int aFlags=wxICON_INFORMATION, MESSAGE_TYPE aType=WX_INFOBAR::MESSAGE_TYPE::GENERIC)
Show the infobar with the provided message and icon for a specific period of time.
wxString EnsureFileExtension(const wxString &aFilename, const wxString &aExtension)
It's annoying to throw up nag dialogs when the extension isn't right.
Definition common.cpp:880
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:146
int GetLastUnsavedChangesResponse()
Return the result code from the last call to HandleUnsavedChanges(): wxID_YES, wxID_NO or wxID_CANCEL...
Definition confirm.cpp:159
void DisplayError(wxWindow *aParent, const wxString &aText)
Display an error or warning message box with aMessage.
Definition confirm.cpp:192
This file is part of the common library.
KIFACE_BASE & Kiface()
Global KIFACE_BASE "get" accessor.
Definition cvpcb.cpp:165
#define CHECK(x)
#define ENABLE(x)
#define _(s)
wxDEFINE_EVENT(wxEVT_REFRESH_CUSTOM_COMMAND, wxCommandEvent)
#define KICAD_DEFAULT_DRAWFRAME_STYLE
#define SCH_EDIT_FRAME_NAME
@ NO_RECURSE
Definition eda_item.h:52
#define IGNORE_PARENT_GROUP
Definition eda_item.h:55
@ ID_TOOLBAR_SCH_SELECT_VARAIANT
const wxAuiPaneInfo & defaultSchSelectionFilterPaneInfo(wxWindow *aWindow)
const wxAuiPaneInfo & defaultPropertiesPaneInfo(wxWindow *aWindow)
const wxAuiPaneInfo & defaultNetNavigatorPaneInfo()
const wxAuiPaneInfo & defaultDesignBlocksPaneInfo(wxWindow *aWindow)
const wxAuiPaneInfo & defaultRemoteSymbolPaneInfo(wxWindow *aWindow)
EVT_MENU_RANGE(ID_GERBVIEW_DRILL_FILE1, ID_GERBVIEW_DRILL_FILEMAX, GERBVIEW_FRAME::OnDrlFileHistory) EVT_MENU_RANGE(ID_GERBVIEW_ZIP_FILE1
KiCad executable names.
const wxString PCBNEW_EXE
@ FRAME_PCB_EDITOR
Definition frame_type.h:38
@ FRAME_SCH_SYMBOL_EDITOR
Definition frame_type.h:31
@ FRAME_SCH_VIEWER
Definition frame_type.h:32
@ FRAME_SCH
Definition frame_type.h:30
@ FRAME_SIMULATOR
Definition frame_type.h:34
@ FRAME_CVPCB
Definition frame_type.h:48
@ FRAME_SYMBOL_CHOOSER
Definition frame_type.h:33
int ExecuteFile(const wxString &aEditorName, const wxString &aFileName, wxProcess *aCallback, bool aFileForKicad)
Call the executable file aEditorName with the parameter aFileName.
Definition gestfich.cpp:166
bool m_ConnectivityEngine
Use the schematic connectivity engine instead of CONNECTION_GRAPH.
static const std::string NetlistFileExtension
static const std::string JpegFileExtension
static const std::string PngFileExtension
static const std::string LegacyPcbFileExtension
static const std::string KiCadSchematicFileExtension
static const std::string SVGFileExtension
static wxString LegacySchematicFileWildcard()
static wxString AllSchematicFilesWildcard()
static wxString KiCadSchematicFileWildcard()
const wxChar *const traceSchCurrentSheet
Flag to enable debug output of current sheet tracking in the schematic editor.
const wxChar *const traceCrossProbeFlash
Flag to enable debug output for cross-probe flash operations.
const wxChar *const traceApi
Flag to enable debug output related to the IPC API and its plugin system.
Definition api_utils.cpp:33
@ ID_ON_GRID_SELECT
Definition id.h:113
@ ID_FILE_LIST_CLEAR
Definition id.h:58
@ ID_EDA_SOCKET_EVENT
Definition id.h:133
@ ID_EDA_SOCKET_EVENT_SERV
Definition id.h:132
@ ID_ON_ZOOM_SELECT
Definition id.h:112
@ ID_FILEMAX
Definition id.h:56
@ ID_FILE1
Definition id.h:55
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
Definition idf_helpers.h:37
PROJECT & Prj()
Definition kicad.cpp:737
EVT_MENU(ID_COMPARE_PROJECT_BRANCHES, KICAD_MANAGER_FRAME::OnCompareProjectBranches) KICAD_MANAGER_FRAME
KIID niluuid(0)
#define KICTL_CREATE
caller thinks requested project files may not exist.
#define KICTL_KICAD_ONLY
chosen file is from KiCad according to user
@ LAYER_ERC_WARN
Definition layer_ids.h:507
@ LAYER_ERC_EXCLUSION
Definition layer_ids.h:509
@ LAYER_ERC_ERR
Definition layer_ids.h:508
@ LAYER_OP_CURRENTS
Definition layer_ids.h:530
@ LAYER_INTERSHEET_REFS
Definition layer_ids.h:491
@ LAYER_OP_VOLTAGES
Definition layer_ids.h:529
@ MAIL_PCB_UPDATE
Definition mail_type.h:42
@ MAIL_SCH_SHEET_CHANGED
Definition mail_type.h:59
@ REPAINT
Item needs to be redrawn.
Definition view_item.h:54
@ GEOMETRY
Position or shape has changed.
Definition view_item.h:51
@ ALL
All except INITIAL_ADD.
Definition view_item.h:55
void SetShutdownBlockReason(wxWindow *aWindow, const wxString &aReason)
Sets the block reason why the window/application is preventing OS shutdown.
Definition unix/app.cpp:108
bool SupportsShutdownBlockReason()
Whether or not the window supports setting a shutdown block reason.
Definition unix/app.cpp:97
void AllowNetworkFileSystems(wxDialog *aDialog)
Configure a file dialog to show network and virtual file systems.
Definition wxgtk/ui.cpp:640
#define _HKI(x)
Definition page_info.cpp:40
PGM_BASE & Pgm()
The global program "get" accessor.
see class PGM_BASE
SEVERITY
#define SKIP_CONNECTIVITY
Definition sch_commit.h:41
#define DIFF_SYMBOLS_DIALOG_NAME
#define CURRENT_TOOL(action)
@ AUTOPLACE_AUTO
Definition sch_item.h:75
SCH_CLEANUP_FLAGS
Definition schematic.h:92
@ GLOBAL_CLEANUP
Definition schematic.h:95
T * GetToolbarSettings(const wxString &aFilename)
T * GetAppSettings(const char *aFilename)
KIWAY Kiway(KFCTL_STANDALONE)
std::vector< FAB_LAYER_COLOR > dummy
wxString GetDefaultVariantName()
wxString UnescapeString(const wxString &aSource)
Implement a participant in the KIWAY alchemy.
Definition kiway.h:153
virtual void PreloadLibraries(KIWAY *aKiway)
Definition kiway.h:298
Difference between two publications.
std::string refName
#define ALL_UNITS
Definition symbol.h:150
#define ALL_BODY_STYLES
Definition symbol.h:151
std::string path
KIBIS_MODEL * model
KIBIS_PIN * pin
wxLogTrace helper definitions.
@ SCH_GROUP_T
Definition typeinfo.h:169
@ SCH_LINE_T
Definition typeinfo.h:159
@ SCH_SYMBOL_T
Definition typeinfo.h:168
@ SCH_MARKER_T
Definition typeinfo.h:154
@ SCH_HIER_LABEL_T
Definition typeinfo.h:165
@ SCH_GLOBAL_LABEL_T
Definition typeinfo.h:164
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:708
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.