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