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 <sim/operating_point.h>
76#include <tool/action_manager.h>
77#include <tool/action_toolbar.h>
78#include <tool/common_control.h>
79#include <tool/common_tools.h>
80#include <tool/embed_tool.h>
81#include <tool/picker_tool.h>
83#include <tool/selection.h>
85#include <tool/tool_manager.h>
86#include <tool/zoom_tool.h>
87#include <tools/sch_actions.h>
95#include <sch_io/sch_io_mgr.h>
96#include <sch_io/sch_io.h>
98#include <tools/sch_edit_tool.h>
102#include <tools/sch_group_tool.h>
104#include <tools/sch_move_tool.h>
108#include <trace_helpers.h>
109#include <unordered_set>
110#include <view/view_controls.h>
111#include <widgets/wx_infobar.h>
118#include <wx/cmdline.h>
119#include <wx/app.h>
120#include <wx/filedlg.h>
121#include <wx/socket.h>
122#include <wx/debug.h>
124#include <widgets/wx_aui_utils.h>
127#include <toolbars_sch_editor.h>
128#include <wx/log.h>
129#include <wx/choicdlg.h>
130#include <wx/textdlg.h>
131#include <wx/generic/treectlg.h>
132
133
134#define DIFF_SYMBOLS_DIALOG_NAME wxT( "DiffSymbolsDialog" )
135
136
137BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, SCH_BASE_FRAME )
140
141 EVT_SIZE( SCH_EDIT_FRAME::OnSize )
142
145
146 EVT_MENU( wxID_EXIT, SCH_EDIT_FRAME::OnExit )
147 EVT_MENU( wxID_CLOSE, SCH_EDIT_FRAME::OnExit )
148
151
152 // Drop files event
153 EVT_DROP_FILES( SCH_EDIT_FRAME::OnDropFiles )
154END_EVENT_TABLE()
155
156
157wxDEFINE_EVENT( EDA_EVT_SCHEMATIC_CHANGING, wxCommandEvent );
158wxDEFINE_EVENT( EDA_EVT_SCHEMATIC_CHANGED, wxCommandEvent );
159
160
161SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
162 SCH_BASE_FRAME( aKiway, aParent, FRAME_SCH, wxT( "Eeschema" ), wxDefaultPosition,
164 m_ercDialog( nullptr ),
165 m_diffSymbolDialog( nullptr ),
166 m_symbolFieldsTableDialog( nullptr ),
167 m_netNavigator( nullptr ),
168 m_netNavigatorFilter( nullptr ),
172 m_designBlocksPane( nullptr ),
173 m_remoteSymbolPane( nullptr ),
174 m_currentVariantCtrl( nullptr )
175{
176 m_maximizeByDefault = true;
177 m_schematic = new SCHEMATIC( &Prj() );
178 m_schematic->SetSchematicHolder( this );
180
181 m_showBorderAndTitleBlock = true; // true to show sheet references
182 m_supportsAutoSave = true;
184 m_aboutTitle = _HKI( "KiCad Schematic Editor" );
185 m_show_search = false;
186 // Ensure timer has an owner before binding so it generates events.
187 m_crossProbeFlashTimer.SetOwner( this );
188 Bind( wxEVT_TIMER, &SCH_EDIT_FRAME::OnCrossProbeFlashTimer, this, m_crossProbeFlashTimer.GetId() );
189
190 // Give an icon
191 wxIcon icon;
192 wxIconBundle icon_bundle;
193
194 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_eeschema, 48 ) );
195 icon_bundle.AddIcon( icon );
196 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_eeschema, 128 ) );
197 icon_bundle.AddIcon( icon );
198 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_eeschema, 256 ) );
199 icon_bundle.AddIcon( icon );
200 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_eeschema_32 ) );
201 icon_bundle.AddIcon( icon );
202 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_eeschema_16 ) );
203 icon_bundle.AddIcon( icon );
204
205 SetIcons( icon_bundle );
206
208
209 setupTools();
212
216
217 // Ensure the "Line modes" toolbar group shows the current angle mode on startup
218 if( GetToolManager() )
220
222
223 m_hierarchy = new HIERARCHY_PANE( this );
224
225 // Initialize common print setup dialog settings.
226 m_pageSetupData.GetPrintData().SetPrintMode( wxPRINT_MODE_PRINTER );
227 m_pageSetupData.GetPrintData().SetQuality( wxPRINT_QUALITY_MEDIUM );
228 m_pageSetupData.GetPrintData().SetBin( wxPRINTBIN_AUTO );
229 m_pageSetupData.GetPrintData().SetNoCopies( 1 );
230
231 m_searchPane = new SCH_SEARCH_PANE( this );
232 m_propertiesPanel = new SCH_PROPERTIES_PANEL( this, this );
234 m_gitCommitPane = new GIT_COMMIT_PANE( this );
235
236 m_propertiesPanel->SetSplitterProportion( eeconfig()->m_AuiPanels.properties_splitter );
237
240
241 m_auimgr.SetManagedWindow( this );
242
244
245 // Fetch a COPY of the config as a lot of these initializations are going to overwrite our
246 // data.
247 EESCHEMA_SETTINGS::AUI_PANELS aui_cfg = eeconfig()->m_AuiPanels;
248 EESCHEMA_SETTINGS::APPEARANCE appearance_cfg = eeconfig()->m_Appearance;
249
250 // Rows; layers 4 - 6
251 m_auimgr.AddPane( m_tbTopMain, EDA_PANE().HToolbar().Name( wxS( "TopMainToolbar" ) )
252 .Top().Layer( 6 ) );
253
254 m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( wxS( "MsgPanel" ) )
255 .Bottom().Layer( 6 ) );
256
257 // Columns; layers 1 - 3
258 m_auimgr.AddPane( m_hierarchy, EDA_PANE().Palette().Name( SchematicHierarchyPaneName() )
259 .Caption( _( "Schematic Hierarchy" ) )
260 .Left().Layer( 3 ).Position( 1 )
261 .TopDockable( false )
262 .BottomDockable( false )
263 .CloseButton( true )
264 .MinSize( FromDIP( wxSize( 120, 60 ) ) )
265 .BestSize( FromDIP( wxSize( 200, 200 ) ) )
266 .FloatingSize( FromDIP( wxSize( 200, 200 ) ) )
267 .FloatingPosition( FromDIP( wxPoint( 50, 50 ) ) )
268 .Show( false ) );
269
272
275
277
278 m_auimgr.AddPane( m_tbLeft, EDA_PANE().VToolbar().Name( wxS( "LeftToolbar" ) )
279 .Left().Layer( 2 ) );
280
281 m_auimgr.AddPane( m_tbRight, EDA_PANE().VToolbar().Name( wxS( "RightToolbar" ) )
282 .Right().Layer( 2 ) );
283
284 // Center
285 m_auimgr.AddPane( GetCanvas(), EDA_PANE().Canvas().Name( wxS( "DrawFrame" ) )
286 .Center() );
287
288 m_auimgr.AddPane( m_searchPane, EDA_PANE()
289 .Name( SearchPaneName() )
290 .Bottom()
291 .Caption( _( "Search" ) )
292 .PaneBorder( false )
293 .MinSize( FromDIP( wxSize( 180, 60 ) ) )
294 .BestSize( FromDIP( wxSize( 180, 100 ) ) )
295 .FloatingSize( FromDIP( wxSize( 480, 200 ) ) )
296 .CloseButton( true )
297 .DestroyOnClose( false )
298 .Show( m_show_search ) );
299
300 m_auimgr.AddPane( m_gitCommitPane,
301 EDA_PANE()
302 .Name( GitCommitPaneName() )
303 .Right()
304 .Layer( 5 )
305 .Caption( _( "Version Control" ) )
306 .PaneBorder( false )
307 .MinSize( wxSize( m_gitCommitPane->GetMinDockWidth(), FromDIP( 120 ) ) )
308 .BestSize( wxSize( std::max( m_gitCommitPane->GetMinDockWidth(), FromDIP( 300 ) ),
309 FromDIP( 300 ) ) )
310 .FloatingSize( FromDIP( wxSize( 300, 400 ) ) )
311 .DestroyOnClose( false )
312 .CloseButton( true )
313 .Hide() );
314
316
317 // A saved layout brings its own minimum, so the one the panel needs is set again.
318 m_auimgr.GetPane( GitCommitPaneName() ).min_size.x = m_gitCommitPane->GetMinDockWidth();
320
321 wxAuiPaneInfo& hierarchy_pane = m_auimgr.GetPane( SchematicHierarchyPaneName() );
322 wxAuiPaneInfo& netNavigatorPane = m_auimgr.GetPane( NetNavigatorPaneName() );
323 wxAuiPaneInfo& propertiesPane = m_auimgr.GetPane( PropertiesPaneName() );
324 wxAuiPaneInfo& selectionFilterPane = m_auimgr.GetPane( wxS( "SelectionFilter" ) );
325 wxAuiPaneInfo& designBlocksPane = m_auimgr.GetPane( DesignBlocksPaneName() );
326 wxAuiPaneInfo& remoteSymbolPane = m_auimgr.GetPane( RemoteSymbolPaneName() );
327
328 hierarchy_pane.Show( aui_cfg.show_schematic_hierarchy );
329 netNavigatorPane.Show( aui_cfg.show_net_nav_panel );
330 propertiesPane.Show( aui_cfg.show_properties );
331 designBlocksPane.Show( aui_cfg.design_blocks_show );
332 m_auimgr.GetPane( GitCommitPaneName() ).Show( aui_cfg.show_git_commit_pane );
333
334 if( m_remoteSymbolPane && !m_remoteSymbolPane->HasDataSources() )
335 remoteSymbolPane.Show( false );
336 else
337 remoteSymbolPane.Show( aui_cfg.remote_symbol_show );
338
340
341 // The selection filter doesn't need to grow in the vertical direction when docked
342 selectionFilterPane.dock_proportion = 0;
343
344 // wx 3.3.3 turns a -1 min height into 1, and a legacy perspective restores one
345 selectionFilterPane.min_size.y = m_selectionFilterPanel->GetBestSize().y;
346
347 if( aui_cfg.hierarchy_panel_float_width > 0 && aui_cfg.hierarchy_panel_float_height > 0 )
348 {
349 // Show at end, after positioning
350 hierarchy_pane.FloatingSize( aui_cfg.hierarchy_panel_float_width,
352 }
353
354 if( aui_cfg.net_nav_panel_float_size.GetWidth() > 0
355 && aui_cfg.net_nav_panel_float_size.GetHeight() > 0 )
356 {
357 netNavigatorPane.FloatingSize( aui_cfg.net_nav_panel_float_size );
358 netNavigatorPane.FloatingPosition( aui_cfg.net_nav_panel_float_pos );
359 }
360
361 if( aui_cfg.properties_panel_width > 0 )
362 SetAuiPaneSize( m_auimgr, propertiesPane, aui_cfg.properties_panel_width, -1 );
363
364 if( aui_cfg.schematic_hierarchy_float )
365 hierarchy_pane.Float();
366
367 if( aui_cfg.search_panel_height > 0 && ( aui_cfg.search_panel_dock_direction == wxAUI_DOCK_TOP
368 || aui_cfg.search_panel_dock_direction == wxAUI_DOCK_BOTTOM ) )
369 {
370 wxAuiPaneInfo& searchPane = m_auimgr.GetPane( SearchPaneName() );
371 searchPane.Direction( aui_cfg.search_panel_dock_direction );
372 SetAuiPaneSize( m_auimgr, searchPane, -1, aui_cfg.search_panel_height );
373 }
374
375 else if( aui_cfg.search_panel_width > 0 && ( aui_cfg.search_panel_dock_direction == wxAUI_DOCK_LEFT
376 || aui_cfg.search_panel_dock_direction == wxAUI_DOCK_RIGHT ) )
377 {
378 wxAuiPaneInfo& searchPane = m_auimgr.GetPane( SearchPaneName() );
379 searchPane.Direction( aui_cfg.search_panel_dock_direction );
380 SetAuiPaneSize( m_auimgr, searchPane, aui_cfg.search_panel_width, -1 );
381 }
382
383 if( aui_cfg.float_net_nav_panel )
384 netNavigatorPane.Float();
385
386 if( aui_cfg.design_blocks_show )
387 SetAuiPaneSize( m_auimgr, designBlocksPane, aui_cfg.design_blocks_panel_docked_width, -1 );
388
389 if( aui_cfg.remote_symbol_show )
390 {
391 SetAuiPaneSize( m_auimgr, remoteSymbolPane, aui_cfg.remote_symbol_panel_docked_width, -1 );
392 }
393
394 if( aui_cfg.hierarchy_panel_docked_width > 0 )
395 {
396 // If the net navigator is not show, let the hierarchy navigator take all of the vertical
397 // space.
398 if( !aui_cfg.show_net_nav_panel )
399 {
400 SetAuiPaneSize( m_auimgr, hierarchy_pane, aui_cfg.hierarchy_panel_docked_width, -1 );
401 }
402 else
403 {
404 SetAuiPaneSize( m_auimgr, hierarchy_pane,
407
408 SetAuiPaneSize( m_auimgr, netNavigatorPane,
409 aui_cfg.net_nav_panel_docked_size.GetWidth(),
410 aui_cfg.net_nav_panel_docked_size.GetHeight() );
411 }
412
413 // wxAUI hack: force width by setting MinSize() and then Fixed()
414 // thanks to ZenJu https://github.com/wxWidgets/wxWidgets/issues/13180
415 hierarchy_pane.MinSize( aui_cfg.hierarchy_panel_docked_width, 60 );
416 hierarchy_pane.Fixed();
417 netNavigatorPane.MinSize( aui_cfg.net_nav_panel_docked_size.GetWidth(), 60 );
418 netNavigatorPane.Fixed();
419 m_auimgr.Update();
420
421 // now make it resizable again
422 hierarchy_pane.Resizable();
423 netNavigatorPane.Resizable();
424 m_auimgr.Update();
425
426 // Note: DO NOT call m_auimgr.Update() anywhere after this; it will nuke the size
427 // back to minimum.
428 hierarchy_pane.MinSize( FromDIP( wxSize( 120, 60 ) ) );
429 netNavigatorPane.MinSize( FromDIP( wxSize( 120, 60 ) ) );
430 }
431 else
432 {
433 m_auimgr.Update();
434 }
435
436 CallAfter( [this]()
437 {
438 wxAuiPaneInfo& remotePane = m_auimgr.GetPane( RemoteSymbolPaneName() );
439
440 if( remotePane.IsShown() && m_remoteSymbolPane )
441 m_remoteSymbolPane->Activate();
442 } );
443
445
446 GetCanvas()->GetGAL()->SetAxesEnabled( false );
447
448 KIGFX::SCH_VIEW* view = GetCanvas()->GetView();
449 static_cast<KIGFX::SCH_PAINTER*>( view->GetPainter() )->SetSchematic( m_schematic );
450
453
454 view->SetLayerVisible( LAYER_ERC_ERR, appearance_cfg.show_erc_errors );
455 view->SetLayerVisible( LAYER_ERC_WARN, appearance_cfg.show_erc_warnings );
457 view->SetLayerVisible( LAYER_OP_VOLTAGES, appearance_cfg.show_op_voltages );
458 view->SetLayerVisible( LAYER_OP_CURRENTS, appearance_cfg.show_op_currents );
459
461
463 m_netNavigator->Bind( wxEVT_TREE_SEL_CHANGING, &SCH_EDIT_FRAME::onNetNavigatorSelChanging, this );
464 m_netNavigator->Bind( wxEVT_TREE_SEL_CHANGED, &SCH_EDIT_FRAME::onNetNavigatorSelection, this );
465 m_netNavigator->Bind( wxEVT_SIZE, &SCH_EDIT_FRAME::onResizeNetNavigator, this );
466
467 setupUnits( eeconfig() );
468
469 // Net list generator
471
472 updateTitle();
473 m_toolManager->GetTool<SCH_NAVIGATE_TOOL>()->ResetHistory();
474
475 m_apiHandler = std::make_unique<API_HANDLER_SCH>( this );
478
479 if( Kiface().IsSingle() )
480 {
481 m_apiHandlerCommon = std::make_unique<API_HANDLER_COMMON>();
483 m_apiLibrariesHandler = std::make_unique<API_HANDLER_LIBRARIES>( LIBRARY_TABLE_TYPE::DESIGN_BLOCK );
485 }
486
487 // Default shutdown reason until a file is loaded
488 KIPLATFORM::APP::SetShutdownBlockReason( this, _( "New schematic file is unsaved" ) );
489
490 // Init for dropping files
494 m_acceptedExts.emplace( wxS( "jpeg" ), &SCH_ACTIONS::ddAddImage );
495 m_acceptedExts.emplace( wxS( "dxf" ), &SCH_ACTIONS::ddImportGraphics );
497 DragAcceptFiles( true );
498
499 // Ensure the window is on top
500 Raise();
501
502 // Now that all sizes are fixed, set the initial hierarchy_pane floating position to the
503 // top-left corner of the canvas
504 wxPoint canvas_pos = GetCanvas()->GetScreenPosition();
505 hierarchy_pane.FloatingPosition( canvas_pos.x + 10, canvas_pos.y + 10 );
506
507 Bind( wxEVT_CHOICE, &SCH_EDIT_FRAME::onVariantSelected, this );
508 Bind( EDA_EVT_CLOSE_DIALOG_BOOK_REPORTER, &SCH_EDIT_FRAME::onCloseSymbolDiffDialog, this );
509 Bind( EDA_EVT_CLOSE_ERC_DIALOG, &SCH_EDIT_FRAME::onCloseErcDialog, this );
510 Bind( EDA_EVT_CLOSE_DIALOG_SYMBOL_FIELDS_TABLE, &SCH_EDIT_FRAME::onCloseSymbolFieldsTableDialog, this );
511}
512
513void SCH_EDIT_FRAME::StartCrossProbeFlash( const std::vector<SCH_ITEM*>& aItems )
514{
515 if( !eeconfig()->m_CrossProbing.flash_selection )
516 {
517 wxLogTrace( traceCrossProbeFlash, "StartCrossProbeFlash: aborted (setting disabled) items=%zu", aItems.size() );
518 return;
519 }
520
521 if( aItems.empty() )
522 {
523 wxLogTrace( traceCrossProbeFlash, "StartCrossProbeFlash: aborted (no items)" );
524 return;
525 }
526
528 {
529 wxLogTrace( traceCrossProbeFlash, "StartCrossProbeFlash: restarting existing flash (phase=%d)",
532 }
533
534 wxLogTrace( traceCrossProbeFlash, "StartCrossProbeFlash: starting with %zu items", aItems.size() );
536
537 for( SCH_ITEM* it : aItems )
538 m_crossProbeFlashItems.push_back( it->m_Uuid );
539
542
543 if( !m_crossProbeFlashTimer.GetOwner() )
544 m_crossProbeFlashTimer.SetOwner( this );
545
546 [[maybe_unused]] bool started = m_crossProbeFlashTimer.Start( 500, wxTIMER_CONTINUOUS );
547 wxLogTrace( traceCrossProbeFlash, "StartCrossProbeFlash: timer start=%d id=%d", (int) started,
548 m_crossProbeFlashTimer.GetId() );
549}
550
551
552void SCH_EDIT_FRAME::OnCrossProbeFlashTimer( wxTimerEvent& aEvent )
553{
554 wxLogTrace( traceCrossProbeFlash, "Timer(SCH) fired: phase=%d running=%d items=%zu", m_crossProbeFlashPhase,
556
558 {
559 wxLogTrace( traceCrossProbeFlash, "Timer fired without active flashing or tools (ignored)" );
560 return;
561 }
562
564
565 if( !selTool )
566 return;
567
568 bool prevGuard = m_syncingPcbToSchSelection;
570
571 if( m_crossProbeFlashPhase % 2 == 0 )
572 {
573 selTool->ClearSelection( true );
574 wxLogTrace( traceCrossProbeFlash, "Phase %d: cleared selection", m_crossProbeFlashPhase );
575 }
576 else
577 {
578 for( const KIID& id : m_crossProbeFlashItems )
579 {
580 if( SCH_ITEM* item = Schematic().ResolveItem( id, nullptr, true ) )
581 selTool->AddItemToSel( item, true );
582 }
583
584 wxLogTrace( traceCrossProbeFlash, "Phase %d: restored %zu items", m_crossProbeFlashPhase,
585 m_crossProbeFlashItems.size() );
586 }
587
588 if( GetCanvas() )
589 {
591 wxLogTrace( traceCrossProbeFlash, "Phase %d: forced canvas refresh", m_crossProbeFlashPhase );
592 }
593
594 m_syncingPcbToSchSelection = prevGuard;
596
597 if( m_crossProbeFlashPhase > 6 )
598 {
599 for( const KIID& id : m_crossProbeFlashItems )
600 {
601 if( SCH_ITEM* item = Schematic().ResolveItem( id, nullptr, true ) )
602 selTool->AddItemToSel( item, true );
603 }
604
605 m_crossProbeFlashing = false;
607 wxLogTrace( traceCrossProbeFlash, "Flashing complete. Final selection size=%zu",
608 m_crossProbeFlashItems.size() );
609 }
610}
611
612
614{
615 m_crossProbeFlashing = false;
617
619
620 // Ensure that teardowns without doCloseWindow are fully unregistered
621 if( m_schematic )
623
624 if( Kiface().IsSingle() )
625 {
628 }
629
630 // A forced teardown (wx deletes every top level window at session end) skips doCloseWindow,
631 // leaving live tools. When we SetScreen(nullptr), we dispatch another tool call, potentially
632 // crashing when the frame is gone
633 if( m_toolManager )
634 {
635 GetCanvas()->SetEvtHandlerEnabled( false );
637 m_toolManager->ShutdownAllTools();
638
639 delete m_toolManager;
640 m_toolManager = nullptr;
641 }
642
643 m_hierarchy->Unbind( wxEVT_SIZE, &SCH_EDIT_FRAME::OnResizeHierarchyNavigator, this );
644
645 // Ensure m_canvasType is up to date, to save it in config
647
648 SetScreen( nullptr );
649
650 if( m_schematic )
651 m_schematic->RemoveAllListeners();
652
653 // Canvas outlives m_schematic; detach tracker consumers before delete.
654 if( GetCanvas() && GetCanvas()->GetView() )
656
657 // Delete all items not in draw list before deleting schematic
658 // to avoid dangling pointers stored in these items
661
662 delete m_schematic;
663 m_schematic = nullptr;
664
665 // Close the project if we are standalone, so it gets cleaned up properly
666 if( Kiface().IsSingle() )
667 {
668 try
669 {
670 GetSettingsManager()->UnloadProject( &Prj(), false );
671 }
672 catch( const std::runtime_error& e )
673 {
674 wxFAIL_MSG( wxString::Format( wxT( "Settings exception occurred: %s" ), e.what() ) );
675 }
676 }
677
678 // We passed ownership of these to wxAuiManager.
679 // delete m_hierarchy;
680 // delete m_selectionFilterPanel;
681}
682
683
685{
686 aEvent.Skip();
687
688 // 1st Call: Handle the size update during the first resize event.
690
691 // Defer the second size capture
692 CallAfter( [this]()
693 {
695 } );
696}
697
698
700{
701 // Called when resizing the Hierarchy Navigator panel
702 // Store the current pane size
703 // It allows to retrieve the last defined pane size when switching between
704 // docked and floating pane state
705 // Note: *DO NOT* call m_auimgr.Update() here: it crashes KiCad at least on Windows
706
707 EESCHEMA_SETTINGS* cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
708 wxAuiPaneInfo& hierarchy_pane = m_auimgr.GetPane( SchematicHierarchyPaneName() );
709
710 if( cfg && m_hierarchy->IsShownOnScreen() )
711 {
712 cfg->m_AuiPanels.hierarchy_panel_float_width = hierarchy_pane.floating_size.x;
713 cfg->m_AuiPanels.hierarchy_panel_float_height = hierarchy_pane.floating_size.y;
714
715 // initialize hierarchy_panel_docked_width and best size only if the hierarchy_pane
716 // width is > 0 (i.e. if its size is already set and has meaning)
717 // if it is floating, its size is not initialized (only floating_size is initialized)
718 // initializing hierarchy_pane.best_size is useful when switching to float pane and
719 // after switching to the docked pane, to retrieve the last docked pane width
720 if( hierarchy_pane.rect.width > 50 ) // 50 is a good margin
721 {
722 cfg->m_AuiPanels.hierarchy_panel_docked_width = hierarchy_pane.rect.width;
723 hierarchy_pane.best_size.x = hierarchy_pane.rect.width;
724 }
725 }
726}
727
728
730{
731 // Create the manager and dispatcher & route draw panel events to the dispatcher
733 m_toolManager->SetEnvironment( &Schematic(), GetCanvas()->GetView(),
734 GetCanvas()->GetViewControls(), config(), this );
735 m_actions = new SCH_ACTIONS();
737
738 // Register tools
739 m_toolManager->RegisterTool( new COMMON_CONTROL );
740 m_toolManager->RegisterTool( new COMMON_TOOLS );
741 m_toolManager->RegisterTool( new ZOOM_TOOL );
742 m_toolManager->RegisterTool( new SCH_SELECTION_TOOL );
743 m_toolManager->RegisterTool( new PICKER_TOOL );
744 m_toolManager->RegisterTool( new SCH_DRAWING_TOOLS );
745 m_toolManager->RegisterTool( new EE_GRAPHIC_TOOL );
746 m_toolManager->RegisterTool( new SCH_LINE_WIRE_BUS_TOOL );
747 m_toolManager->RegisterTool( new SCH_MOVE_TOOL );
748 m_toolManager->RegisterTool( new SCH_ALIGN_TOOL );
749 m_toolManager->RegisterTool( new SCH_EDIT_TOOL );
750 m_toolManager->RegisterTool( new SCH_EDIT_TABLE_TOOL );
751 m_toolManager->RegisterTool( new SCH_GROUP_TOOL );
752 m_toolManager->RegisterTool( new SCH_INSPECTION_TOOL );
753 m_toolManager->RegisterTool( new SCH_DESIGN_BLOCK_CONTROL );
754 m_toolManager->RegisterTool( new SCH_EDITOR_CONTROL );
755 m_toolManager->RegisterTool( new SCH_FIND_REPLACE_TOOL );
756 m_toolManager->RegisterTool( new SCH_POINT_EDITOR );
757 m_toolManager->RegisterTool( new SCH_NAVIGATE_TOOL );
758 m_toolManager->RegisterTool( new PROPERTIES_TOOL );
759 m_toolManager->RegisterTool( new EMBED_TOOL );
760 m_toolManager->InitTools();
761
762 // Run the selection tool, it is supposed to be always active
764
766}
767
768
770{
772
773 ACTION_MANAGER* mgr = m_toolManager->GetActionManager();
774 SCH_EDITOR_CONDITIONS cond( this );
775
776 wxASSERT( mgr );
777
778 auto hasElements =
779 [ this ] ( const SELECTION& aSel )
780 {
781 return GetScreen() &&
782 ( !GetScreen()->Items().empty() || !SELECTION_CONDITIONS::Idle( aSel ) );
783 };
784
785 auto searchPaneCond =
786 [this] ( const SELECTION& )
787 {
788 return m_auimgr.GetPane( SearchPaneName() ).IsShown();
789 };
790
791 auto gitCommitPaneCond = [this]( const SELECTION& )
792 {
793 return IsGitCommitPaneShown();
794 };
795
796 auto propertiesCond =
797 [this] ( const SELECTION& )
798 {
799 return m_auimgr.GetPane( PropertiesPaneName() ).IsShown();
800 };
801
802 auto hierarchyNavigatorCond =
803 [ this ] ( const SELECTION& aSel )
804 {
805 return m_auimgr.GetPane( SchematicHierarchyPaneName() ).IsShown();
806 };
807
808 auto netNavigatorCond =
809 [ this ] (const SELECTION& aSel )
810 {
811 return m_auimgr.GetPane( NetNavigatorPaneName() ).IsShown();
812 };
813
814 auto designBlockCond =
815 [ this ] (const SELECTION& aSel )
816 {
817 return m_auimgr.GetPane( DesignBlocksPaneName() ).IsShown();
818 };
819
820 auto remoteSymbolCond =
821 [ this ] (const SELECTION& aSel )
822 {
823 return m_auimgr.GetPane( RemoteSymbolPaneName() ).IsShown();
824 };
825
826 auto undoCond =
827 [ this ] (const SELECTION& aSel )
828 {
830 return true;
831
832 return GetUndoCommandCount() > 0;
833 };
834
835 auto groupWithDesignBlockLink =
836 [] ( const SELECTION& aSel )
837 {
838 if( aSel.Size() != 1 )
839 return false;
840
841 if( aSel[0]->Type() != SCH_GROUP_T )
842 return false;
843
844 SCH_GROUP* group = static_cast<SCH_GROUP*>( aSel.GetItem( 0 ) );
845
846 return group->HasDesignBlockLink();
847 };
848
849#define ENABLE( x ) ACTION_CONDITIONS().Enable( x )
850#define CHECK( x ) ACTION_CONDITIONS().Check( x )
851
853 mgr->SetConditions( ACTIONS::undo, ENABLE( undoCond ) );
855
856 mgr->SetConditions( SCH_ACTIONS::showSearch, CHECK( searchPaneCond ) );
857 mgr->SetConditions( SCH_ACTIONS::showHierarchy, CHECK( hierarchyNavigatorCond ) );
858 mgr->SetConditions( SCH_ACTIONS::showNetNavigator, CHECK( netNavigatorCond ) );
859 mgr->SetConditions( ACTIONS::showProperties, CHECK( propertiesCond ) );
860 mgr->SetConditions( ACTIONS::showGitCommitPane, CHECK( gitCommitPaneCond ) );
861 mgr->SetConditions( SCH_ACTIONS::showDesignBlockPanel, CHECK( designBlockCond ) );
862 mgr->SetConditions( SCH_ACTIONS::showRemoteSymbolPanel, CHECK( remoteSymbolCond ) );
865
866 mgr->SetConditions( ACTIONS::cut, ENABLE( hasElements ) );
867 mgr->SetConditions( ACTIONS::copy, ENABLE( hasElements ) );
868 mgr->SetConditions( ACTIONS::copyAsText, ENABLE( hasElements ) );
871 mgr->SetConditions( ACTIONS::doDelete, ENABLE( hasElements ) );
872 mgr->SetConditions( ACTIONS::duplicate, ENABLE( hasElements ) );
879 mgr->SetConditions( ACTIONS::selectAll, ENABLE( hasElements ) );
880 mgr->SetConditions( ACTIONS::unselectAll, ENABLE( hasElements ) );
881
883 ENABLE( SELECTION_CONDITIONS::NotEmpty ).HotkeyEnable( hasElements ) );
885 ENABLE( SELECTION_CONDITIONS::NotEmpty ).HotkeyEnable( hasElements ) );
887 ENABLE( SELECTION_CONDITIONS::NotEmpty ).HotkeyEnable( hasElements ) );
889 ENABLE( SELECTION_CONDITIONS::NotEmpty ).HotkeyEnable( hasElements ) );
892
893 mgr->SetConditions( SCH_ACTIONS::placeLinkedDesignBlock, ENABLE( groupWithDesignBlockLink ) );
894 mgr->SetConditions( SCH_ACTIONS::saveToLinkedDesignBlock, ENABLE( groupWithDesignBlockLink ) );
895
900
901 auto showHiddenPinsCond =
902 [this]( const SELECTION& )
903 {
904 return GetShowAllPins();
905 };
906
907 auto showHiddenFieldsCond =
908 [this]( const SELECTION& )
909 {
911 return cfg && cfg->m_Appearance.show_hidden_fields;
912 };
913
914 auto showDirectiveLabelsCond =
915 [this]( const SELECTION& )
916 {
918 return cfg && cfg->m_Appearance.show_directive_labels;
919 };
920
921 auto showERCErrorsCond =
922 [this]( const SELECTION& )
923 {
925 return cfg && cfg->m_Appearance.show_erc_errors;
926 };
927
928 auto showERCWarningsCond =
929 [this]( const SELECTION& )
930 {
932 return cfg && cfg->m_Appearance.show_erc_warnings;
933 };
934
935 auto showERCExclusionsCond =
936 [this]( const SELECTION& )
937 {
939 return cfg && cfg->m_Appearance.show_erc_exclusions;
940 };
941
942 auto markSimExclusionsCond =
943 [this]( const SELECTION& )
944 {
946 return cfg && cfg->m_Appearance.mark_sim_exclusions;
947 };
948
949 auto showOPVoltagesCond =
950 [this]( const SELECTION& )
951 {
953 return cfg && cfg->m_Appearance.show_op_voltages;
954 };
955
956 auto showOPCurrentsCond =
957 [this]( const SELECTION& )
958 {
960 return cfg && cfg->m_Appearance.show_op_currents;
961 };
962
963 auto showPinAltModeIconsCond =
964 [this]( const SELECTION& )
965 {
967 return cfg && cfg->m_Appearance.show_pin_alt_icons;
968 };
969
970 auto showAnnotateAutomaticallyCond =
971 [this]( const SELECTION& )
972 {
974 };
975
976 auto remapSymbolsCondition =
977 [&]( const SELECTION& aSel )
978 {
979 SCH_SCREENS schematic( Schematic().Root() );
980
981 // The remapping can only be performed on legacy projects.
982 return schematic.HasNoFullyDefinedLibIds();
983 };
984
985 auto belowRootSheetCondition =
986 [this]( const SELECTION& aSel )
987 {
988 SCH_NAVIGATE_TOOL* navigateTool = m_toolManager->GetTool<SCH_NAVIGATE_TOOL>();
989 return navigateTool && navigateTool->CanGoUp();
990 };
991
992 mgr->SetConditions( SCH_ACTIONS::leaveSheet, ENABLE( belowRootSheetCondition ) );
993
994 /* Some of these are bound by default to arrow keys which will get a different action if we
995 * disable the buttons. So always leave them enabled so the action is consistent.
996 * https://gitlab.com/kicad/code/kicad/-/issues/14783
997 mgr->SetConditions( SCH_ACTIONS::navigateUp, ENABLE( belowRootSheetCondition ) );
998 mgr->SetConditions( SCH_ACTIONS::navigateForward, ENABLE( navHistoryHasForward ) );
999 mgr->SetConditions( SCH_ACTIONS::navigateBack, ENABLE( navHistoryHsBackward ) );
1000 */
1001
1002 mgr->SetConditions( SCH_ACTIONS::remapSymbols, ENABLE( remapSymbolsCondition ) );
1003 mgr->SetConditions( SCH_ACTIONS::toggleHiddenPins, CHECK( showHiddenPinsCond ) );
1004 mgr->SetConditions( SCH_ACTIONS::toggleHiddenFields, CHECK( showHiddenFieldsCond ) );
1005 mgr->SetConditions( SCH_ACTIONS::toggleDirectiveLabels, CHECK( showDirectiveLabelsCond ) );
1006 mgr->SetConditions( SCH_ACTIONS::toggleERCErrors, CHECK( showERCErrorsCond ) );
1007 mgr->SetConditions( SCH_ACTIONS::toggleERCWarnings, CHECK( showERCWarningsCond ) );
1008 mgr->SetConditions( SCH_ACTIONS::toggleERCExclusions, CHECK( showERCExclusionsCond ) );
1009 mgr->SetConditions( SCH_ACTIONS::markSimExclusions, CHECK( markSimExclusionsCond ) );
1010 mgr->SetConditions( SCH_ACTIONS::toggleOPVoltages, CHECK( showOPVoltagesCond ) );
1011 mgr->SetConditions( SCH_ACTIONS::toggleOPCurrents, CHECK( showOPCurrentsCond ) );
1012 mgr->SetConditions( SCH_ACTIONS::togglePinAltIcons, CHECK( showPinAltModeIconsCond ) );
1013 mgr->SetConditions( SCH_ACTIONS::toggleAnnotateAuto, CHECK( showAnnotateAutomaticallyCond ) );
1015
1018
1019#define CURRENT_TOOL( action ) mgr->SetConditions( action, CHECK( cond.CurrentTool( action ) ) )
1020
1054
1055#undef CURRENT_TOOL
1056#undef CHECK
1057#undef ENABLE
1058}
1059
1060
1062{
1063 // we cannot store a pointer to an item in the display list here since
1064 // that item may be deleted, such as part of a line concatenation or other.
1065 // So simply always keep a copy of the object which is to be repeated.
1066
1067 if( aItem )
1068 {
1069 m_items_to_repeat.clear();
1070
1071 AddCopyForRepeatItem( aItem );
1072 }
1073}
1074
1075
1077{
1078 // we cannot store a pointer to an item in the display list here since
1079 // that item may be deleted, such as part of a line concatenation or other.
1080 // So simply always keep a copy of the object which is to be repeated.
1081
1082 if( aItem )
1083 {
1084 std::unique_ptr<SCH_ITEM> repeatItem( static_cast<SCH_ITEM*>( aItem->Duplicate( IGNORE_PARENT_GROUP ) ) );
1085
1086 // Clone() preserves the flags & parent, we want 'em cleared.
1087 repeatItem->ClearFlags();
1088 repeatItem->SetParent( nullptr );
1089
1090 m_items_to_repeat.emplace_back( std::move( repeatItem ) );
1091 }
1092}
1093
1094
1095EDA_ITEM* SCH_EDIT_FRAME::ResolveItem( const KIID& aId, bool aAllowNullptrReturn ) const
1096{
1097 return Schematic().ResolveItem( aId, nullptr, aAllowNullptrReturn );
1098}
1099
1100
1105
1106
1111
1112
1114{
1115 return *m_schematic;
1116}
1117
1118
1120{
1121 return GetCurrentSheet().Last()->GetName();
1122}
1123
1124
1126{
1128}
1129
1130
1132{
1133 m_schematic->CreateDefaultScreens();
1134 SetScreen( Schematic().RootScreen() );
1135
1136 if( GetScreen() == nullptr )
1137 {
1138 SCH_SCREEN* screen = new SCH_SCREEN( m_schematic );
1139 SetScreen( screen );
1140 }
1141}
1142
1143
1145{
1146 return m_schematic->CurrentSheet();
1147}
1148
1149
1151{
1152 if( aSheet != GetCurrentSheet() )
1153 {
1154 ClearFocus();
1155
1156 wxLogTrace( traceSchCurrentSheet,
1157 "SCH_EDIT_FRAME::SetCurrentSheet: Changing from path='%s' (size=%zu) to path='%s' (size=%zu)",
1158 GetCurrentSheet().Path().AsString(),
1159 GetCurrentSheet().size(),
1160 aSheet.Path().AsString(),
1161 aSheet.size() );
1162
1163 Schematic().SetCurrentSheet( aSheet );
1165 GetCanvas()->DisplaySheet( aSheet.LastScreen() );
1166 }
1167}
1168
1169
1171{
1173
1174 for( SCH_ITEM* item : screen->Items() )
1175 item->ClearCaches();
1176
1177 for( const std::pair<const wxString, LIB_SYMBOL*>& libSymbol : screen->GetLibSymbols() )
1178 {
1179 wxCHECK2( libSymbol.second, continue );
1180 libSymbol.second->ClearCaches();
1181 }
1182
1183 if( Schematic().Settings().m_IntersheetRefsShow )
1185
1186 ClearFocus();
1187
1188 GetCanvas()->DisplaySheet( GetCurrentSheet().LastScreen() );
1189
1190 // The modern canvas only re-emits cached geometry for dirty items, so the new sheet's static
1191 // pool would otherwise stay empty
1193
1194 if( SCH_SELECTION_TOOL* selectionTool = m_toolManager->GetTool<SCH_SELECTION_TOOL>() )
1195 selectionTool->Reset( TOOL_BASE::REDRAW );
1196
1198}
1199
1200
1201bool SCH_EDIT_FRAME::canCloseWindow( wxCloseEvent& aEvent )
1202{
1203 // Exit interactive editing
1204 // Note this this will commit *some* pending changes. For instance, the SCH_POINT_EDITOR
1205 // will cancel any drag currently in progress, but commit all changes from previous drags.
1206 if( m_toolManager )
1208
1209 // Shutdown blocks must be determined and vetoed as early as possible
1210 if( KIPLATFORM::APP::SupportsShutdownBlockReason() && aEvent.GetId() == wxEVT_QUERY_END_SESSION
1211 && IsContentModified() )
1212 {
1213 return false;
1214 }
1215
1216 if( Kiface().IsSingle() )
1217 {
1218 auto* symbolEditor = (SYMBOL_EDIT_FRAME*) Kiway().Player( FRAME_SCH_SYMBOL_EDITOR, false );
1219
1220 if( symbolEditor && !symbolEditor->Close() ) // Can close symbol editor?
1221 return false;
1222
1223 auto* symbolViewer = (SYMBOL_VIEWER_FRAME*) Kiway().Player( FRAME_SCH_VIEWER, false );
1224
1225 if( symbolViewer && !symbolViewer->Close() ) // Can close symbol viewer?
1226 return false;
1227
1228 // SYMBOL_CHOOSER_FRAME is always modal so this shouldn't come up, but better safe than
1229 // sorry.
1230 auto* chooser = (SYMBOL_CHOOSER_FRAME*) Kiway().Player( FRAME_SYMBOL_CHOOSER, false );
1231
1232 if( chooser && !chooser->Close() ) // Can close symbol chooser?
1233 return false;
1234 }
1235 else
1236 {
1237 auto* symbolEditor = (SYMBOL_EDIT_FRAME*) Kiway().Player( FRAME_SCH_SYMBOL_EDITOR, false );
1238
1239 if( symbolEditor && symbolEditor->IsSymbolFromSchematic() )
1240 {
1241 if( !symbolEditor->CanCloseSymbolFromSchematic( true ) )
1242 return false;
1243 }
1244 }
1245
1246 if( !Kiway().PlayerClose( FRAME_SIMULATOR, false ) ) // Can close the simulator?
1247 return false;
1248
1250 && !m_symbolFieldsTableDialog->Close( false ) ) // Can close the symbol fields table?
1251 {
1252 return false;
1253 }
1254
1255 // We may have gotten multiple events; don't clean up twice
1256 if( !Schematic().IsValid() )
1257 return false;
1258
1259 if( IsContentModified() )
1260 {
1261 wxFileName fileName = Schematic().RootScreen()->GetFileName();
1262 wxString msg = _( "Save changes to '%s' before closing?" );
1263
1264 if( !HandleUnsavedChanges( this, wxString::Format( msg, fileName.GetFullName() ),
1265 [&]() -> bool
1266 {
1267 return SaveProject();
1268 } ) )
1269 {
1270 return false;
1271 }
1272
1273 // If user selected 'No' (discard), create duplicate commit of last saved state and
1274 // move Last_Save tag forward so history shows an explicit discard event.
1275 if( GetLastUnsavedChangesResponse() == wxID_NO )
1276 {
1277 wxString projPath = Prj().GetProjectPath();
1278
1279 if( !projPath.IsEmpty() && Kiway().LocalHistory().HistoryExists( projPath ) )
1280 {
1281 Kiway().LocalHistory().CommitDuplicateOfLastSave( projPath, wxS( "Schematic" ),
1282 wxS( "Discard unsaved schematic changes" ) );
1283 }
1284 }
1285 }
1286
1287 return true;
1288}
1289
1290
1292{
1293 m_crossProbeFlashing = false;
1295
1298
1299 // Unregister the autosave saver before any cleanup that might invalidate m_schematic
1300 if( m_schematic )
1302
1304
1305 SCH_SHEET_LIST sheetlist = Schematic().Hierarchy();
1306
1307 if( !Prj().IsNullProject() )
1308 {
1309 std::vector<wxString> sheetSrcs;
1310 sheetSrcs.reserve( sheetlist.size() );
1311
1312 for( const SCH_SHEET_PATH& path : sheetlist )
1313 {
1314 SCH_SCREEN* screen = path.LastScreen();
1315
1316 // Only sweep autosaves for sheets actually dirtied in this session.
1317 // A clean sheet's autosave, if any, is a previous-session leftover the
1318 // user explicitly deferred in the recovery dialog.
1319 if( screen && screen->IsContentModified() )
1320 sheetSrcs.push_back( Prj().AbsolutePath( screen->GetFileName() ) );
1321 }
1322
1323 Kiway().LocalHistory().RemoveAutosaveFiles( Prj().GetProjectPath(), sheetSrcs );
1324 }
1325
1326 // Close modeless dialogs. They're trouble when they get destroyed after the frame.
1327 Unbind( EDA_EVT_CLOSE_DIALOG_BOOK_REPORTER, &SCH_EDIT_FRAME::onCloseSymbolDiffDialog, this );
1328 Unbind( EDA_EVT_CLOSE_ERC_DIALOG, &SCH_EDIT_FRAME::onCloseErcDialog, this );
1329 Unbind( EDA_EVT_CLOSE_DIALOG_SYMBOL_FIELDS_TABLE, &SCH_EDIT_FRAME::onCloseSymbolFieldsTableDialog, this );
1330 m_netNavigator->Unbind( wxEVT_TREE_SEL_CHANGING, &SCH_EDIT_FRAME::onNetNavigatorSelChanging, this );
1331 m_netNavigator->Unbind( wxEVT_TREE_SEL_CHANGED, &SCH_EDIT_FRAME::onNetNavigatorSelection, this );
1332
1333 if( m_diffSymbolDialog )
1334 {
1335 m_diffSymbolDialog->Destroy();
1336 m_diffSymbolDialog = nullptr;
1337 }
1338
1339 if( m_ercDialog )
1340 {
1341 m_ercDialog->Destroy();
1342 m_ercDialog = nullptr;
1343 }
1344
1346 {
1347 m_symbolFieldsTableDialog->Destroy();
1348 m_symbolFieldsTableDialog = nullptr;
1349 }
1350
1351 // Make sure local settings are persisted
1352 if( Prj().GetLocalSettings().ShouldAutoSave() )
1354
1355 delete m_toolManager;
1356 m_toolManager = nullptr;
1357
1358 wxAuiPaneInfo& hierarchy_pane = m_auimgr.GetPane( SchematicHierarchyPaneName() );
1359
1360 if( hierarchy_pane.IsShown() && hierarchy_pane.IsFloating() )
1361 {
1362 hierarchy_pane.Show( false );
1363 m_auimgr.Update();
1364 }
1365
1366 sheetlist.ClearModifyStatus();
1367
1368 wxString fileName = Prj().AbsolutePath( Schematic().RootScreen()->GetFileName() );
1369
1370 if( !Schematic().GetFileName().IsEmpty() && !Schematic().RootScreen()->IsEmpty() )
1371 UpdateFileHistory( fileName );
1372
1373 // Clear the view before freeing any schematic items. VIEW::Clear() walks m_allItems and
1374 // touches each item's private data, so the items must still be alive when this runs.
1375 SetScreen( nullptr );
1376
1377 Schematic().RootScreen()->Clear( true );
1378
1379 // all sub sheets are deleted, only the main sheet is usable
1381
1382 Schematic().Reset();
1383
1384 // Prevents any rogue events from continuing (i.e. search panel tries to redraw)
1385 Show( false );
1386
1387 Destroy();
1388}
1389
1390
1392{
1393 m_searchPane->FocusSearch();
1394}
1395
1396
1398{
1399 return Schematic().ErcSettings().GetSeverity( aErrorCode );
1400}
1401
1402
1404{
1406
1407 if( GetScreen() )
1408 {
1410 Kiway().LocalHistory().NoteFileChange( GetScreen()->GetFileName() );
1411 }
1412
1413 if( m_isClosing )
1414 return;
1415
1416 if( GetCanvas() )
1417 GetCanvas()->Refresh();
1418
1419 if( GetScreen() && !GetTitle().StartsWith( wxS( "*" ) ) )
1420 updateTitle();
1421}
1422
1423
1425{
1426 if( SCH_SCREEN* screen = GetScreen() )
1427 screen->SetContentModified( aModified );
1428
1429 updateTitle();
1430}
1431
1432
1434{
1435 if( Kiface().IsSingle() )
1436 {
1437 DisplayError( this, _( "Cannot update the PCB because the Schematic Editor is opened in stand-alone "
1438 "mode. In order to create/update PCBs from schematics, launch the main KiCad "
1439 "application and create a project." ) );
1440 return;
1441 }
1442
1443 KIWAY_PLAYER* frame = Kiway().Player( FRAME_PCB_EDITOR, false );
1444 wxEventBlocker blocker( this );
1445
1446 if( !frame )
1447 {
1448 wxFileName fn = Prj().GetProjectFullName();
1449 fn.SetExt( FILEEXT::PcbFileExtension );
1450
1451 frame = Kiway().Player( FRAME_PCB_EDITOR, true );
1452
1453 // If Kiway() cannot create the Pcbnew frame, it shows a error message, and
1454 // frame is null
1455 if( !frame )
1456 return;
1457
1458 frame->OpenProjectFiles( std::vector<wxString>( 1, fn.GetFullPath() ) );
1459 }
1460
1461 if( !frame->IsVisible() )
1462 frame->Show( true );
1463
1464 // On Windows, Raise() does not bring the window on screen, when iconized
1465 if( frame->IsIconized() )
1466 frame->Iconize( false );
1467
1468 frame->Raise();
1469
1470 std::string payload;
1472}
1473
1474
1475void SCH_EDIT_FRAME::UpdateHierarchyNavigator( bool aRefreshNetNavigator, bool aClear )
1476{
1477 m_netNavigatorStale = true;
1478 m_toolManager->GetTool<SCH_NAVIGATE_TOOL>()->CleanHistory();
1479 m_hierarchy->UpdateHierarchyTree( aClear );
1480
1481 if( aRefreshNetNavigator )
1483}
1484
1485
1487{
1488 // Update only the hierarchy navigation tree labels.
1489 // The tree list is expected to be up to date
1490 m_hierarchy->UpdateLabelsHierarchyTree();
1491}
1492
1493
1495{
1496 m_hierarchy->UpdateHierarchySelection();
1497}
1498
1499
1500void SCH_EDIT_FRAME::OnLoadFile( wxCommandEvent& event )
1501{
1502 wxString filename = GetFileFromHistory( event.GetId(), _( "Schematic" ) );
1503
1504 if( !filename.IsEmpty() )
1505 OpenProjectFiles( std::vector<wxString>( 1, filename ), KICTL_KICAD_ONLY );
1506}
1507
1508
1509void SCH_EDIT_FRAME::OnClearFileHistory( wxCommandEvent& aEvent )
1510{
1512}
1513
1514
1516{
1517 // Only standalone mode can directly load a new document
1518 if( !Kiface().IsSingle() )
1519 return;
1520
1521 wxString pro_dir = m_mruPath;
1522
1523 wxFileDialog dlg( this, _( "New Schematic" ), pro_dir, wxEmptyString, FILEEXT::KiCadSchematicFileWildcard(),
1524 wxFD_SAVE );
1525
1527
1528 if( dlg.ShowModal() != wxID_CANCEL )
1529 {
1530 // Enforce the extension, wxFileDialog is inept.
1531 wxFileName create_me = EnsureFileExtension( dlg.GetPath(), FILEEXT::KiCadSchematicFileExtension );
1532
1533 if( create_me.FileExists() )
1534 {
1535 wxString msg;
1536 msg.Printf( _( "Schematic file '%s' already exists." ), create_me.GetFullName() );
1537 DisplayError( this, msg );
1538 return ;
1539 }
1540
1541 // OpenProjectFiles() requires absolute
1542 wxASSERT_MSG( create_me.IsAbsolute(), wxS( "wxFileDialog returned non-absolute path" ) );
1543
1544 OpenProjectFiles( std::vector<wxString>( 1, create_me.GetFullPath() ), KICTL_CREATE );
1545 m_mruPath = create_me.GetPath();
1546 }
1547}
1548
1549
1551{
1552 // Only standalone mode can directly load a new document
1553 if( !Kiface().IsSingle() )
1554 return;
1555
1556 wxString pro_dir = m_mruPath;
1557 wxString wildcards = FILEEXT::AllSchematicFilesWildcard()
1559 + wxS( "|" ) + FILEEXT::LegacySchematicFileWildcard();
1560
1561 wxFileDialog dlg( this, _( "Open Schematic" ), pro_dir, wxEmptyString, wildcards,
1562 wxFD_OPEN | wxFD_FILE_MUST_EXIST );
1563
1565
1566 if( dlg.ShowModal() != wxID_CANCEL )
1567 {
1568 OpenProjectFiles( std::vector<wxString>( 1, dlg.GetPath() ), KICTL_KICAD_ONLY );
1570 }
1571
1572 // Since we know we're single-top here: trigger library reload
1573 CallAfter(
1574 [&]()
1575 {
1576 KIFACE *schface = Kiway().KiFACE( KIWAY::FACE_SCH );
1577 schface->PreloadLibraries( &Kiway() );
1578
1580 } );
1581}
1582
1583
1585{
1587
1588 // Drop the symbol fields table so export paths re-bind to the new project (#22395).
1590 {
1591 m_symbolFieldsTableDialog->Destroy();
1592 m_symbolFieldsTableDialog = nullptr;
1593 }
1594
1596 m_designBlocksPane->ProjectChanged();
1597}
1598
1599
1601{
1603 [this]( const wxString& aProjectPath, std::vector<HISTORY_FILE_DATA>& aFileData )
1604 {
1605 m_schematic->SaveToHistory( aProjectPath, aFileData );
1606 },
1607 m_schematic->GetHistoryLifetimeToken() );
1608
1609 // A standalone editor has no project manager to record the project's own files
1611}
1612
1613
1615{
1616 // Use the project's board, not the active sheet's name, which may belong to another project.
1617 wxString projectName = Prj().GetProjectFullName();
1618
1619 wxFileName kicad_board =
1620 projectName.IsEmpty() ? Prj().AbsolutePath( Schematic().GetFileName() ) : wxFileName( projectName );
1621
1622 if( kicad_board.IsOk() && !kicad_board.GetName().IsEmpty() )
1623 {
1624 kicad_board.SetExt( FILEEXT::PcbFileExtension );
1625 wxFileName legacy_board( kicad_board );
1626 legacy_board.SetExt( FILEEXT::LegacyPcbFileExtension );
1627 wxFileName& boardfn = legacy_board;
1628
1629 if( !legacy_board.FileExists() || kicad_board.FileExists() )
1630 boardfn = kicad_board;
1631
1632 if( Kiface().IsSingle() )
1633 {
1634 ExecuteFile( PCBNEW_EXE, boardfn.GetFullPath() );
1635 }
1636 else
1637 {
1638 wxEventBlocker blocker(this);
1639 KIWAY_PLAYER* frame = Kiway().Player( FRAME_PCB_EDITOR, false );
1640
1641 if( !frame )
1642 {
1643 frame = Kiway().Player( FRAME_PCB_EDITOR, true );
1644
1645 // frame can be null if Cvpcb cannot be run. No need to show a warning
1646 // Kiway() generates the error messages
1647 if( !frame )
1648 return;
1649
1650 frame->OpenProjectFiles( std::vector<wxString>( 1, boardfn.GetFullPath() ) );
1651 }
1652
1653 if( !frame->IsVisible() )
1654 frame->Show( true );
1655
1656 // On Windows, Raise() does not bring the window on screen, when iconized
1657 if( frame->IsIconized() )
1658 frame->Iconize( false );
1659
1660 frame->Raise();
1661 }
1662 }
1663 else
1664 {
1666 }
1667}
1668
1669
1671{
1672 wxFileName fn = Prj().AbsolutePath( Schematic().GetFileName() );
1673 fn.SetExt( FILEEXT::NetlistFileExtension );
1674
1675 if( !ReadyToNetlist( _( "Assigning footprints requires a fully annotated schematic." ) ) )
1676 return;
1677
1678 try
1679 {
1680 KIWAY_PLAYER* player = Kiway().Player( FRAME_CVPCB, false ); // test open already.
1681
1682 if( !player )
1683 {
1684 player = Kiway().Player( FRAME_CVPCB, true );
1685
1686 // player can be null if Cvpcb cannot be run. No need to show a warning
1687 // Kiway() generates the error messages
1688 if( !player )
1689 return;
1690
1691 player->Show( true );
1692 }
1693
1695
1696 player->Raise();
1697 }
1698 catch( const IO_ERROR& )
1699 {
1700 DisplayError( this, _( "Could not open CvPcb" ) );
1701 }
1702}
1703
1704
1705void SCH_EDIT_FRAME::OnExit( wxCommandEvent& event )
1706{
1707 if( event.GetId() == wxID_EXIT )
1708 Kiway().OnKiCadExit();
1709
1710 if( event.GetId() == wxID_CLOSE || Kiface().IsSingle() )
1711 Close( false );
1712}
1713
1714
1716{
1718 [this]( KIGFX::VIEW_ITEM* aItem ) -> int
1719 {
1720 SCH_SYMBOL* symbol = dynamic_cast<SCH_SYMBOL*>( aItem );
1721
1722 if( !symbol )
1723 return 0;
1724
1725 symbol->ClearCaches();
1726 GetScreen()->UpdateDisplayBounds( symbol );
1728 } );
1729}
1730
1731
1733{
1734 SCHEMATIC_SETTINGS& settings = m_schematic->Settings();
1735 SIM_LIB_MGR simLibMgr( &Prj() );
1736 NULL_REPORTER devnull;
1737 SCH_SHEET_PATH& sheetPath = GetCurrentSheet();
1738 wxString variant = m_schematic->GetCurrentVariant();
1739
1740 // Patch for bug early in V7.99 dev
1741 if( settings.m_OPO_VRange.EndsWith( 'A' ) )
1742 settings.m_OPO_VRange[ settings.m_OPO_VRange.Length() - 1 ] = 'V';
1743
1744 // Update items which may have ${OP} text variables
1745 //
1747 [&]( KIGFX::VIEW_ITEM* aItem ) -> int
1748 {
1749 int flags = 0;
1750
1751 auto invalidateTextVars =
1752 [&flags]( EDA_TEXT* text )
1753 {
1754 if( text->HasTextVars() )
1755 {
1756 text->ClearRenderCache();
1757 text->ClearBoundingBoxCache();
1759 }
1760 };
1761
1762 if( SCH_ITEM* item = dynamic_cast<SCH_ITEM*>( aItem ) )
1763 {
1764 item->RunOnChildren(
1765 [&invalidateTextVars]( SCH_ITEM* aChild )
1766 {
1767 if( EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( aChild ) )
1768 invalidateTextVars( text );
1769 },
1771 }
1772
1773 if( EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( aItem ) )
1774 invalidateTextVars( text );
1775
1776 return flags;
1777 } );
1778
1779 // Update OP overlay items
1780 //
1781 for( SCH_ITEM* item : GetScreen()->Items() )
1782 {
1783 if( sheetPath.GetExcludedFromSim( variant ) )
1784 continue;
1785
1786 if( item->Type() == SCH_LINE_T )
1787 {
1788 SCH_LINE* line = static_cast<SCH_LINE*>( item );
1789
1790 if( !line->GetOperatingPoint().IsEmpty() )
1791 GetCanvas()->GetView()->Update( line );
1792
1793 line->SetOperatingPoint( wxEmptyString );
1794
1795 // update value from netlist, below
1796 }
1797 else if( item->Type() == SCH_SYMBOL_T )
1798 {
1799 SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( item );
1800 wxString ref = symbol->GetRef( &sheetPath );
1801 std::vector<SCH_PIN*> pins = symbol->GetPins( &sheetPath );
1802
1803 // Power symbols and other symbols which have the reference starting with "#" are
1804 // not included in simulation
1805 if( ref.StartsWith( '#' ) || symbol->ResolveExcludedFromSim( &sheetPath, variant ) )
1806 continue;
1807
1808 for( SCH_PIN* pin : pins )
1809 {
1810 if( !pin->GetOperatingPoint().IsEmpty() )
1811 GetCanvas()->GetView()->Update( pin );
1812
1813 pin->SetOperatingPoint( wxEmptyString );
1814 }
1815
1816 if( pins.size() == 2 )
1817 {
1818 wxString op = m_schematic->GetOperatingPoint( ref, settings.m_OPO_IPrecision, settings.m_OPO_IRange );
1819
1820 if( !op.IsEmpty() && op != wxS( "--" ) && op != wxS( "?" ) )
1821 {
1822 pins[0]->SetOperatingPoint( op );
1823 GetCanvas()->GetView()->Update( symbol );
1824 }
1825 }
1826 else
1827 {
1828 std::vector<EMBEDDED_FILES*> embeddedFilesStack;
1829 embeddedFilesStack.push_back( m_schematic->GetEmbeddedFiles() );
1830
1831 if( symbol->GetLibSymbolRef() )
1832 symbol->GetLibSymbolRef()->AppendParentEmbeddedFiles( embeddedFilesStack );
1833
1834 if( EMBEDDED_FILES* symbolEmbeddedFiles = symbol->GetEmbeddedFiles() )
1835 embeddedFilesStack.push_back( symbolEmbeddedFiles );
1836
1837 simLibMgr.SetFilesStack( std::move( embeddedFilesStack ) );
1838
1839 SIM_MODEL& model = simLibMgr.CreateModel( &sheetPath, *symbol, true, 0, variant, devnull ).model;
1840
1841 SPICE_ITEM spiceItem;
1842 spiceItem.refName = ref;
1843 ref = model.SpiceGenerator().ItemName( spiceItem );
1844
1845 for( const auto& modelPin : model.GetPins() )
1846 {
1847 SCH_PIN* symbolPin = symbol->GetPin( modelPin.get().symbolPinNumber );
1848 wxString netChainName = ref + wxS( ":" ) + modelPin.get().modelPinName;
1849 wxString op = m_schematic->GetOperatingPoint( netChainName, settings.m_OPO_IPrecision,
1850 settings.m_OPO_IRange );
1851
1852 if( symbolPin && !op.IsEmpty() && op != wxS( "--" ) && op != wxS( "?" ) )
1853 {
1854 symbolPin->SetOperatingPoint( op );
1855 GetCanvas()->GetView()->Update( symbol );
1856 }
1857 }
1858 }
1859 }
1860 }
1861
1863 [this]( SCH_LINE* aWire )
1864 {
1865 GetCanvas()->GetView()->Update( aWire );
1866 } );
1867}
1868
1869
1871{
1872 if( aItem->Type() == SCH_GLOBAL_LABEL_T || aItem->Type() == SCH_HIER_LABEL_T )
1873 {
1874 SCH_LABEL_BASE* label = static_cast<SCH_LABEL_BASE*>( aItem );
1875
1876 if( label->AutoRotateOnPlacement() )
1877 {
1878 SPIN_STYLE spin = aScreen->GetLabelOrientationForPoint( label->GetPosition(), label->GetSpinStyle(),
1879 &GetCurrentSheet() );
1880
1881 if( spin != label->GetSpinStyle() )
1882 {
1883 label->SetSpinStyle( spin );
1884
1885 for( SCH_ITEM* item : aScreen->Items().OfType( SCH_GLOBAL_LABEL_T ) )
1886 {
1887 SCH_LABEL_BASE* otherLabel = static_cast<SCH_LABEL_BASE*>( item );
1888
1889 if( otherLabel != label && otherLabel->GetText() == label->GetText() )
1890 otherLabel->AutoplaceFields( aScreen, AUTOPLACE_AUTO );
1891 }
1892 }
1893 }
1894 }
1895}
1896
1897
1899{
1900 SCH_SCREEN* screen = GetScreen();
1901
1902 wxCHECK( screen, /* void */ );
1903
1904 wxString title;
1905
1906 if( !screen->GetFileName().IsEmpty() )
1907 {
1908 wxFileName fn( Prj().AbsolutePath( screen->GetFileName() ) );
1909 bool readOnly = false;
1910 bool unsaved = false;
1911
1912 if( fn.IsOk() && screen->FileExists() )
1913 readOnly = screen->IsReadOnly();
1914 else
1915 unsaved = true;
1916
1917 if( IsContentModified() )
1918 title = wxT( "*" );
1919
1920 title += fn.GetName();
1921
1922 wxString sheetPath = GetCurrentSheet().PathHumanReadable( false, true );
1923
1924 if( sheetPath != fn.GetName() )
1925 title += wxString::Format( wxT( " [%s]" ), sheetPath );
1926
1927 if( readOnly )
1928 title += wxS( " " ) + _( "[Read Only]" );
1929
1930 if( unsaved )
1931 title += wxS( " " ) + _( "[Unsaved]" );
1932 }
1933 else
1934 {
1935 title = _( "[no schematic loaded]" );
1936 }
1937
1938 title += wxT( " \u2014 " ) + _( "Schematic Editor" );
1939
1940 SetTitle( title );
1941}
1942
1943
1945{
1947
1948 if( GetScreen() )
1949 GetScreen()->m_zoomInitialized = true;
1950}
1951
1952
1954 PROGRESS_REPORTER* aProgressReporter, bool aCleanupDone )
1955{
1956 wxString highlightedConn = GetHighlightedConnection();
1957 bool hasHighlightedConn = !highlightedConn.IsEmpty();
1958 bool itemsChanged = false;
1959
1960 std::function<void( SCH_ITEM* )> changeHandler =
1961 [&]( SCH_ITEM* aChangedItem ) -> void
1962 {
1963 itemsChanged = true;
1964 GetCanvas()->GetView()->Update( aChangedItem, KIGFX::REPAINT );
1965
1966 if( ADVANCED_CFG::GetCfg().m_ConnectivityEngine )
1967 return;
1968
1969 SCH_CONNECTION* connection = aChangedItem->Connection();
1970
1972 return;
1973
1974 if( !hasHighlightedConn )
1975 {
1976 // No highlighted connection, but connectivity has changed, so refresh
1977 // the list of all nets
1979 }
1980 else if( connection && ( connection->Name() == highlightedConn
1981 || connection->HasDriverChanged() ) )
1982 {
1984 }
1985 };
1986
1987 try
1988 {
1989 Schematic().RecalculateConnections( aCommit, aCleanupFlags,
1991 aProgressReporter,
1992 GetCanvas()->GetView(),
1993 &changeHandler,
1994 m_undoList.m_CommandsList.empty() ? nullptr
1995 : m_undoList.m_CommandsList.back(),
1996 aCleanupDone );
1997 }
1998 catch( const std::exception& error )
1999 {
2000 if( !ADVANCED_CFG::GetCfg().m_ConnectivityEngine )
2001 throw;
2002
2003 // The engine clears its publication before rethrowing; an edit must not unwind the tool
2004 wxLogTrace( wxS( "KICAD_CONNECTIVITY" ), wxS( "Connectivity recalculation failed: %s" ),
2005 wxString::FromUTF8( error.what() ) );
2006 ShowInfoBarError( _( "Unable to rebuild schematic connectivity." ), true );
2007 RefreshConnectivity( true );
2008 return false;
2009 }
2010
2011 // Dangling repairs notify even without a graph delta; text-only changes still need a refresh
2012 if( !ADVANCED_CFG::GetCfg().m_ConnectivityEngine
2013 || ( !itemsChanged && Schematic().Connectivity().Published().Changes().Empty() ) )
2014 {
2016 }
2017
2018 return true;
2019}
2020
2021
2023{
2024 SCH_COMMIT cleanup( m_toolManager );
2026 cleanup.Push( _( "Schematic Cleanup" ), SKIP_CONNECTIVITY );
2027}
2028
2029
2031{
2033 [this]( const SCH_CONNECTIVITY::CHANGE_SET& changes )
2034 {
2035 if( ADVANCED_CFG::GetCfg().m_ConnectivityEngine && Schematic().HasHierarchy() && GetScreen() )
2036 {
2037 RefreshConnectivity( false, &changes );
2038 GetCanvas()->Refresh();
2039 }
2040 } );
2041}
2042
2043
2045{
2046 const wxString highlightedConn = GetHighlightedConnection();
2047 const bool useEngine = ADVANCED_CFG::GetCfg().m_ConnectivityEngine;
2048 std::set<KIID> repaintItems;
2049 const auto* changes = aChanges;
2050
2051 if( useEngine )
2052 {
2053 const auto& facade = Schematic().Connectivity();
2054
2055 if( !changes )
2056 changes = &facade.Published().Changes();
2057
2058 if( const auto instance = facade.Keys().FindInstance( GetCurrentSheet().PathRef() ) )
2059 {
2060 for( const auto* items : { &changes->changedItems, &changes->driverChangedItems } )
2061 {
2062 for( const auto& key : *items )
2063 {
2064 if( key.inst == *instance )
2065 repaintItems.insert( key.item );
2066 }
2067 }
2068 }
2069 }
2070
2072 [&]( KIGFX::VIEW_ITEM* aItem ) -> int
2073 {
2074 int flags = aForce ? KIGFX::REPAINT : 0;
2075 SCH_ITEM* item = dynamic_cast<SCH_ITEM*>( aItem );
2076 SCH_CONNECTION* connection = item && !useEngine ? item->Connection() : nullptr;
2077
2078 auto invalidateTextVars =
2079 [&flags]( EDA_TEXT* text )
2080 {
2081 if( text->HasTextVars() )
2082 {
2083 text->ClearRenderCache();
2084 text->ClearBoundingBoxCache();
2086 }
2087 };
2088
2089 if( connection && connection->HasDriverChanged() )
2090 {
2091 connection->ClearDriverChanged();
2092 flags |= KIGFX::REPAINT;
2093 }
2094
2095 if( item && repaintItems.contains( item->m_Uuid ) )
2096 flags |= KIGFX::REPAINT;
2097
2098 if( item )
2099 {
2100 item->RunOnChildren(
2101 [&invalidateTextVars]( SCH_ITEM* aChild )
2102 {
2103 if( EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( aChild ) )
2104 invalidateTextVars( text );
2105 },
2107
2108 if( flags & KIGFX::GEOMETRY )
2109 GetScreen()->UpdateDisplayBounds( item );
2110 }
2111
2112 if( EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( aItem ) )
2113 invalidateTextVars( text );
2114
2115 return flags;
2116 } );
2117
2118 const bool changed = useEngine && !changes->Empty();
2119 // Legacy never finds an empty name, so it refreshes the all-nets navigator on every pass
2120 const bool exists = useEngine ? highlightedConn.IsEmpty()
2121 || Schematic().Connectivity().NetByName( highlightedConn ).has_value()
2122 : Schematic().ConnectionGraph()->FindFirstSubgraphByName( highlightedConn )
2123 != nullptr;
2124
2125 if( aForce || changed || m_highlightedConnChanged || !exists )
2126 {
2128
2129 if( useEngine && !aForce && !m_highlightedConnChanged && exists )
2130 {
2131 const auto& facade = Schematic().Connectivity();
2132 std::vector<wxString> names;
2133
2134 for( auto name : changes->netsChanged )
2135 names.push_back( facade.Keys().Name( name ) );
2136
2137 RefreshNetNavigator( nullptr, &names );
2138 }
2139 else
2140 {
2142 }
2143
2145 }
2146}
2147
2148
2153
2154
2156{
2157 GetCanvas()->GetView()->Update( aItem );
2158}
2159
2160
2167
2168
2169std::unique_ptr<GRID_HELPER> SCH_EDIT_FRAME::MakeGridHelper()
2170{
2171 return std::make_unique<EE_GRID_HELPER>( m_toolManager );
2172}
2173
2174
2176{
2178
2179 SCHEMATIC_SETTINGS& settings = Schematic().Settings();
2180
2182
2183 if( EESCHEMA_SETTINGS* cfg = GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" ) )
2184 {
2185 GetGalDisplayOptions().ReadWindowSettings( cfg->m_Window );
2186 GetRenderSettings()->SetDefaultFont( cfg->m_Appearance.default_font );
2187
2188 KIGFX::VIEW* view = GetCanvas()->GetView();
2189 view->SetLayerVisible( LAYER_ERC_ERR, cfg->m_Appearance.show_erc_errors );
2190 view->SetLayerVisible( LAYER_ERC_WARN, cfg->m_Appearance.show_erc_warnings );
2191 view->SetLayerVisible( LAYER_ERC_EXCLUSION, cfg->m_Appearance.show_erc_exclusions );
2192 view->SetLayerVisible( LAYER_OP_VOLTAGES, cfg->m_Appearance.show_op_voltages );
2193 view->SetLayerVisible( LAYER_OP_CURRENTS, cfg->m_Appearance.show_op_currents );
2194
2195 GetRenderSettings()->m_ShowPinAltIcons = cfg->m_Appearance.show_pin_alt_icons;
2196 GetRenderSettings()->m_ShowRemappedPinNumbers = cfg->m_Appearance.show_remapped_pin_numbers;
2197
2199
2200 }
2201
2203
2204 for( SCH_ITEM* item : screen->Items() )
2205 {
2206 item->ClearCaches();
2207
2208 if( item->Type() == SCH_LINE_T )
2209 {
2210 SCH_LINE* line = static_cast<SCH_LINE*>( item );
2211
2212 if( line->IsWire() || line->IsBus() )
2213 UpdateHopOveredWires( line );
2214 }
2215 }
2216
2217 for( const auto& [ libItemName, libSymbol ] : screen->GetLibSymbols() )
2218 libSymbol->ClearCaches();
2219
2221
2223 Layout();
2224 SendSizeEvent();
2225}
2226
2227
2229{
2230 // Store the current zoom level into the current screen before calling
2231 // DisplayCurrentSheet() that set the zoom to GetScreen()->m_LastZoomLevel
2233
2234 // Rebuild the sheet view (draw area and any other items):
2236}
2237
2238
2240{
2241 // call my base class
2243
2244 // tooltips in toolbars
2246
2247 // For some obscure reason, the AUI manager hides the first modified pane.
2248 // So force show panes
2249 wxAuiPaneInfo& design_blocks_pane_info = m_auimgr.GetPane( m_designBlocksPane );
2250 bool panel_shown = design_blocks_pane_info.IsShown();
2251 design_blocks_pane_info.Caption( _( "Design Blocks" ) );
2252 design_blocks_pane_info.Show( panel_shown );
2253
2254 m_auimgr.GetPane( m_hierarchy ).Caption( _( "Schematic Hierarchy" ) );
2255 m_auimgr.GetPane( m_selectionFilterPanel ).Caption( _( "Selection Filter" ) );
2256 m_auimgr.GetPane( m_propertiesPanel ).Caption( _( "Properties" ) );
2257 m_auimgr.GetPane( m_designBlocksPane ).Caption( _( "Design Blocks" ) );
2258 m_auimgr.GetPane( RemoteSymbolPaneName() ).Caption( _( "Remote Symbols" ) );
2259 m_auimgr.Update();
2260 m_hierarchy->UpdateHierarchyTree();
2261
2262 // status bar
2264
2265 updateTitle();
2266
2267 // This ugly hack is to fix an option(left) toolbar update bug that seems to only affect
2268 // windows. See https://bugs.launchpad.net/kicad/+bug/1816492. For some reason, calling
2269 // wxWindow::Refresh() does not resolve the issue. Only a resize event seems to force the
2270 // toolbar to update correctly.
2271#if defined( __WXMSW__ )
2272 PostSizeEvent();
2273#endif
2274}
2275
2276
2278{
2279 if( !GetHighlightedNetChain().IsEmpty() )
2280 {
2281 if( SCH_NETCHAIN* sig = m_schematic->NetChains().GetNetChainByName( GetHighlightedNetChain() ) )
2282 {
2283 wxString nets;
2284
2285 for( const wxString& n : sig->GetNets() )
2286 {
2287 if( !nets.IsEmpty() )
2288 nets += wxT( ", " );
2289
2290 nets += n;
2291 }
2292
2293 SetStatusText( wxString::Format( _( "Net chain members: %s" ), nets ) );
2294 return;
2295 }
2296 }
2297
2298 if( !GetHighlightedConnection().IsEmpty() )
2299 {
2300 SetStatusText( wxString::Format( _( "Highlighted net: %s" ),
2302 }
2303 else
2304 {
2305 SetStatusText( wxT( "" ) );
2306 }
2307}
2308
2309
2311{
2312 if( m_toolManager )
2314
2315 SCH_BASE_FRAME::SetScreen( aScreen );
2316
2317 // SetSheetNumberAndCount() dereferences the current sheet's screen, which is absent on the
2318 // unload paths that pass a null screen.
2319 if( aScreen )
2321
2322 GetCanvas()->DisplaySheet( static_cast<SCH_SCREEN*>( aScreen ) );
2323
2324 if( m_toolManager )
2326}
2327
2328
2329const BOX2I SCH_EDIT_FRAME::GetDocumentExtents( bool aIncludeAllVisible ) const
2330{
2331 BOX2I bBoxDoc;
2332
2333 if( !GetScreen() )
2334 return bBoxDoc;
2335
2336 if( aIncludeAllVisible )
2337 {
2338 // Get the whole page size and return that
2339 int sizeX = GetScreen()->GetPageSettings().GetWidthIU( schIUScale.IU_PER_MILS );
2340 int sizeY = GetScreen()->GetPageSettings().GetHeightIU( schIUScale.IU_PER_MILS );
2341 bBoxDoc = BOX2I( VECTOR2I( 0, 0 ), VECTOR2I( sizeX, sizeY ) );
2342 }
2343 else
2344 {
2345 // Get current drawing-sheet in a form we can compare to an EDA_ITEM
2347 EDA_ITEM* dsAsItem = static_cast<EDA_ITEM*>( ds );
2348
2349 // Calc the bounding box of all items on screen except the page border
2350 for( EDA_ITEM* item : GetScreen()->Items() )
2351 {
2352 if( item != dsAsItem ) // Ignore the drawing-sheet itself
2353 bBoxDoc.Merge( item->GetBoundingBox() );
2354 }
2355 }
2356
2357 return bBoxDoc;
2358}
2359
2360
2362{
2363 return Schematic().IsHierarchyModified();
2364}
2365
2366
2368{
2369 EESCHEMA_SETTINGS* cfg = eeconfig();
2370 return cfg && cfg->m_Appearance.show_hidden_pins;
2371}
2372
2373
2374void SCH_EDIT_FRAME::FocusOnItem( EDA_ITEM* aItem, bool aAllowScroll )
2375{
2376 // nullptr will clear the current focus
2377 if( aItem != nullptr && !aItem->IsSCH_ITEM() )
2378 return;
2379
2380 static KIID lastBrightenedItemID( niluuid );
2381
2382 SCH_ITEM* lastItem = Schematic().ResolveItem( lastBrightenedItemID, nullptr, true );
2383
2384 if( lastItem && lastItem != aItem )
2385 {
2386 lastItem->ClearBrightened();
2387
2388 UpdateItem( lastItem );
2389 lastBrightenedItemID = niluuid;
2390
2391 // Focusing a new item repaints as it moves the view, but clearing alone has to ask
2392 if( !aItem )
2393 GetCanvas()->Refresh();
2394 }
2395
2396 if( aItem )
2397 {
2398 if( !aItem->IsBrightened() )
2399 {
2400 aItem->SetBrightened();
2401
2402 UpdateItem( aItem );
2403 lastBrightenedItemID = aItem->m_Uuid;
2404 }
2405
2406 FocusOnLocation( aItem->GetFocusPosition(), aAllowScroll );
2407 }
2408}
2409
2410
2412{
2413 return Schematic().GetFileName();
2414}
2415
2416
2418{
2419 return m_toolManager->GetTool<SCH_SELECTION_TOOL>()->GetSelection();
2420}
2421
2423 const KIID& aSchematicSymbolUUID )
2424{
2425 SCH_SHEET_PATH principalPath;
2426 SCH_SHEET_LIST sheets = Schematic().Hierarchy();
2427 SCH_ITEM* item = sheets.ResolveItem( aSchematicSymbolUUID, &principalPath, true );
2428 SCH_SYMBOL* principalSymbol = dynamic_cast<SCH_SYMBOL*>( item );
2429 SCH_COMMIT commit( m_toolManager );
2430
2431 if( !principalSymbol )
2432 return false;
2433
2434 wxString principalRef;
2435
2436 if( principalSymbol->IsAnnotated( &principalPath ) )
2437 principalRef = principalSymbol->GetRef( &principalPath, false );
2438
2439 std::vector< std::pair<SCH_SYMBOL*, SCH_SHEET_PATH> > allUnits;
2440
2441 for( const SCH_SHEET_PATH& path : sheets )
2442 {
2443 for( SCH_ITEM* candidate : path.LastScreen()->Items().OfType( SCH_SYMBOL_T ) )
2444 {
2445 SCH_SYMBOL* candidateSymbol = static_cast<SCH_SYMBOL*>( candidate );
2446
2447 if( candidateSymbol == principalSymbol
2448 || ( candidateSymbol->IsAnnotated( &path )
2449 && candidateSymbol->GetRef( &path, false ) == principalRef ) )
2450 {
2451 allUnits.emplace_back( candidateSymbol, path );
2452 }
2453 }
2454 }
2455
2456 for( auto& [ unit, path ] : allUnits )
2457 {
2458 // This needs to be done before the LIB_SYMBOL is changed to prevent stale
2459 // library symbols in the schematic file.
2460 path.LastScreen()->Remove( unit );
2461
2462 if( !unit->IsNew() )
2463 commit.Modify( unit, path.LastScreen() );
2464
2465 unit->SetLibSymbol( aSymbol.Flatten().release() );
2466 unit->UpdateFields( &GetCurrentSheet(),
2467 true, /* update style */
2468 true, /* update ref */
2469 true, /* update other fields */
2470 false, /* reset ref */
2471 false /* reset other fields */ );
2472
2473 path.LastScreen()->Append( unit );
2474 GetCanvas()->GetView()->Update( unit );
2475 }
2476
2477 // Clear any orphaned alternate pins.
2478 for( SCH_PIN* pin : principalSymbol->GetGraphicalPins( ALL_UNITS, ALL_BODY_STYLES ) )
2479 {
2480 wxString altName = pin->GetAlt();
2481
2482 if( altName.IsEmpty() )
2483 continue;
2484
2485 if( pin->GetAlternates().count( altName ) == 0 )
2486 pin->SetAlt( wxEmptyString );
2487 }
2488
2489 if( !commit.Empty() )
2490 commit.Push( _( "Save Symbol to Schematic" ) );
2491
2492 return true;
2493}
2494
2495
2496void SCH_EDIT_FRAME::UpdateItem( EDA_ITEM* aItem, bool isAddOrDelete, bool aUpdateRtree )
2497{
2498 SCH_BASE_FRAME::UpdateItem( aItem, isAddOrDelete, aUpdateRtree );
2499
2500 if( SCH_ITEM* sch_item = dynamic_cast<SCH_ITEM*>( aItem ) )
2501 sch_item->ClearCaches();
2502}
2503
2504
2506{
2507 wxCHECK( m_toolManager, /* void */ );
2508
2512
2513 wxCHECK( screen, /* void */ );
2514
2516
2517 SCH_BASE_FRAME::SetScreen( screen );
2518
2519 SetSheetNumberAndCount(); // will also update CurrentScreen()'s sheet number info
2520
2522
2523 // update the references, units, and intersheet-refs
2525
2526 // dangling state can also have changed if different units with different pin locations are
2527 // used
2530
2531 SCH_SELECTION_TOOL* selectionTool = m_toolManager->GetTool<SCH_SELECTION_TOOL>();
2532
2533 wxCHECK( selectionTool, /* void */ );
2534
2535 auto visit =
2536 [&]( EDA_ITEM* item )
2537 {
2539 && !m_findReplaceData->findString.IsEmpty()
2540 && item->Matches( *m_findReplaceData, &GetCurrentSheet() ) )
2541 {
2542 item->SetForceVisible( true );
2543 selectionTool->BrightenItem( item );
2544 }
2545 else if( item->IsBrightened() )
2546 {
2547 item->SetForceVisible( false );
2548 selectionTool->UnbrightenItem( item );
2549 }
2550 };
2551
2552 for( SCH_ITEM* item : screen->Items() )
2553 {
2554 visit( item );
2555
2556 item->RunOnChildren(
2557 [&]( SCH_ITEM* aChild )
2558 {
2559 visit( aChild );
2560 },
2562 }
2563
2564 if( !screen->m_zoomInitialized )
2565 {
2567 }
2568 else
2569 {
2570 // Set zoom to last used in this screen
2571 GetCanvas()->GetView()->SetScale( GetScreen()->m_LastZoomLevel );
2572 GetCanvas()->GetView()->SetCenter( GetScreen()->m_ScrollCenter );
2573 }
2574
2575 updateTitle();
2576
2577 HardRedraw(); // Ensure all items are redrawn (especially the drawing-sheet items)
2578
2579 // Allow tools to re-add their VIEW_ITEMs after the last call to Clear in HardRedraw
2581
2582 SCH_EDITOR_CONTROL* editTool = m_toolManager->GetTool<SCH_EDITOR_CONTROL>();
2583
2584 wxCHECK( editTool, /* void */ );
2585
2587 editTool->UpdateNetHighlighting( dummy );
2588
2589 m_hierarchy->UpdateHierarchySelection();
2590
2591 m_schematic->OnSchSheetChanged();
2592
2593 std::string sheetPath = TO_UTF8( GetCurrentSheet().PathAsString() );
2595}
2596
2597
2599{
2600 if( !m_diffSymbolDialog )
2601 {
2603 _( "Compare Symbol with Library" ) );
2604
2605 m_diffSymbolDialog->m_sdbSizerApply->SetLabel( _( "Update Symbol from Library..." ) );
2606 m_diffSymbolDialog->m_sdbSizerApply->PostSizeEventToParent();
2607 m_diffSymbolDialog->m_sdbSizerApply->Show();
2608 }
2609
2610 return m_diffSymbolDialog;
2611}
2612
2613
2614void SCH_EDIT_FRAME::onCloseSymbolDiffDialog( wxCommandEvent& aEvent )
2615{
2616 if( m_diffSymbolDialog && aEvent.GetString() == DIFF_SYMBOLS_DIALOG_NAME )
2617 {
2618 if( aEvent.GetId() == wxID_APPLY )
2619 {
2620 KIID symbolUUID = m_diffSymbolDialog->GetUserItemID();
2621
2622 CallAfter(
2623 [this, symbolUUID]()
2624 {
2625 EDA_ITEM* item = ResolveItem( symbolUUID );
2626
2627 if( SCH_SYMBOL* symbol = dynamic_cast<SCH_SYMBOL*>( item ) )
2628 {
2629 m_toolManager->RunAction<EDA_ITEM*>( ACTIONS::selectItem, symbol );
2630
2632 dlg.ShowQuasiModal();
2633 }
2634 } );
2635 }
2636
2637 m_diffSymbolDialog->Destroy();
2638 m_diffSymbolDialog = nullptr;
2639 }
2640}
2641
2642
2644{
2645 if( !m_ercDialog )
2646 m_ercDialog = new DIALOG_ERC( this );
2647
2648 return m_ercDialog;
2649}
2650
2651
2653{
2655
2656 if( m_ercDialog )
2657 {
2658 m_ercDialog->DeleteAllMarkers( true );
2659 }
2660 else
2661 {
2663 SCH_SCREENS screens( Schematic().Root() );
2665 }
2666}
2667
2668
2670{
2671 if( m_ercDialog )
2672 m_ercDialog->UpdateData();
2673
2674 for( SCH_ITEM* marker : GetScreen()->Items().OfType( SCH_MARKER_T ) )
2675 {
2676 GetCanvas()->GetView()->Remove( marker );
2677 GetCanvas()->GetView()->Add( marker );
2678 }
2679
2680 GetCanvas()->Refresh();
2681}
2682
2683
2684void SCH_EDIT_FRAME::onCloseErcDialog( wxCommandEvent& aEvent )
2685{
2686 if( m_ercDialog )
2687 {
2688 m_ercDialog->Destroy();
2689 m_ercDialog = nullptr;
2690 }
2691}
2692
2693
2695{
2697 {
2698 auto* dlg = new DIALOG_SYMBOL_FIELDS_TABLE( this );
2699
2700 if( dlg->WasAborted() )
2701 {
2702 dlg->Destroy();
2703 return nullptr;
2704 }
2705
2707 }
2708
2710}
2711
2712
2714{
2715 return m_netNavigator;
2716}
2717
2718
2720{
2722 {
2723 m_symbolFieldsTableDialog->Destroy();
2724 m_symbolFieldsTableDialog = nullptr;
2725 }
2726}
2727
2728
2729void SCH_EDIT_FRAME::AddSchematicChangeListener( wxEvtHandler* aListener )
2730{
2731 auto it = std::find( m_schematicChangeListeners.begin(), m_schematicChangeListeners.end(), aListener );
2732
2733 // Don't add duplicate listeners.
2734 if( it == m_schematicChangeListeners.end() )
2735 m_schematicChangeListeners.push_back( aListener );
2736}
2737
2738
2740{
2741 auto it = std::find( m_schematicChangeListeners.begin(), m_schematicChangeListeners.end(), aListener );
2742
2743 // Don't add duplicate listeners.
2744 if( it != m_schematicChangeListeners.end() )
2745 m_schematicChangeListeners.erase( it );
2746}
2747
2748
2750{
2751 wxPanel* panel = new wxPanel( this );
2752
2753 wxBoxSizer* sizer = new wxBoxSizer( wxVERTICAL );
2754
2755 // Create horizontal sizer for search control and gear button
2756 wxBoxSizer* searchSizer = new wxBoxSizer( wxHORIZONTAL );
2757
2758 m_netNavigatorFilter = new wxSearchCtrl( panel, wxID_ANY );
2759 m_netNavigatorFilter->SetDescriptiveText( _( "Filter nets" ) );
2760 m_netNavigatorFilter->ShowCancelButton( false );
2761 searchSizer->Add( m_netNavigatorFilter, 1, wxEXPAND | wxRIGHT, FromDIP( 2 ) );
2762
2763 m_netNavigatorMenuButton = new BITMAP_BUTTON( panel, wxID_ANY );
2765 m_netNavigatorMenuButton->SetPadding( 2 );
2766 searchSizer->Add( m_netNavigatorMenuButton, 0, wxALIGN_CENTER_VERTICAL );
2767
2768 sizer->Add( searchSizer, 0, wxEXPAND | wxALL, FromDIP( 2 ) );
2769
2770 m_netNavigator = new NET_NAVIGATOR_TREE( panel, wxID_ANY, wxPoint( 0, 0 ), FromDIP( wxSize( 160, 250 ) ),
2771 wxTR_DEFAULT_STYLE | wxNO_BORDER );
2772 sizer->Add( m_netNavigator, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, FromDIP( 2 ) );
2773
2774 panel->SetSizer( sizer );
2775
2776 panel->Bind( wxEVT_SHOW,
2777 [this]( wxShowEvent& event )
2778 {
2779 event.Skip();
2780
2781 if( event.IsShown() )
2782 {
2783 CallAfter(
2784 [this]
2785 {
2788 } );
2789 }
2790 } );
2791
2792 m_netNavigator->Bind( wxEVT_DPI_CHANGED, &SCH_EDIT_FRAME::onNetNavigatorDPIChanged, this );
2793 m_netNavigatorFilter->Bind( wxEVT_COMMAND_TEXT_UPDATED, &SCH_EDIT_FRAME::onNetNavigatorFilterChanged, this );
2794 m_netNavigatorFilter->Bind( wxEVT_KEY_DOWN, &SCH_EDIT_FRAME::onNetNavigatorKey, this );
2795 m_netNavigator->Bind( wxEVT_KEY_DOWN, &SCH_EDIT_FRAME::onNetNavigatorKey, this );
2796 m_netNavigator->Bind( wxEVT_TREE_ITEM_MENU, &SCH_EDIT_FRAME::onNetNavigatorItemMenu, this );
2797 m_netNavigator->Bind( wxEVT_CONTEXT_MENU, &SCH_EDIT_FRAME::onNetNavigatorContextMenu, this );
2798
2799 m_netNavigatorMenuButton->Bind( wxEVT_LEFT_DOWN,
2800 [this]( wxMouseEvent& event )
2801 {
2802 wxMenu menu;
2803 wxMenuItem* wildcardItem = menu.AppendRadioItem( ID_NET_NAVIGATOR_SEARCH_WILDCARD,
2804 _( "Wildcard Search" ) );
2805 wxMenuItem* regexItem = menu.AppendRadioItem( ID_NET_NAVIGATOR_SEARCH_REGEX,
2806 _( "Regex Search" ) );
2807
2808 EESCHEMA_SETTINGS* cfg = eeconfig();
2809
2811 wildcardItem->Check();
2812 else
2813 regexItem->Check();
2814
2815 PopupMenu( &menu );
2816 } );
2817
2823
2824 return panel;
2825}
2826
2827
2828void SCH_EDIT_FRAME::SetHighlightedConnection( const wxString& aConnection, const NET_NAVIGATOR_ITEM_DATA* aSelection,
2829 bool aForceNetNavigatorRefresh )
2830{
2831 bool connectionChanged = aConnection != m_highlightedConn;
2832
2833 m_highlightedConn = aConnection;
2834
2835 if( connectionChanged || aForceNetNavigatorRefresh )
2836 RefreshNetNavigator( aSelection );
2837
2838 if( connectionChanged && m_hierarchy )
2839 m_hierarchy->UpdateNetHighlight( aConnection );
2840}
2841
2842
2844{
2846
2847 if( m_netNavigator )
2848 {
2849 NET_NAVIGATOR_ITEM_DATA itemData;
2850 wxTreeItemId selection = m_netNavigator->GetSelection();
2851 bool refreshSelection = selection.IsOk() && selection != m_netNavigator->GetRootItem();
2852
2853 if( refreshSelection )
2854 {
2856 dynamic_cast<NET_NAVIGATOR_ITEM_DATA*>( m_netNavigator->GetItemData( selection ) );
2857
2858 wxCHECK( tmp, /* void */ );
2859 itemData = *tmp;
2860 }
2861
2862 m_netNavigator->DeleteAllItems();
2863 RefreshNetNavigator( refreshSelection ? &itemData : nullptr );
2864 }
2865}
2866
2867
2869{
2870 if( !m_netNavigator )
2871 return;
2872
2873 wxString newFilter = m_netNavigatorFilter ? m_netNavigatorFilter->GetValue() : wxString();
2874
2875 if( newFilter == m_netNavigatorFilterValue )
2876 return;
2877
2878 m_netNavigatorFilterValue = newFilter;
2879
2880 NET_NAVIGATOR_ITEM_DATA selectionData;
2881 NET_NAVIGATOR_ITEM_DATA* selectionPtr = nullptr;
2882
2883 wxTreeItemId selection = m_netNavigator->GetSelection();
2884
2885 if( selection.IsOk() )
2886 {
2887 if( NET_NAVIGATOR_ITEM_DATA* tmp =
2888 dynamic_cast<NET_NAVIGATOR_ITEM_DATA*>( m_netNavigator->GetItemData( selection ) ) )
2889 {
2890 selectionData = *tmp;
2891 selectionPtr = &selectionData;
2892 }
2893 }
2894
2895 RefreshNetNavigator( selectionPtr );
2896
2897 aEvent.Skip();
2898}
2899
2900
2901void SCH_EDIT_FRAME::onNetNavigatorKey( wxKeyEvent& aEvent )
2902{
2903 if( aEvent.GetKeyCode() == WXK_ESCAPE )
2904 {
2905 // Clear the search string and refresh
2907 m_netNavigatorFilter->SetValue( wxEmptyString );
2908
2909 m_netNavigatorFilterValue = wxEmptyString;
2910
2912
2913 // Don't skip the event - we handled it
2914 return;
2915 }
2916
2917 aEvent.Skip();
2918}
2919
2920
2921
2923{
2924 showNetNavigatorMenu( aEvent.GetItem() );
2925}
2926
2927
2928void SCH_EDIT_FRAME::onNetNavigatorContextMenu( wxContextMenuEvent& aEvent )
2929{
2930 if( !m_netNavigator )
2931 return;
2932
2933 wxPoint screenPos = aEvent.GetPosition();
2934
2935 if( screenPos == wxDefaultPosition )
2936 screenPos = wxGetMousePosition();
2937
2938 wxPoint clientPos = m_netNavigator->ScreenToClient( screenPos );
2939 int flags = 0;
2940 wxTreeItemId item = m_netNavigator->HitTest( clientPos, flags );
2941
2942 showNetNavigatorMenu( item );
2943}
2944
2945
2946void SCH_EDIT_FRAME::showNetNavigatorMenu( const wxTreeItemId& aItem )
2947{
2948 if( !m_netNavigator )
2949 return;
2950
2951 wxMenu menu;
2952
2953 menu.Append( ID_NET_NAVIGATOR_EXPAND_ALL, _( "Expand All" ) );
2954 menu.Append( ID_NET_NAVIGATOR_COLLAPSE_ALL, _( "Collapse All" ) );
2955
2956 wxMenuItem* findInInspector = new wxMenuItem( &menu, ID_NET_NAVIGATOR_FIND_IN_INSPECTOR,
2957 _( "Find in Net Inspector" ) );
2958 menu.Append( findInInspector );
2959
2960 wxString netName;
2961
2962 if( aItem.IsOk() )
2963 {
2964 wxTreeItemId netItem = aItem;
2965
2966 if( m_netNavigator->GetItemParent( netItem ) != m_netNavigator->GetRootItem() )
2967 {
2968 wxTreeItemId parent = m_netNavigator->GetItemParent( netItem );
2969
2970 while( parent.IsOk() && parent != m_netNavigator->GetRootItem() )
2971 {
2972 netItem = parent;
2973 parent = m_netNavigator->GetItemParent( netItem );
2974 }
2975
2976 if( parent == m_netNavigator->GetRootItem() )
2977 {
2978 if( wxStringClientData* data =
2979 dynamic_cast<wxStringClientData*>( m_netNavigator->GetItemData( netItem ) ) )
2980 {
2981 netName = data->GetData();
2982 }
2983 }
2984 }
2985 else if( m_netNavigator->GetItemParent( netItem ) == m_netNavigator->GetRootItem() )
2986 {
2987 if( wxStringClientData* data =
2988 dynamic_cast<wxStringClientData*>( m_netNavigator->GetItemData( netItem ) ) )
2989 {
2990 netName = data->GetData();
2991 }
2992 }
2993 else if( !m_highlightedConn.IsEmpty() && netItem == m_netNavigator->GetRootItem() )
2994 {
2995 netName = m_highlightedConn;
2996 }
2997 }
2998 else if( !m_highlightedConn.IsEmpty() && m_netNavigator->GetRootItem().IsOk() )
2999 {
3000 netName = m_highlightedConn;
3001 }
3002
3003 if( netName.IsEmpty() )
3004 {
3005 findInInspector->Enable( false );
3007 }
3008 else
3009 {
3010 m_netNavigatorMenuNetName = netName;
3011 }
3012
3013 PopupMenu( &menu );
3014}
3015
3016
3017void SCH_EDIT_FRAME::onNetNavigatorMenuCommand( wxCommandEvent& aEvent )
3018{
3019 if( !m_netNavigator )
3020 return;
3021
3022 switch( aEvent.GetId() )
3023 {
3025 m_netNavigator->ExpandAll();
3026 break;
3027
3029 m_netNavigator->CollapseAll();
3030
3031 if( m_netNavigator->GetRootItem().IsOk() )
3032 m_netNavigator->Expand( m_netNavigator->GetRootItem() );
3033 break;
3034
3036 if( !m_netNavigatorMenuNetName.IsEmpty() )
3038 break;
3039
3042 if( EESCHEMA_SETTINGS* cfg = eeconfig() )
3043 {
3044 cfg->m_AuiPanels.net_nav_search_mode_wildcard = ( aEvent.GetId() == ID_NET_NAVIGATOR_SEARCH_WILDCARD );
3045
3046 // Refresh the navigator with current filter
3048 }
3049
3050 break;
3051
3052 default:
3053 aEvent.Skip();
3054 return;
3055 }
3056
3058
3059 aEvent.Skip( false );
3060}
3061
3062
3064{
3065 wxAuiPaneInfo& hierarchyPane = m_auimgr.GetPane( SchematicHierarchyPaneName() );
3066 wxAuiPaneInfo& netNavigatorPane = m_auimgr.GetPane( NetNavigatorPaneName() );
3067 wxAuiPaneInfo& propertiesPane = m_auimgr.GetPane( PropertiesPaneName() );
3068 wxAuiPaneInfo& selectionFilterPane = m_auimgr.GetPane( wxS( "SelectionFilter" ) );
3069
3070 // Don't give the selection filter its own visibility controls; instead show it if
3071 // anything else is visible
3072 bool showFilter = ( hierarchyPane.IsShown() && hierarchyPane.IsDocked() )
3073 || ( netNavigatorPane.IsShown() && netNavigatorPane.IsDocked() )
3074 || ( propertiesPane.IsShown() && propertiesPane.IsDocked() );
3075
3076 selectionFilterPane.Show( showFilter );
3077}
3078
3079
3081{
3082 wxLogTrace( traceApi, "SCH frame: EDA_EVT_PLUGIN_AVAILABILITY_CHANGED" );
3085 aEvt.Skip();
3086}
3087
3088
3090{
3091 EESCHEMA_SETTINGS* cfg = eeconfig();
3092
3093 // Ensure m_show_search is up to date (the pane can be closed outside the menu)
3094 m_show_search = m_auimgr.GetPane( SearchPaneName() ).IsShown();
3095
3097
3098 wxAuiPaneInfo& searchPaneInfo = m_auimgr.GetPane( SearchPaneName() );
3099 searchPaneInfo.Show( m_show_search );
3100
3101 if( m_show_search )
3102 {
3103 searchPaneInfo.Direction( cfg->m_AuiPanels.search_panel_dock_direction );
3104
3105 if( cfg->m_AuiPanels.search_panel_dock_direction == wxAUI_DOCK_TOP
3106 || cfg->m_AuiPanels.search_panel_dock_direction == wxAUI_DOCK_BOTTOM )
3107 {
3108 SetAuiPaneSize( m_auimgr, searchPaneInfo, -1, cfg->m_AuiPanels.search_panel_height );
3109 }
3110 else if( cfg->m_AuiPanels.search_panel_dock_direction == wxAUI_DOCK_LEFT
3111 || cfg->m_AuiPanels.search_panel_dock_direction == wxAUI_DOCK_RIGHT )
3112 {
3113 SetAuiPaneSize( m_auimgr, searchPaneInfo, cfg->m_AuiPanels.search_panel_width, -1 );
3114 }
3115
3116 m_searchPane->FocusSearch();
3117 m_searchPane->RefreshSearch();
3118 }
3119 else
3120 {
3121 cfg->m_AuiPanels.search_panel_height = m_searchPane->GetSize().y;
3122 cfg->m_AuiPanels.search_panel_width = m_searchPane->GetSize().x;
3123 cfg->m_AuiPanels.search_panel_dock_direction = searchPaneInfo.dock_direction;
3124 m_auimgr.Update();
3125 }
3126}
3127
3128
3130{
3131 if( !m_propertiesPanel )
3132 return;
3133
3134 bool show = !m_propertiesPanel->IsShownOnScreen();
3135
3136 wxAuiPaneInfo& propertiesPaneInfo = m_auimgr.GetPane( PropertiesPaneName() );
3137 propertiesPaneInfo.Show( show );
3138
3140
3141 EESCHEMA_SETTINGS* settings = eeconfig();
3142
3143 if( show )
3144 {
3145 SetAuiPaneSize( m_auimgr, propertiesPaneInfo, settings->m_AuiPanels.properties_panel_width, -1 );
3146 }
3147 else
3148 {
3149 settings->m_AuiPanels.properties_panel_width = m_propertiesPanel->GetSize().x;
3150 m_auimgr.Update();
3151 }
3152}
3153
3154
3156{
3157 EESCHEMA_SETTINGS* cfg = eeconfig();
3158
3159 wxCHECK( cfg, /* void */ );
3160
3161 wxAuiPaneInfo& hierarchy_pane = m_auimgr.GetPane( SchematicHierarchyPaneName() );
3162
3163 hierarchy_pane.Show( !hierarchy_pane.IsShown() );
3164
3166
3167 if( hierarchy_pane.IsShown() )
3168 {
3169 if( hierarchy_pane.IsFloating() )
3170 {
3171 hierarchy_pane.FloatingSize( cfg->m_AuiPanels.hierarchy_panel_float_width,
3173 m_auimgr.Update();
3174 }
3175 else if( cfg->m_AuiPanels.hierarchy_panel_docked_width > 0 )
3176 {
3177 // SetAuiPaneSize also updates m_auimgr
3179 }
3180 }
3181 else
3182 {
3183 if( hierarchy_pane.IsFloating() )
3184 {
3185 cfg->m_AuiPanels.hierarchy_panel_float_width = hierarchy_pane.floating_size.x;
3186 cfg->m_AuiPanels.hierarchy_panel_float_height = hierarchy_pane.floating_size.y;
3187 }
3188 else
3189 {
3191 }
3192
3193 m_auimgr.Update();
3194 }
3195}
3196
3197
3199{
3200 EESCHEMA_SETTINGS* cfg = eeconfig();
3201
3202 wxCHECK( cfg, /* void */ );
3203
3204 wxAuiPaneInfo& db_library_pane = m_auimgr.GetPane( DesignBlocksPaneName() );
3205
3206 db_library_pane.Show( !db_library_pane.IsShown() );
3207
3208 if( db_library_pane.IsShown() )
3209 {
3210 if( db_library_pane.IsFloating() )
3211 {
3212 db_library_pane.FloatingSize( cfg->m_AuiPanels.design_blocks_panel_float_width,
3214 m_auimgr.Update();
3215 }
3216 else
3217 {
3218 // SetAuiPaneSize also updates m_auimgr
3219 SetAuiPaneSize( m_auimgr, db_library_pane,
3221 }
3222 }
3223 else
3224 {
3225 if( db_library_pane.IsFloating() )
3226 {
3227 cfg->m_AuiPanels.design_blocks_panel_float_width = db_library_pane.floating_size.x;
3228 cfg->m_AuiPanels.design_blocks_panel_float_height = db_library_pane.floating_size.y;
3229 }
3230 else
3231 {
3233 }
3234
3235 m_auimgr.Update();
3236 }
3237}
3238
3239
3241{
3242 EESCHEMA_SETTINGS* cfg = eeconfig();
3243
3244 wxCHECK( cfg, /* void */ );
3245
3246 wxAuiPaneInfo& remotePane = m_auimgr.GetPane( RemoteSymbolPaneName() );
3247
3248 remotePane.Show( !remotePane.IsShown() );
3249
3250 if( remotePane.IsShown() )
3251 {
3252 if( m_remoteSymbolPane )
3253 m_remoteSymbolPane->Activate();
3254
3255 if( remotePane.IsFloating() )
3256 {
3257 remotePane.FloatingSize( cfg->m_AuiPanels.remote_symbol_panel_float_width,
3259 m_auimgr.Update();
3260 }
3262 {
3263 SetAuiPaneSize( m_auimgr, remotePane,
3265 }
3266 }
3267 else
3268 {
3269 if( remotePane.IsFloating() )
3270 {
3271 cfg->m_AuiPanels.remote_symbol_panel_float_width = remotePane.floating_size.x;
3272 cfg->m_AuiPanels.remote_symbol_panel_float_height = remotePane.floating_size.y;
3273 }
3274 else if( m_remoteSymbolPane )
3275 {
3277 }
3278
3279 m_auimgr.Update();
3280 }
3281}
3282
3283
3285{
3286 wxCHECK( aSchematic, /* void */ );
3288 m_netNavigatorStale = true;
3290
3291 if( m_netNavigator )
3292 m_netNavigator->DeleteAllItems();
3293
3294 if( m_schematic )
3295 {
3298 SetScreen( nullptr );
3299 m_schematic->SetProject( nullptr );
3300
3301 // Detach before the outgoing schematic (and its tracker) is freed.
3302 if( GetCanvas() && GetCanvas()->GetView() )
3304
3306 }
3307
3308 aSchematic->SetProject( &Prj() );
3309 delete m_schematic;
3310
3311 m_schematic = aSchematic;
3312 m_schematic->SetSchematicHolder( this );
3313
3314 KIGFX::SCH_VIEW* view = GetCanvas()->GetView();
3315 static_cast<KIGFX::SCH_PAINTER*>( view->GetPainter() )->SetSchematic( m_schematic );
3316 m_toolManager->SetEnvironment( m_schematic, GetCanvas()->GetView(), GetCanvas()->GetViewControls(), config(),
3317 this );
3320}
3321
3322
3324{
3326 return;
3327
3328 m_currentVariantCtrl->SetSelection( m_currentVariantCtrl->GetCount() - 1 );
3329
3330 wxCommandEvent dummy( wxEVT_CHOICE, ID_TOOLBAR_SCH_SELECT_VARAIANT );
3332}
3333
3334
3336{
3337 wxArrayString choices = Schematic().GetVariantNamesForUI();
3338
3339 // Default variant cannot be edited.
3340 choices.RemoveAt( 0 );
3341
3342 if( choices.IsEmpty() )
3343 {
3344 GetInfoBar()->ShowMessageFor( _( "No design variants to edit." ), 10000, wxICON_ERROR );
3345 return;
3346 }
3347
3348 wxSingleChoiceDialog chooser( this, _( "Select variant to edit description:" ) + wxS( " " ),
3349 _( "Edit Variant Description" ), choices );
3350 chooser.Layout();
3351
3352 if( chooser.ShowModal() == wxID_CANCEL )
3353 return;
3354
3355 wxString variantName = chooser.GetStringSelection();
3356
3357 if( variantName.IsEmpty() )
3358 return;
3359
3360 wxString currentDesc = Schematic().GetVariantDescription( variantName );
3361
3362 wxDialog dlg( this, wxID_ANY, wxString::Format( _( "Edit Description for '%s'" ), variantName ), wxDefaultPosition,
3363 wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER );
3364
3365 wxBoxSizer* mainSizer = new wxBoxSizer( wxVERTICAL );
3366
3367 wxStaticText* label = new wxStaticText( &dlg, wxID_ANY, _( "Description:" ) );
3368 mainSizer->Add( label, 0, wxLEFT | wxRIGHT | wxTOP | wxEXPAND, 10 );
3369
3370 mainSizer->AddSpacer( 3 );
3371
3372 wxTextCtrl* descCtrl = new wxTextCtrl( &dlg, wxID_ANY, currentDesc, wxDefaultPosition, wxSize( 400, 60 ),
3373 wxTE_MULTILINE );
3374 mainSizer->Add( descCtrl, 1, wxLEFT | wxRIGHT | wxBOTTOM | wxEXPAND, 10 );
3375
3376 wxStdDialogButtonSizer* btnSizer = new wxStdDialogButtonSizer();
3377 btnSizer->AddButton( new wxButton( &dlg, wxID_OK ) );
3378 btnSizer->AddButton( new wxButton( &dlg, wxID_CANCEL ) );
3379 btnSizer->Realize();
3380 mainSizer->Add( btnSizer, 0, wxALL | wxALIGN_RIGHT, 5 );
3381
3382 dlg.SetSizer( mainSizer );
3383 dlg.Fit();
3384 dlg.Centre();
3385
3386 if( dlg.ShowModal() == wxID_CANCEL )
3387 return;
3388
3389 wxString newDesc = descCtrl->GetValue().Trim().Trim( false );
3390
3391 Schematic().SetVariantDescription( variantName, newDesc );
3392 OnModify();
3393 GetCanvas()->Refresh();
3394}
3395
3396
3398{
3400 return;
3401
3402 wxArrayString choices = Schematic().GetVariantNamesForUI();
3403
3404 // Default variant cannot be removed.
3405 choices.RemoveAt( 0 );
3406
3407 // wxSingleChoiceDialog will ellipsize the title bar if the contents aren't wide enough. The set
3408 // of spaces in the control label are to prevent this.
3409 wxSingleChoiceDialog dlg( this, _( "Select variant name to remove:" ) + wxS( " " ),
3410 _( "Remove Design Variant" ), choices );
3411 dlg.Layout();
3412
3413 if( dlg.ShowModal() == wxID_CANCEL )
3414 return;
3415
3416 wxString variantName = dlg.GetStringSelection();
3417
3418 if( variantName.IsEmpty() )
3419 return;
3420
3422 SCH_COMMIT commit( this );
3423 bool append = false;
3424
3425 Schematic().DeleteVariant( variantName, &commit );
3426
3427 if( !commit.Empty() )
3428 {
3429 commit.Push();
3430 append = true;
3431 }
3432
3433 PICKED_ITEMS_LIST undoCmd;
3434 undoCmd.PushItem( ITEM_PICKER( GetScreen(), undoItem, UNDO_REDO::VARIANTS ) );
3435 undoCmd.SetDescription( _( "Delete Variant" ) );
3436 SaveCopyInUndoList( undoCmd, UNDO_REDO::VARIANTS, append );
3437
3438 OnModify();
3439
3440 if( Schematic().GetCurrentVariant() == variantName )
3441 SetCurrentVariant( wxEmptyString );
3442
3443 SyncVariantUI();
3444
3445 GetCanvas()->Refresh();
3446}
3447
3448
3449bool SCH_EDIT_FRAME::ValidateNewVariantName( const wxString& aName, const wxString& aExcludeName )
3450{
3451 if( aName.IsEmpty() )
3452 {
3453 GetInfoBar()->ShowMessageFor( _( "Variant name cannot be empty." ), 10000, wxICON_ERROR );
3454 return false;
3455 }
3456
3457 if( aName.CmpNoCase( GetDefaultVariantName() ) == 0 )
3458 {
3459 GetInfoBar()->ShowMessageFor( wxString::Format( _( "'%s' is a reserved variant name." ),
3461 10000, wxICON_ERROR );
3462 return false;
3463 }
3464
3465 for( const wxString& existingName : Schematic().GetVariantNames() )
3466 {
3467 if( existingName.CmpNoCase( aName ) == 0 && existingName.CmpNoCase( aExcludeName ) != 0 )
3468 {
3469 GetInfoBar()->ShowMessageFor( wxString::Format( _( "Variant '%s' already exists." ), existingName ),
3470 10000, wxICON_ERROR );
3471 return false;
3472 }
3473 }
3474
3475 return true;
3476}
3477
3478
3480{
3481 wxArrayString choices = Schematic().GetVariantNamesForUI();
3482
3483 // Default variant cannot be renamed.
3484 choices.RemoveAt( 0 );
3485
3486 if( choices.IsEmpty() )
3487 {
3488 GetInfoBar()->ShowMessageFor( _( "No variants to rename." ), 10000, wxICON_INFORMATION );
3489 return;
3490 }
3491
3492 wxSingleChoiceDialog selDlg( this, _( "Select variant to rename:" ) + wxS( " " ),
3493 _( "Rename Design Variant" ), choices );
3494 selDlg.Layout();
3495
3496 if( selDlg.ShowModal() == wxID_CANCEL )
3497 return;
3498
3499 wxString oldName = selDlg.GetStringSelection();
3500
3501 if( oldName.IsEmpty() )
3502 return;
3503
3504 wxTextEntryDialog nameDlg( this, _( "Enter new variant name:" ), _( "Rename Design Variant" ),
3505 oldName, wxOK | wxCANCEL | wxCENTER );
3506
3507 if( nameDlg.ShowModal() == wxID_CANCEL )
3508 return;
3509
3510 wxString newName = nameDlg.GetValue().Trim().Trim( false );
3511
3512 if( newName == oldName )
3513 return;
3514
3515 if( !ValidateNewVariantName( newName, oldName ) )
3516 return;
3517
3518 // The model retargets the current variant to the new name, so capture whether the toolbar was
3519 // showing the variant being renamed before the rename runs.
3520 bool wasCurrent = Schematic().GetCurrentVariant() == oldName;
3521
3523 SCH_COMMIT commit( this );
3524 bool append = false;
3525
3526 Schematic().RenameVariant( oldName, newName, &commit );
3527
3528 if( !commit.Empty() )
3529 {
3530 commit.Push();
3531 append = true;
3532 }
3533
3534 PICKED_ITEMS_LIST undoCmd;
3535 undoCmd.PushItem( ITEM_PICKER( GetScreen(), undoItem, UNDO_REDO::VARIANTS ) );
3536 undoCmd.SetDescription( _( "Rename Variant" ) );
3537 SaveCopyInUndoList( undoCmd, UNDO_REDO::VARIANTS, append );
3538
3539 // The registry entry changes even when no symbol carries an override, so always mark dirty.
3540 OnModify();
3541
3542 SyncVariantUI();
3543
3544 // Repaint ${VARIANT} text under the new name; a non-current rename needs no redraw
3545 if( wasCurrent )
3546 SetCurrentVariant( newName );
3547}
3548
3549
3551{
3552 wxArrayString choices = Schematic().GetVariantNamesForUI();
3553
3554 // Default variant cannot be copied.
3555 choices.RemoveAt( 0 );
3556
3557 if( choices.IsEmpty() )
3558 {
3559 GetInfoBar()->ShowMessageFor( _( "No variants to copy." ), 10000, wxICON_INFORMATION );
3560 return;
3561 }
3562
3563 wxSingleChoiceDialog selDlg( this, _( "Select variant to copy:" ) + wxS( " " ),
3564 _( "Copy Design Variant" ), choices );
3565 selDlg.Layout();
3566
3567 if( selDlg.ShowModal() == wxID_CANCEL )
3568 return;
3569
3570 wxString sourceName = selDlg.GetStringSelection();
3571
3572 if( sourceName.IsEmpty() )
3573 return;
3574
3575 wxTextEntryDialog nameDlg( this, _( "Enter name for the copied variant:" ), _( "Copy Design Variant" ),
3576 sourceName + wxS( "_copy" ), wxOK | wxCANCEL | wxCENTER );
3577
3578 if( nameDlg.ShowModal() == wxID_CANCEL )
3579 return;
3580
3581 wxString newName = nameDlg.GetValue().Trim().Trim( false );
3582
3583 if( !ValidateNewVariantName( newName, wxEmptyString ) )
3584 return;
3585
3587 SCH_COMMIT commit( this );
3588 bool append = false;
3589
3590 Schematic().CopyVariant( sourceName, newName, &commit );
3591
3592 if( !commit.Empty() )
3593 {
3594 commit.Push();
3595 append = true;
3596 }
3597
3598 PICKED_ITEMS_LIST undoCmd;
3599 undoCmd.PushItem( ITEM_PICKER( GetScreen(), undoItem, UNDO_REDO::VARIANTS ) );
3600 undoCmd.SetDescription( _( "Copy Variant" ) );
3601 SaveCopyInUndoList( undoCmd, UNDO_REDO::VARIANTS, append );
3602
3603 // The new registry entry changes project state even when no symbol carries an override.
3604 OnModify();
3605
3606 SyncVariantUI();
3607
3608 // Switching to the freshly-created variant already refreshes properties and redraws.
3609 SetCurrentVariant( newName );
3610}
3611
3612
3614{
3615 // Delegate to base auto-save behavior (commits pending local history) for now.
3617}
3618
3619
3621{
3623
3624 if( !mgr )
3625 return false;
3626
3627 TOOL_BASE* currentTool = mgr->GetCurrentTool();
3628 SCH_POINT_EDITOR* pointEditor = mgr->GetTool<SCH_POINT_EDITOR>();
3629
3630 // The point editor is the active tool whenever a point-editable item is selected, even while
3631 // idle, so it is safe to snapshot unless a drag is actively mutating the model.
3632 if( currentTool == pointEditor )
3633 return pointEditor && pointEditor->IsDragging();
3634
3635 return currentTool != mgr->GetTool<SCH_SELECTION_TOOL>();
3636}
3637
3638
3640{
3642 return false;
3643
3645}
3646
3647
3649{
3650 // Serializing the schematic on the UI thread freezes the editor; defer it while the user
3651 // is mid-operation (any tool other than passive selection or point editing is active) so
3652 // the snapshot waits for the timer to retry once the edit finishes.
3654}
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:917
static TOOL_ACTION toggleGrid
Definition actions.h:195
static TOOL_ACTION paste
Definition actions.h:77
static TOOL_ACTION cancelInteractive
Definition actions.h:69
static TOOL_ACTION unselectAll
Definition actions.h:80
static TOOL_ACTION selectItem
Select an item (specified as the event parameter).
Definition actions.h:224
static TOOL_ACTION copy
Definition actions.h:75
static TOOL_ACTION selectSetLasso
Definition actions.h:218
static TOOL_ACTION selectSetRect
Set lasso selection mode.
Definition actions.h:217
static TOOL_ACTION group
Definition actions.h:236
static TOOL_ACTION pasteSpecial
Definition actions.h:78
static TOOL_ACTION ungroup
Definition actions.h:237
static TOOL_ACTION toggleBoundingBoxes
Definition actions.h:154
static TOOL_ACTION showSearch
Definition actions.h:113
static TOOL_ACTION undo
Definition actions.h:72
static TOOL_ACTION selectionActivate
Activation of the selection tool.
Definition actions.h:211
static TOOL_ACTION duplicate
Definition actions.h:81
static TOOL_ACTION showGitCommitPane
Definition actions.h:264
static TOOL_ACTION doDelete
Definition actions.h:82
static TOOL_ACTION selectionTool
Definition actions.h:248
static TOOL_ACTION save
Definition actions.h:54
static TOOL_ACTION zoomFitScreen
Definition actions.h:139
static TOOL_ACTION redo
Definition actions.h:73
static TOOL_ACTION deleteTool
Definition actions.h:83
static TOOL_ACTION zoomTool
Definition actions.h:143
static TOOL_ACTION selectionClear
Clear the current selection.
Definition actions.h:221
static TOOL_ACTION showProperties
Definition actions.h:263
static TOOL_ACTION cut
Definition actions.h:74
static TOOL_ACTION copyAsText
Definition actions.h:76
static TOOL_ACTION toggleGridOverrides
Definition actions.h:196
static TOOL_ACTION selectAll
Definition actions.h:79
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:597
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.
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:2474
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:970
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:2491
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.
void RegisterProjectSaver(PROJECT *aProject)
Register aProject's own files (project, rules and library tables) for history snapshots.
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:922
KICAD_API_SERVER & GetApiServer()
Definition pgm_base.h:142
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:271
virtual const wxString GetProjectPath() const
Return the full path of the project.
Definition project.cpp:277
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:501
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:155
void SetCurrentSheet(const SCH_SHEET_PATH &aPath)
Definition schematic.h:404
void Reset()
Initialize this schematic to a blank one, unloading anything existing.
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)
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:276
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.
SCH_CONNECTIVITY::FACADE & Connectivity() const
Definition schematic.h:411
void SetProject(PROJECT *aPrj)
void DeleteVariant(const wxString &aVariantName, SCH_COMMIT *aCommit)
Delete all information for aVariantName.
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:414
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 RenameVariant(const wxString &aOldName, const wxString &aNewName, SCH_COMMIT *aCommit)
Rename a variant from aOldName to aNewName.
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.
void registerHistorySaver()
Register the loaded schematic and its project for autosave history. A no-op when they already are.
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.
void SyncVariantUI()
Refill the toolbar variant control and any open symbol fields table from the schematic.
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 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 SetContentModified(bool aModified)
Set whether the schematic has unsaved changes.
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 RefreshComposedReferences()
Redraw the displayed symbols after a sheet suffix change made on another screen.
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.
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:150
Schematic symbol object.
Definition sch_symbol.h:76
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.
void ClearCaches() override
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:185
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:178
#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:170
@ Published
A remote-tracking branch already holds the commit, so taking it back would rewrite shared history.
Definition git_backend.h:71
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
PROJECT & Prj()
Definition kicad.cpp:724
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:510
@ LAYER_ERC_EXCLUSION
Definition layer_ids.h:512
@ LAYER_ERC_ERR
Definition layer_ids.h:511
@ LAYER_OP_CURRENTS
Definition layer_ids.h:533
@ LAYER_INTERSHEET_REFS
Definition layer_ids.h:494
@ LAYER_OP_VOLTAGES
Definition layer_ids.h:532
@ 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:747
void UpdateOperatingPointVoltages(SCHEMATIC &aSchematic, const std::function< void(SCH_LINE *)> &aOnChanged)
Assign loaded operating-point voltages to the longest wire in each connected net portion.
#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:98
@ GLOBAL_CLEANUP
Definition schematic.h:101
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)
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
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.