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, you may find one here:
19 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20 * or you may search the http://www.gnu.org website for the version 2 license,
21 * or you may write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
25#include <algorithm>
26#include <api/api_handler_sch.h>
27#include <api/api_server.h>
28#include <base_units.h>
29#include <bitmaps.h>
30#include <confirm.h>
31#include <connection_graph.h>
32#include <dialogs/dialog_erc.h>
37#include <wx/srchctrl.h>
38#include <mail_type.h>
39#include <wx/clntdata.h>
40#include <wx/panel.h>
41#include <wx/sizer.h>
42#include <wx/menu.h>
43#include <local_history.h>
44#include <eeschema_id.h>
45#include <executable_names.h>
48#include <gestfich.h>
50#include <string_utils.h>
51#include <kiface_base.h>
52#include <kiplatform/app.h>
53#include <kiplatform/ui.h>
54#include <kiway.h>
55#include <symbol_edit_frame.h>
56#include <symbol_viewer_frame.h>
57#include <pgm_base.h>
58#include <core/profile.h>
61#include <sch_edit_frame.h>
63#include <sch_painter.h>
64#include <sch_marker.h>
65#include <sch_sheet_pin.h>
66#include <sch_commit.h>
67#include <sch_rule_area.h>
69#include <advanced_config.h>
70#include <sim/simulator_frame.h>
71#include <tool/action_manager.h>
72#include <tool/action_toolbar.h>
73#include <tool/common_control.h>
74#include <tool/common_tools.h>
75#include <tool/embed_tool.h>
76#include <tool/picker_tool.h>
78#include <tool/selection.h>
80#include <tool/tool_manager.h>
81#include <tool/zoom_tool.h>
82#include <tools/sch_actions.h>
88#include <sch_io/sch_io_mgr.h>
89#include <sch_io/sch_io.h>
91#include <tools/sch_edit_tool.h>
97#include <tools/sch_move_tool.h>
100#include <trace_helpers.h>
101#include <unordered_set>
102#include <view/view_controls.h>
103#include <widgets/wx_infobar.h>
109#include <wx/cmdline.h>
110#include <wx/app.h>
111#include <wx/filedlg.h>
112#include <wx/socket.h>
113#include <wx/debug.h>
115#include <widgets/wx_aui_utils.h>
118#include <toolbars_sch_editor.h>
119#include <wx/log.h>
120#include <wx/choicdlg.h>
121#include <wx/textdlg.h>
122#include <wx/generic/treectlg.h>
123
124
125#ifdef KICAD_IPC_API
127#include <api/api_utils.h>
128#endif
129
131
132
133#define DIFF_SYMBOLS_DIALOG_NAME wxT( "DiffSymbolsDialog" )
134
135
136BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, SCH_BASE_FRAME )
139
140 EVT_SIZE( SCH_EDIT_FRAME::OnSize )
141
144
145 EVT_MENU( wxID_EXIT, SCH_EDIT_FRAME::OnExit )
146 EVT_MENU( wxID_CLOSE, SCH_EDIT_FRAME::OnExit )
147
150
151 // Drop files event
152 EVT_DROP_FILES( SCH_EDIT_FRAME::OnDropFiles )
153END_EVENT_TABLE()
154
155
156wxDEFINE_EVENT( EDA_EVT_SCHEMATIC_CHANGING, wxCommandEvent );
157wxDEFINE_EVENT( EDA_EVT_SCHEMATIC_CHANGED, wxCommandEvent );
158
159
160SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
161 SCH_BASE_FRAME( aKiway, aParent, FRAME_SCH, wxT( "Eeschema" ), wxDefaultPosition,
163 m_ercDialog( nullptr ),
164 m_diffSymbolDialog( nullptr ),
165 m_symbolFieldsTableDialog( nullptr ),
166 m_netNavigator( nullptr ),
167 m_netNavigatorFilter( nullptr ),
171 m_designBlocksPane( nullptr ),
172 m_remoteSymbolPane( nullptr ),
173 m_currentVariantCtrl( nullptr )
174{
175 m_maximizeByDefault = true;
176 m_schematic = new SCHEMATIC( &Prj() );
177 m_schematic->SetSchematicHolder( this );
179
180 m_showBorderAndTitleBlock = true; // true to show sheet references
181 m_supportsAutoSave = true;
183 m_aboutTitle = _HKI( "KiCad Schematic Editor" );
184 m_show_search = false;
185 // Ensure timer has an owner before binding so it generates events.
186 m_crossProbeFlashTimer.SetOwner( this );
187 Bind( wxEVT_TIMER, &SCH_EDIT_FRAME::OnCrossProbeFlashTimer, this, m_crossProbeFlashTimer.GetId() );
188
189 // Give an icon
190 wxIcon icon;
191 wxIconBundle icon_bundle;
192
193 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_eeschema, 48 ) );
194 icon_bundle.AddIcon( icon );
195 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_eeschema, 128 ) );
196 icon_bundle.AddIcon( icon );
197 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_eeschema, 256 ) );
198 icon_bundle.AddIcon( icon );
199 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_eeschema_32 ) );
200 icon_bundle.AddIcon( icon );
201 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_eeschema_16 ) );
202 icon_bundle.AddIcon( icon );
203
204 SetIcons( icon_bundle );
205
207
208 setupTools();
211
215
216 // Ensure the "Line modes" toolbar group shows the current angle mode on startup
217 if( GetToolManager() )
219
220#ifdef KICAD_IPC_API
221 wxTheApp->Bind( EDA_EVT_PLUGIN_AVAILABILITY_CHANGED, &SCH_EDIT_FRAME::onPluginAvailabilityChanged, this );
222#endif
223
224 m_hierarchy = new HIERARCHY_PANE( this );
225
226 // Initialize common print setup dialog settings.
227 m_pageSetupData.GetPrintData().SetPrintMode( wxPRINT_MODE_PRINTER );
228 m_pageSetupData.GetPrintData().SetQuality( wxPRINT_QUALITY_MEDIUM );
229 m_pageSetupData.GetPrintData().SetBin( wxPRINTBIN_AUTO );
230 m_pageSetupData.GetPrintData().SetNoCopies( 1 );
231
232 m_searchPane = new SCH_SEARCH_PANE( this );
233 m_propertiesPanel = new SCH_PROPERTIES_PANEL( this, this );
235
236 m_propertiesPanel->SetSplitterProportion( eeconfig()->m_AuiPanels.properties_splitter );
237
240
241 m_auimgr.SetManagedWindow( this );
242
244
245 // Fetch a COPY of the config as a lot of these initializations are going to overwrite our
246 // data.
247 EESCHEMA_SETTINGS::AUI_PANELS aui_cfg = eeconfig()->m_AuiPanels;
248 EESCHEMA_SETTINGS::APPEARANCE appearance_cfg = eeconfig()->m_Appearance;
249
250 // Rows; layers 4 - 6
251 m_auimgr.AddPane( m_tbTopMain, EDA_PANE().HToolbar().Name( wxS( "TopMainToolbar" ) )
252 .Top().Layer( 6 ) );
253
254 m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( wxS( "MsgPanel" ) )
255 .Bottom().Layer( 6 ) );
256
257 // Columns; layers 1 - 3
258 m_auimgr.AddPane( m_hierarchy, EDA_PANE().Palette().Name( SchematicHierarchyPaneName() )
259 .Caption( _( "Schematic Hierarchy" ) )
260 .Left().Layer( 3 ).Position( 1 )
261 .TopDockable( false )
262 .BottomDockable( false )
263 .CloseButton( true )
264 .MinSize( FromDIP( wxSize( 120, 60 ) ) )
265 .BestSize( FromDIP( wxSize( 200, 200 ) ) )
266 .FloatingSize( FromDIP( wxSize( 200, 200 ) ) )
267 .FloatingPosition( FromDIP( wxPoint( 50, 50 ) ) )
268 .Show( false ) );
269
272
275
277
278 m_auimgr.AddPane( m_tbLeft, EDA_PANE().VToolbar().Name( wxS( "LeftToolbar" ) )
279 .Left().Layer( 2 ) );
280
281 m_auimgr.AddPane( m_tbRight, EDA_PANE().VToolbar().Name( wxS( "RightToolbar" ) )
282 .Right().Layer( 2 ) );
283
284 // Center
285 m_auimgr.AddPane( GetCanvas(), EDA_PANE().Canvas().Name( wxS( "DrawFrame" ) )
286 .Center() );
287
288 m_auimgr.AddPane( m_searchPane, EDA_PANE()
289 .Name( SearchPaneName() )
290 .Bottom()
291 .Caption( _( "Search" ) )
292 .PaneBorder( false )
293 .MinSize( FromDIP( wxSize( 180, 60 ) ) )
294 .BestSize( FromDIP( wxSize( 180, 100 ) ) )
295 .FloatingSize( FromDIP( wxSize( 480, 200 ) ) )
296 .CloseButton( true )
297 .DestroyOnClose( false )
298 .Show( m_show_search ) );
299
302
303 wxAuiPaneInfo& hierarchy_pane = m_auimgr.GetPane( SchematicHierarchyPaneName() );
304 wxAuiPaneInfo& netNavigatorPane = m_auimgr.GetPane( NetNavigatorPaneName() );
305 wxAuiPaneInfo& propertiesPane = m_auimgr.GetPane( PropertiesPaneName() );
306 wxAuiPaneInfo& selectionFilterPane = m_auimgr.GetPane( wxS( "SelectionFilter" ) );
307 wxAuiPaneInfo& designBlocksPane = m_auimgr.GetPane( DesignBlocksPaneName() );
308 wxAuiPaneInfo& remoteSymbolPane = m_auimgr.GetPane( RemoteSymbolPaneName() );
309
310 hierarchy_pane.Show( aui_cfg.show_schematic_hierarchy );
311 netNavigatorPane.Show( aui_cfg.show_net_nav_panel );
312 propertiesPane.Show( aui_cfg.show_properties );
313 designBlocksPane.Show( aui_cfg.design_blocks_show );
314
315 if( m_remoteSymbolPane && !m_remoteSymbolPane->HasDataSources() )
316 remoteSymbolPane.Show( false );
317 else
318 remoteSymbolPane.Show( aui_cfg.remote_symbol_show );
319
321
322 // The selection filter doesn't need to grow in the vertical direction when docked
323 selectionFilterPane.dock_proportion = 0;
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
424
425 GetCanvas()->GetGAL()->SetAxesEnabled( false );
426
427 KIGFX::SCH_VIEW* view = GetCanvas()->GetView();
428 static_cast<KIGFX::SCH_PAINTER*>( view->GetPainter() )->SetSchematic( m_schematic );
429
432
433 view->SetLayerVisible( LAYER_ERC_ERR, appearance_cfg.show_erc_errors );
434 view->SetLayerVisible( LAYER_ERC_WARN, appearance_cfg.show_erc_warnings );
436 view->SetLayerVisible( LAYER_OP_VOLTAGES, appearance_cfg.show_op_voltages );
437 view->SetLayerVisible( LAYER_OP_CURRENTS, appearance_cfg.show_op_currents );
438
440
442 m_netNavigator->Bind( wxEVT_TREE_SEL_CHANGING, &SCH_EDIT_FRAME::onNetNavigatorSelChanging, this );
443 m_netNavigator->Bind( wxEVT_TREE_SEL_CHANGED, &SCH_EDIT_FRAME::onNetNavigatorSelection, this );
444 m_netNavigator->Bind( wxEVT_SIZE, &SCH_EDIT_FRAME::onResizeNetNavigator, this );
445
446 // This is used temporarily to fix a client size issue on GTK that causes zoom to fit
447 // to calculate the wrong zoom size. See SCH_EDIT_FRAME::onSize().
448 Bind( wxEVT_SIZE, &SCH_EDIT_FRAME::onSize, this );
449
450 setupUnits( eeconfig() );
451
452 // Net list generator
454
455 updateTitle();
456 m_toolManager->GetTool<SCH_NAVIGATE_TOOL>()->ResetHistory();
457
458#ifdef KICAD_IPC_API
459 m_apiHandler = std::make_unique<API_HANDLER_SCH>( this );
460 Pgm().GetApiServer().RegisterHandler( m_apiHandler.get() );
461#endif
462
463 // Default shutdown reason until a file is loaded
464 KIPLATFORM::APP::SetShutdownBlockReason( this, _( "New schematic file is unsaved" ) );
465
466 // Init for dropping files
470 m_acceptedExts.emplace( wxS( "jpeg" ), &SCH_ACTIONS::ddAddImage );
471 m_acceptedExts.emplace( wxS( "dxf" ), &SCH_ACTIONS::ddImportGraphics );
473 DragAcceptFiles( true );
474
475 // Ensure the window is on top
476 Raise();
477
478 // Now that all sizes are fixed, set the initial hierarchy_pane floating position to the
479 // top-left corner of the canvas
480 wxPoint canvas_pos = GetCanvas()->GetScreenPosition();
481 hierarchy_pane.FloatingPosition( canvas_pos.x + 10, canvas_pos.y + 10 );
482
483 Bind( wxEVT_CHOICE, &SCH_EDIT_FRAME::onVariantSelected, this );
484 Bind( EDA_EVT_CLOSE_DIALOG_BOOK_REPORTER, &SCH_EDIT_FRAME::onCloseSymbolDiffDialog, this );
485 Bind( EDA_EVT_CLOSE_ERC_DIALOG, &SCH_EDIT_FRAME::onCloseErcDialog, this );
486 Bind( EDA_EVT_CLOSE_DIALOG_SYMBOL_FIELDS_TABLE, &SCH_EDIT_FRAME::onCloseSymbolFieldsTableDialog, this );
487}
488
489void SCH_EDIT_FRAME::StartCrossProbeFlash( const std::vector<SCH_ITEM*>& aItems )
490{
491 if( !eeconfig()->m_CrossProbing.flash_selection )
492 {
493 wxLogTrace( traceCrossProbeFlash, "StartCrossProbeFlash: aborted (setting disabled) items=%zu", aItems.size() );
494 return;
495 }
496
497 if( aItems.empty() )
498 {
499 wxLogTrace( traceCrossProbeFlash, "StartCrossProbeFlash: aborted (no items)" );
500 return;
501 }
502
504 {
505 wxLogTrace( traceCrossProbeFlash, "StartCrossProbeFlash: restarting existing flash (phase=%d)",
508 }
509
510 wxLogTrace( traceCrossProbeFlash, "StartCrossProbeFlash: starting with %zu items", aItems.size() );
512
513 for( SCH_ITEM* it : aItems )
514 m_crossProbeFlashItems.push_back( it->m_Uuid );
515
518
519 if( !m_crossProbeFlashTimer.GetOwner() )
520 m_crossProbeFlashTimer.SetOwner( this );
521
522 bool started = m_crossProbeFlashTimer.Start( 500, wxTIMER_CONTINUOUS );
523 wxLogTrace( traceCrossProbeFlash, "StartCrossProbeFlash: timer start=%d id=%d", (int) started,
524 m_crossProbeFlashTimer.GetId() );
525}
526
527
528void SCH_EDIT_FRAME::OnCrossProbeFlashTimer( wxTimerEvent& aEvent )
529{
530 wxLogTrace( traceCrossProbeFlash, "Timer(SCH) fired: phase=%d running=%d items=%zu", m_crossProbeFlashPhase,
532
534 {
535 wxLogTrace( traceCrossProbeFlash, "Timer fired but not flashing (ignored)" );
536 return;
537 }
538
540
541 if( !selTool )
542 return;
543
544 bool prevGuard = m_syncingPcbToSchSelection;
546
547 if( m_crossProbeFlashPhase % 2 == 0 )
548 {
549 selTool->ClearSelection( true );
550 wxLogTrace( traceCrossProbeFlash, "Phase %d: cleared selection", m_crossProbeFlashPhase );
551 }
552 else
553 {
554 for( const KIID& id : m_crossProbeFlashItems )
555 {
556 if( SCH_ITEM* item = Schematic().ResolveItem( id, nullptr, true ) )
557 selTool->AddItemToSel( item, true );
558 }
559
560 wxLogTrace( traceCrossProbeFlash, "Phase %d: restored %zu items", m_crossProbeFlashPhase,
561 m_crossProbeFlashItems.size() );
562 }
563
564 if( GetCanvas() )
565 {
567 wxLogTrace( traceCrossProbeFlash, "Phase %d: forced canvas refresh", m_crossProbeFlashPhase );
568 }
569
570 m_syncingPcbToSchSelection = prevGuard;
572
573 if( m_crossProbeFlashPhase > 6 )
574 {
575 for( const KIID& id : m_crossProbeFlashItems )
576 {
577 if( SCH_ITEM* item = Schematic().ResolveItem( id, nullptr, true ) )
578 selTool->AddItemToSel( item, true );
579 }
580
581 m_crossProbeFlashing = false;
583 wxLogTrace( traceCrossProbeFlash, "Flashing complete. Final selection size=%zu",
584 m_crossProbeFlashItems.size() );
585 }
586}
587
588
590{
591 m_hierarchy->Unbind( wxEVT_SIZE, &SCH_EDIT_FRAME::OnResizeHierarchyNavigator, this );
592
593 // Ensure m_canvasType is up to date, to save it in config
595
596 SetScreen( nullptr );
597
598 if( m_schematic )
599 m_schematic->RemoveAllListeners();
600
601 // Canvas outlives m_schematic; detach tracker consumers before delete.
602 if( GetCanvas() && GetCanvas()->GetView() )
604
605 // Delete all items not in draw list before deleting schematic
606 // to avoid dangling pointers stored in these items
609
610 delete m_schematic;
611 m_schematic = nullptr;
612
613 // Close the project if we are standalone, so it gets cleaned up properly
614 if( Kiface().IsSingle() )
615 {
616 try
617 {
618 GetSettingsManager()->UnloadProject( &Prj(), false );
619 }
620 catch( const std::runtime_error& e )
621 {
622 wxFAIL_MSG( wxString::Format( wxT( "Settings exception occurred: %s" ), e.what() ) );
623 }
624 }
625
626 // We passed ownership of these to wxAuiManager.
627 // delete m_hierarchy;
628 // delete m_selectionFilterPanel;
629}
630
631
633{
634 aEvent.Skip();
635
636 // 1st Call: Handle the size update during the first resize event.
638
639 // Defer the second size capture
640 CallAfter( [this]()
641 {
643 } );
644}
645
646
648{
649 // Called when resizing the Hierarchy Navigator panel
650 // Store the current pane size
651 // It allows to retrieve the last defined pane size when switching between
652 // docked and floating pane state
653 // Note: *DO NOT* call m_auimgr.Update() here: it crashes KiCad at least on Windows
654
655 EESCHEMA_SETTINGS* cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
656 wxAuiPaneInfo& hierarchy_pane = m_auimgr.GetPane( SchematicHierarchyPaneName() );
657
658 if( cfg && m_hierarchy->IsShownOnScreen() )
659 {
660 cfg->m_AuiPanels.hierarchy_panel_float_width = hierarchy_pane.floating_size.x;
661 cfg->m_AuiPanels.hierarchy_panel_float_height = hierarchy_pane.floating_size.y;
662
663 // initialize hierarchy_panel_docked_width and best size only if the hierarchy_pane
664 // width is > 0 (i.e. if its size is already set and has meaning)
665 // if it is floating, its size is not initialized (only floating_size is initialized)
666 // initializing hierarchy_pane.best_size is useful when switching to float pane and
667 // after switching to the docked pane, to retrieve the last docked pane width
668 if( hierarchy_pane.rect.width > 50 ) // 50 is a good margin
669 {
670 cfg->m_AuiPanels.hierarchy_panel_docked_width = hierarchy_pane.rect.width;
671 hierarchy_pane.best_size.x = hierarchy_pane.rect.width;
672 }
673 }
674}
675
676
678{
679 // Create the manager and dispatcher & route draw panel events to the dispatcher
681 m_toolManager->SetEnvironment( &Schematic(), GetCanvas()->GetView(),
682 GetCanvas()->GetViewControls(), config(), this );
683 m_actions = new SCH_ACTIONS();
685
686 // Register tools
687 m_toolManager->RegisterTool( new COMMON_CONTROL );
688 m_toolManager->RegisterTool( new COMMON_TOOLS );
689 m_toolManager->RegisterTool( new ZOOM_TOOL );
690 m_toolManager->RegisterTool( new SCH_SELECTION_TOOL );
691 m_toolManager->RegisterTool( new PICKER_TOOL );
692 m_toolManager->RegisterTool( new SCH_DRAWING_TOOLS );
693 m_toolManager->RegisterTool( new SCH_LINE_WIRE_BUS_TOOL );
694 m_toolManager->RegisterTool( new SCH_MOVE_TOOL );
695 m_toolManager->RegisterTool( new SCH_ALIGN_TOOL );
696 m_toolManager->RegisterTool( new SCH_EDIT_TOOL );
697 m_toolManager->RegisterTool( new SCH_EDIT_TABLE_TOOL );
698 m_toolManager->RegisterTool( new SCH_GROUP_TOOL );
699 m_toolManager->RegisterTool( new SCH_INSPECTION_TOOL );
700 m_toolManager->RegisterTool( new SCH_DESIGN_BLOCK_CONTROL );
701 m_toolManager->RegisterTool( new SCH_EDITOR_CONTROL );
702 m_toolManager->RegisterTool( new SCH_FIND_REPLACE_TOOL );
703 m_toolManager->RegisterTool( new SCH_POINT_EDITOR );
704 m_toolManager->RegisterTool( new SCH_NAVIGATE_TOOL );
705 m_toolManager->RegisterTool( new PROPERTIES_TOOL );
706 m_toolManager->RegisterTool( new EMBED_TOOL );
707 m_toolManager->InitTools();
708
709 // Run the selection tool, it is supposed to be always active
711
713}
714
715
717{
719
720 ACTION_MANAGER* mgr = m_toolManager->GetActionManager();
721 SCH_EDITOR_CONDITIONS cond( this );
722
723 wxASSERT( mgr );
724
725 auto hasElements =
726 [ this ] ( const SELECTION& aSel )
727 {
728 return GetScreen() &&
729 ( !GetScreen()->Items().empty() || !SELECTION_CONDITIONS::Idle( aSel ) );
730 };
731
732 auto searchPaneCond =
733 [this] ( const SELECTION& )
734 {
735 return m_auimgr.GetPane( SearchPaneName() ).IsShown();
736 };
737
738 auto propertiesCond =
739 [this] ( const SELECTION& )
740 {
741 return m_auimgr.GetPane( PropertiesPaneName() ).IsShown();
742 };
743
744 auto hierarchyNavigatorCond =
745 [ this ] ( const SELECTION& aSel )
746 {
747 return m_auimgr.GetPane( SchematicHierarchyPaneName() ).IsShown();
748 };
749
750 auto netNavigatorCond =
751 [ this ] (const SELECTION& aSel )
752 {
753 return m_auimgr.GetPane( NetNavigatorPaneName() ).IsShown();
754 };
755
756 auto designBlockCond =
757 [ this ] (const SELECTION& aSel )
758 {
759 return m_auimgr.GetPane( DesignBlocksPaneName() ).IsShown();
760 };
761
762 auto remoteSymbolCond =
763 [ this ] (const SELECTION& aSel )
764 {
765 return m_auimgr.GetPane( RemoteSymbolPaneName() ).IsShown();
766 };
767
768 auto undoCond =
769 [ this ] (const SELECTION& aSel )
770 {
772 return true;
773
774 return GetUndoCommandCount() > 0;
775 };
776
777 auto groupWithDesignBlockLink =
778 [] ( const SELECTION& aSel )
779 {
780 if( aSel.Size() != 1 )
781 return false;
782
783 if( aSel[0]->Type() != SCH_GROUP_T )
784 return false;
785
786 SCH_GROUP* group = static_cast<SCH_GROUP*>( aSel.GetItem( 0 ) );
787
788 return group->HasDesignBlockLink();
789 };
790
791#define ENABLE( x ) ACTION_CONDITIONS().Enable( x )
792#define CHECK( x ) ACTION_CONDITIONS().Check( x )
793
795 mgr->SetConditions( ACTIONS::undo, ENABLE( undoCond ) );
797
798 mgr->SetConditions( SCH_ACTIONS::showSearch, CHECK( searchPaneCond ) );
799 mgr->SetConditions( SCH_ACTIONS::showHierarchy, CHECK( hierarchyNavigatorCond ) );
800 mgr->SetConditions( SCH_ACTIONS::showNetNavigator, CHECK( netNavigatorCond ) );
801 mgr->SetConditions( ACTIONS::showProperties, CHECK( propertiesCond ) );
802 mgr->SetConditions( SCH_ACTIONS::showDesignBlockPanel, CHECK( designBlockCond ) );
803 mgr->SetConditions( SCH_ACTIONS::showRemoteSymbolPanel, CHECK( remoteSymbolCond ) );
806
807 mgr->SetConditions( ACTIONS::cut, ENABLE( hasElements ) );
808 mgr->SetConditions( ACTIONS::copy, ENABLE( hasElements ) );
809 mgr->SetConditions( ACTIONS::copyAsText, ENABLE( hasElements ) );
812 mgr->SetConditions( ACTIONS::doDelete, ENABLE( hasElements ) );
813 mgr->SetConditions( ACTIONS::duplicate, ENABLE( hasElements ) );
820 mgr->SetConditions( ACTIONS::selectAll, ENABLE( hasElements ) );
821 mgr->SetConditions( ACTIONS::unselectAll, ENABLE( hasElements ) );
822
823 mgr->SetConditions( SCH_ACTIONS::rotateCW, ENABLE( hasElements ) );
824 mgr->SetConditions( SCH_ACTIONS::rotateCCW, ENABLE( hasElements ) );
825 mgr->SetConditions( SCH_ACTIONS::mirrorH, ENABLE( hasElements ) );
826 mgr->SetConditions( SCH_ACTIONS::mirrorV, ENABLE( hasElements ) );
829
830 mgr->SetConditions( SCH_ACTIONS::placeLinkedDesignBlock, ENABLE( groupWithDesignBlockLink ) );
831 mgr->SetConditions( SCH_ACTIONS::saveToLinkedDesignBlock, ENABLE( groupWithDesignBlockLink ) );
832
837
838 auto showHiddenPinsCond =
839 [this]( const SELECTION& )
840 {
841 return GetShowAllPins();
842 };
843
844 auto showHiddenFieldsCond =
845 [this]( const SELECTION& )
846 {
848 return cfg && cfg->m_Appearance.show_hidden_fields;
849 };
850
851 auto showDirectiveLabelsCond =
852 [this]( const SELECTION& )
853 {
855 return cfg && cfg->m_Appearance.show_directive_labels;
856 };
857
858 auto showERCErrorsCond =
859 [this]( const SELECTION& )
860 {
862 return cfg && cfg->m_Appearance.show_erc_errors;
863 };
864
865 auto showERCWarningsCond =
866 [this]( const SELECTION& )
867 {
869 return cfg && cfg->m_Appearance.show_erc_warnings;
870 };
871
872 auto showERCExclusionsCond =
873 [this]( const SELECTION& )
874 {
876 return cfg && cfg->m_Appearance.show_erc_exclusions;
877 };
878
879 auto markSimExclusionsCond =
880 [this]( const SELECTION& )
881 {
883 return cfg && cfg->m_Appearance.mark_sim_exclusions;
884 };
885
886 auto showOPVoltagesCond =
887 [this]( const SELECTION& )
888 {
890 return cfg && cfg->m_Appearance.show_op_voltages;
891 };
892
893 auto showOPCurrentsCond =
894 [this]( const SELECTION& )
895 {
897 return cfg && cfg->m_Appearance.show_op_currents;
898 };
899
900 auto showPinAltModeIconsCond =
901 [this]( const SELECTION& )
902 {
904 return cfg && cfg->m_Appearance.show_pin_alt_icons;
905 };
906
907 auto showAnnotateAutomaticallyCond =
908 [this]( const SELECTION& )
909 {
911 };
912
913 auto remapSymbolsCondition =
914 [&]( const SELECTION& aSel )
915 {
916 SCH_SCREENS schematic( Schematic().Root() );
917
918 // The remapping can only be performed on legacy projects.
919 return schematic.HasNoFullyDefinedLibIds();
920 };
921
922 auto belowRootSheetCondition =
923 [this]( const SELECTION& aSel )
924 {
925 SCH_NAVIGATE_TOOL* navigateTool = m_toolManager->GetTool<SCH_NAVIGATE_TOOL>();
926 return navigateTool && navigateTool->CanGoUp();
927 };
928
929 mgr->SetConditions( SCH_ACTIONS::leaveSheet, ENABLE( belowRootSheetCondition ) );
930
931 /* Some of these are bound by default to arrow keys which will get a different action if we
932 * disable the buttons. So always leave them enabled so the action is consistent.
933 * https://gitlab.com/kicad/code/kicad/-/issues/14783
934 mgr->SetConditions( SCH_ACTIONS::navigateUp, ENABLE( belowRootSheetCondition ) );
935 mgr->SetConditions( SCH_ACTIONS::navigateForward, ENABLE( navHistoryHasForward ) );
936 mgr->SetConditions( SCH_ACTIONS::navigateBack, ENABLE( navHistoryHsBackward ) );
937 */
938
939 mgr->SetConditions( SCH_ACTIONS::remapSymbols, ENABLE( remapSymbolsCondition ) );
940 mgr->SetConditions( SCH_ACTIONS::toggleHiddenPins, CHECK( showHiddenPinsCond ) );
941 mgr->SetConditions( SCH_ACTIONS::toggleHiddenFields, CHECK( showHiddenFieldsCond ) );
942 mgr->SetConditions( SCH_ACTIONS::toggleDirectiveLabels, CHECK( showDirectiveLabelsCond ) );
943 mgr->SetConditions( SCH_ACTIONS::toggleERCErrors, CHECK( showERCErrorsCond ) );
944 mgr->SetConditions( SCH_ACTIONS::toggleERCWarnings, CHECK( showERCWarningsCond ) );
945 mgr->SetConditions( SCH_ACTIONS::toggleERCExclusions, CHECK( showERCExclusionsCond ) );
946 mgr->SetConditions( SCH_ACTIONS::markSimExclusions, CHECK( markSimExclusionsCond ) );
947 mgr->SetConditions( SCH_ACTIONS::toggleOPVoltages, CHECK( showOPVoltagesCond ) );
948 mgr->SetConditions( SCH_ACTIONS::toggleOPCurrents, CHECK( showOPCurrentsCond ) );
949 mgr->SetConditions( SCH_ACTIONS::togglePinAltIcons, CHECK( showPinAltModeIconsCond ) );
950 mgr->SetConditions( SCH_ACTIONS::toggleAnnotateAuto, CHECK( showAnnotateAutomaticallyCond ) );
952
955
956#define CURRENT_TOOL( action ) mgr->SetConditions( action, CHECK( cond.CurrentTool( action ) ) )
957
987
988#undef CURRENT_TOOL
989#undef CHECK
990#undef ENABLE
991}
992
993
995{
996 // we cannot store a pointer to an item in the display list here since
997 // that item may be deleted, such as part of a line concatenation or other.
998 // So simply always keep a copy of the object which is to be repeated.
999
1000 if( aItem )
1001 {
1002 m_items_to_repeat.clear();
1003
1004 AddCopyForRepeatItem( aItem );
1005 }
1006}
1007
1008
1010{
1011 // we cannot store a pointer to an item in the display list here since
1012 // that item may be deleted, such as part of a line concatenation or other.
1013 // So simply always keep a copy of the object which is to be repeated.
1014
1015 if( aItem )
1016 {
1017 std::unique_ptr<SCH_ITEM> repeatItem( static_cast<SCH_ITEM*>( aItem->Duplicate( IGNORE_PARENT_GROUP ) ) );
1018
1019 // Clone() preserves the flags & parent, we want 'em cleared.
1020 repeatItem->ClearFlags();
1021 repeatItem->SetParent( nullptr );
1022
1023 m_items_to_repeat.emplace_back( std::move( repeatItem ) );
1024 }
1025}
1026
1027
1028EDA_ITEM* SCH_EDIT_FRAME::ResolveItem( const KIID& aId, bool aAllowNullptrReturn ) const
1029{
1030 return Schematic().ResolveItem( aId, nullptr, aAllowNullptrReturn );
1031}
1032
1033
1038
1039
1044
1045
1047{
1048 return *m_schematic;
1049}
1050
1051
1053{
1054 return GetCurrentSheet().Last()->GetName();
1055}
1056
1057
1059{
1061}
1062
1063
1065{
1066 m_schematic->CreateDefaultScreens();
1067 SetScreen( Schematic().RootScreen() );
1068
1069 if( GetScreen() == nullptr )
1070 {
1071 SCH_SCREEN* screen = new SCH_SCREEN( m_schematic );
1072 SetScreen( screen );
1073 }
1074}
1075
1076
1078{
1079 return m_schematic->CurrentSheet();
1080}
1081
1082
1084{
1085 if( aSheet != GetCurrentSheet() )
1086 {
1087 ClearFocus();
1088
1089 wxLogTrace( traceSchCurrentSheet,
1090 "SCH_EDIT_FRAME::SetCurrentSheet: Changing from path='%s' (size=%zu) to path='%s' (size=%zu)",
1091 GetCurrentSheet().Path().AsString(),
1092 GetCurrentSheet().size(),
1093 aSheet.Path().AsString(),
1094 aSheet.size() );
1095
1096 Schematic().SetCurrentSheet( aSheet );
1097 GetCanvas()->DisplaySheet( aSheet.LastScreen() );
1098 }
1099}
1100
1101
1103{
1105
1106 for( SCH_ITEM* item : screen->Items() )
1107 item->ClearCaches();
1108
1109 for( const std::pair<const wxString, LIB_SYMBOL*>& libSymbol : screen->GetLibSymbols() )
1110 {
1111 wxCHECK2( libSymbol.second, continue );
1112 libSymbol.second->ClearCaches();
1113 }
1114
1115 if( Schematic().Settings().m_IntersheetRefsShow )
1117
1118 ClearFocus();
1119
1120 GetCanvas()->DisplaySheet( GetCurrentSheet().LastScreen() );
1121
1122 if( SCH_SELECTION_TOOL* selectionTool = m_toolManager->GetTool<SCH_SELECTION_TOOL>() )
1123 selectionTool->Reset( TOOL_BASE::REDRAW );
1124
1126}
1127
1128
1129bool SCH_EDIT_FRAME::canCloseWindow( wxCloseEvent& aEvent )
1130{
1131 // Exit interactive editing
1132 // Note this this will commit *some* pending changes. For instance, the SCH_POINT_EDITOR
1133 // will cancel any drag currently in progress, but commit all changes from previous drags.
1134 if( m_toolManager )
1136
1137 // Shutdown blocks must be determined and vetoed as early as possible
1138 if( KIPLATFORM::APP::SupportsShutdownBlockReason() && aEvent.GetId() == wxEVT_QUERY_END_SESSION
1139 && IsContentModified() )
1140 {
1141 return false;
1142 }
1143
1144 if( Kiface().IsSingle() )
1145 {
1146 auto* symbolEditor = (SYMBOL_EDIT_FRAME*) Kiway().Player( FRAME_SCH_SYMBOL_EDITOR, false );
1147
1148 if( symbolEditor && !symbolEditor->Close() ) // Can close symbol editor?
1149 return false;
1150
1151 auto* symbolViewer = (SYMBOL_VIEWER_FRAME*) Kiway().Player( FRAME_SCH_VIEWER, false );
1152
1153 if( symbolViewer && !symbolViewer->Close() ) // Can close symbol viewer?
1154 return false;
1155
1156 // SYMBOL_CHOOSER_FRAME is always modal so this shouldn't come up, but better safe than
1157 // sorry.
1158 auto* chooser = (SYMBOL_CHOOSER_FRAME*) Kiway().Player( FRAME_SYMBOL_CHOOSER, false );
1159
1160 if( chooser && !chooser->Close() ) // Can close symbol chooser?
1161 return false;
1162 }
1163 else
1164 {
1165 auto* symbolEditor = (SYMBOL_EDIT_FRAME*) Kiway().Player( FRAME_SCH_SYMBOL_EDITOR, false );
1166
1167 if( symbolEditor && symbolEditor->IsSymbolFromSchematic() )
1168 {
1169 if( !symbolEditor->CanCloseSymbolFromSchematic( true ) )
1170 return false;
1171 }
1172 }
1173
1174 if( !Kiway().PlayerClose( FRAME_SIMULATOR, false ) ) // Can close the simulator?
1175 return false;
1176
1178 && !m_symbolFieldsTableDialog->Close( false ) ) // Can close the symbol fields table?
1179 {
1180 return false;
1181 }
1182
1183 // We may have gotten multiple events; don't clean up twice
1184 if( !Schematic().IsValid() )
1185 return false;
1186
1187 if( IsContentModified() )
1188 {
1189 wxFileName fileName = Schematic().RootScreen()->GetFileName();
1190 wxString msg = _( "Save changes to '%s' before closing?" );
1191
1192 if( !HandleUnsavedChanges( this, wxString::Format( msg, fileName.GetFullName() ),
1193 [&]() -> bool
1194 {
1195 return SaveProject();
1196 } ) )
1197 {
1198 return false;
1199 }
1200
1201 // If user selected 'No' (discard), create duplicate commit of last saved state and
1202 // move Last_Save tag forward so history shows an explicit discard event.
1203 if( GetLastUnsavedChangesResponse() == wxID_NO )
1204 {
1205 wxString projPath = Prj().GetProjectPath();
1206
1207 if( !projPath.IsEmpty() && Kiway().LocalHistory().HistoryExists( projPath ) )
1208 {
1209 Kiway().LocalHistory().CommitDuplicateOfLastSave( projPath, wxS( "Schematic" ),
1210 wxS( "Discard unsaved schematic changes" ) );
1211 }
1212 }
1213 }
1214
1215 return true;
1216}
1217
1218
1220{
1221 // Unregister the autosave saver before any cleanup that might invalidate m_schematic
1222 if( m_schematic )
1224
1226
1227 SCH_SHEET_LIST sheetlist = Schematic().Hierarchy();
1228
1229#ifdef KICAD_IPC_API
1230 Pgm().GetApiServer().DeregisterHandler( m_apiHandler.get() );
1231 wxTheApp->Unbind( EDA_EVT_PLUGIN_AVAILABILITY_CHANGED, &SCH_EDIT_FRAME::onPluginAvailabilityChanged, this );
1232#endif
1233
1234 // Close modeless dialogs. They're trouble when they get destroyed after the frame.
1235 Unbind( EDA_EVT_CLOSE_DIALOG_BOOK_REPORTER, &SCH_EDIT_FRAME::onCloseSymbolDiffDialog, this );
1236 Unbind( EDA_EVT_CLOSE_ERC_DIALOG, &SCH_EDIT_FRAME::onCloseErcDialog, this );
1237 Unbind( EDA_EVT_CLOSE_DIALOG_SYMBOL_FIELDS_TABLE, &SCH_EDIT_FRAME::onCloseSymbolFieldsTableDialog, this );
1238 m_netNavigator->Unbind( wxEVT_TREE_SEL_CHANGING, &SCH_EDIT_FRAME::onNetNavigatorSelChanging, this );
1239 m_netNavigator->Unbind( wxEVT_TREE_SEL_CHANGED, &SCH_EDIT_FRAME::onNetNavigatorSelection, this );
1240
1241 if( m_diffSymbolDialog )
1242 {
1243 m_diffSymbolDialog->Destroy();
1244 m_diffSymbolDialog = nullptr;
1245 }
1246
1247 if( m_ercDialog )
1248 {
1249 m_ercDialog->Destroy();
1250 m_ercDialog = nullptr;
1251 }
1252
1254 {
1255 m_symbolFieldsTableDialog->Destroy();
1256 m_symbolFieldsTableDialog = nullptr;
1257 }
1258
1259 // Make sure local settings are persisted
1260 if( Prj().GetLocalSettings().ShouldAutoSave() )
1262
1263 delete m_toolManager;
1264 m_toolManager = nullptr;
1265
1266 wxAuiPaneInfo& hierarchy_pane = m_auimgr.GetPane( SchematicHierarchyPaneName() );
1267
1268 if( hierarchy_pane.IsShown() && hierarchy_pane.IsFloating() )
1269 {
1270 hierarchy_pane.Show( false );
1271 m_auimgr.Update();
1272 }
1273
1274 sheetlist.ClearModifyStatus();
1275
1276 wxString fileName = Prj().AbsolutePath( Schematic().RootScreen()->GetFileName() );
1277
1278 if( !Schematic().GetFileName().IsEmpty() && !Schematic().RootScreen()->IsEmpty() )
1279 UpdateFileHistory( fileName );
1280
1281 // Clear the view before freeing any schematic items. VIEW::Clear() walks m_allItems and
1282 // touches each item's private data, so the items must still be alive when this runs.
1283 SetScreen( nullptr );
1284
1285 Schematic().RootScreen()->Clear( true );
1286
1287 // all sub sheets are deleted, only the main sheet is usable
1289
1290 Schematic().Reset();
1291
1292 // Prevents any rogue events from continuing (i.e. search panel tries to redraw)
1293 Show( false );
1294
1295 Destroy();
1296}
1297
1298
1300{
1301 m_searchPane->FocusSearch();
1302}
1303
1304
1306{
1307 return Schematic().ErcSettings().GetSeverity( aErrorCode );
1308}
1309
1310
1312{
1314
1315 if( GetScreen() )
1316 {
1318 Kiway().LocalHistory().NoteFileChange( GetScreen()->GetFileName() );
1319 }
1320
1321 if( m_isClosing )
1322 return;
1323
1324 if( GetCanvas() )
1325 GetCanvas()->Refresh();
1326
1327 if( GetScreen() && !GetTitle().StartsWith( wxS( "*" ) ) )
1328 updateTitle();
1329}
1330
1331
1333{
1334 if( Kiface().IsSingle() )
1335 {
1336 DisplayError( this, _( "Cannot update the PCB because the Schematic Editor is opened in stand-alone "
1337 "mode. In order to create/update PCBs from schematics, launch the main KiCad "
1338 "application and create a project." ) );
1339 return;
1340 }
1341
1342 KIWAY_PLAYER* frame = Kiway().Player( FRAME_PCB_EDITOR, false );
1343 wxEventBlocker blocker( this );
1344
1345 if( !frame )
1346 {
1347 wxFileName fn = Prj().GetProjectFullName();
1348 fn.SetExt( FILEEXT::PcbFileExtension );
1349
1350 frame = Kiway().Player( FRAME_PCB_EDITOR, true );
1351
1352 // If Kiway() cannot create the Pcbnew frame, it shows a error message, and
1353 // frame is null
1354 if( !frame )
1355 return;
1356
1357 frame->OpenProjectFiles( std::vector<wxString>( 1, fn.GetFullPath() ) );
1358 }
1359
1360 if( !frame->IsVisible() )
1361 frame->Show( true );
1362
1363 // On Windows, Raise() does not bring the window on screen, when iconized
1364 if( frame->IsIconized() )
1365 frame->Iconize( false );
1366
1367 frame->Raise();
1368
1369 std::string payload;
1371}
1372
1373
1374void SCH_EDIT_FRAME::UpdateHierarchyNavigator( bool aRefreshNetNavigator, bool aClear )
1375{
1376 m_toolManager->GetTool<SCH_NAVIGATE_TOOL>()->CleanHistory();
1377 m_hierarchy->UpdateHierarchyTree( aClear );
1378
1379 if( aRefreshNetNavigator )
1381}
1382
1383
1385{
1386 // Update only the hierarchy navigation tree labels.
1387 // The tree list is expected to be up to date
1388 m_hierarchy->UpdateLabelsHierarchyTree();
1389}
1390
1391
1393{
1394 m_hierarchy->UpdateHierarchySelection();
1395}
1396
1397
1398void SCH_EDIT_FRAME::OnLoadFile( wxCommandEvent& event )
1399{
1400 wxString filename = GetFileFromHistory( event.GetId(), _( "Schematic" ) );
1401
1402 if( !filename.IsEmpty() )
1403 OpenProjectFiles( std::vector<wxString>( 1, filename ) );
1404}
1405
1406
1407void SCH_EDIT_FRAME::OnClearFileHistory( wxCommandEvent& aEvent )
1408{
1410}
1411
1412
1414{
1415 // Only standalone mode can directly load a new document
1416 if( !Kiface().IsSingle() )
1417 return;
1418
1419 wxString pro_dir = m_mruPath;
1420
1421 wxFileDialog dlg( this, _( "New Schematic" ), pro_dir, wxEmptyString, FILEEXT::KiCadSchematicFileWildcard(),
1422 wxFD_SAVE );
1423
1425
1426 if( dlg.ShowModal() != wxID_CANCEL )
1427 {
1428 // Enforce the extension, wxFileDialog is inept.
1429 wxFileName create_me = EnsureFileExtension( dlg.GetPath(), FILEEXT::KiCadSchematicFileExtension );
1430
1431 if( create_me.FileExists() )
1432 {
1433 wxString msg;
1434 msg.Printf( _( "Schematic file '%s' already exists." ), create_me.GetFullName() );
1435 DisplayError( this, msg );
1436 return ;
1437 }
1438
1439 // OpenProjectFiles() requires absolute
1440 wxASSERT_MSG( create_me.IsAbsolute(), wxS( "wxFileDialog returned non-absolute path" ) );
1441
1442 OpenProjectFiles( std::vector<wxString>( 1, create_me.GetFullPath() ), KICTL_CREATE );
1443 m_mruPath = create_me.GetPath();
1444 }
1445}
1446
1447
1449{
1450 // Only standalone mode can directly load a new document
1451 if( !Kiface().IsSingle() )
1452 return;
1453
1454 wxString pro_dir = m_mruPath;
1455 wxString wildcards = FILEEXT::AllSchematicFilesWildcard()
1457 + wxS( "|" ) + FILEEXT::LegacySchematicFileWildcard();
1458
1459 wxFileDialog dlg( this, _( "Open Schematic" ), pro_dir, wxEmptyString, wildcards,
1460 wxFD_OPEN | wxFD_FILE_MUST_EXIST );
1461
1463
1464 if( dlg.ShowModal() != wxID_CANCEL )
1465 {
1466 OpenProjectFiles( std::vector<wxString>( 1, dlg.GetPath() ) );
1468 }
1469
1470 // Since we know we're single-top here: trigger library reload
1471 CallAfter(
1472 [&]()
1473 {
1474 KIFACE *schface = Kiway().KiFACE( KIWAY::FACE_SCH );
1475 schface->PreloadLibraries( &Kiway() );
1476
1478 } );
1479}
1480
1481
1483{
1485
1486 // Register schematic saver for autosave history
1488 [this]( const wxString& aProjectPath, std::vector<HISTORY_FILE_DATA>& aFileData )
1489 {
1490 m_schematic->SaveToHistory( aProjectPath, aFileData );
1491 } );
1492
1493 m_designBlocksPane->ProjectChanged();
1494}
1495
1496
1498{
1499 wxFileName kicad_board = Prj().AbsolutePath( Schematic().GetFileName() );
1500
1501 if( kicad_board.IsOk() && !Schematic().GetFileName().IsEmpty() )
1502 {
1503 kicad_board.SetExt( FILEEXT::PcbFileExtension );
1504 wxFileName legacy_board( kicad_board );
1505 legacy_board.SetExt( FILEEXT::LegacyPcbFileExtension );
1506 wxFileName& boardfn = legacy_board;
1507
1508 if( !legacy_board.FileExists() || kicad_board.FileExists() )
1509 boardfn = kicad_board;
1510
1511 if( Kiface().IsSingle() )
1512 {
1513 ExecuteFile( PCBNEW_EXE, boardfn.GetFullPath() );
1514 }
1515 else
1516 {
1517 wxEventBlocker blocker(this);
1518 KIWAY_PLAYER* frame = Kiway().Player( FRAME_PCB_EDITOR, false );
1519
1520 if( !frame )
1521 {
1522 frame = Kiway().Player( FRAME_PCB_EDITOR, true );
1523
1524 // frame can be null if Cvpcb cannot be run. No need to show a warning
1525 // Kiway() generates the error messages
1526 if( !frame )
1527 return;
1528
1529 frame->OpenProjectFiles( std::vector<wxString>( 1, boardfn.GetFullPath() ) );
1530 }
1531
1532 if( !frame->IsVisible() )
1533 frame->Show( true );
1534
1535 // On Windows, Raise() does not bring the window on screen, when iconized
1536 if( frame->IsIconized() )
1537 frame->Iconize( false );
1538
1539 frame->Raise();
1540 }
1541 }
1542 else
1543 {
1545 }
1546}
1547
1548
1550{
1551 wxFileName fn = Prj().AbsolutePath( Schematic().GetFileName() );
1552 fn.SetExt( FILEEXT::NetlistFileExtension );
1553
1554 if( !ReadyToNetlist( _( "Assigning footprints requires a fully annotated schematic." ) ) )
1555 return;
1556
1557 try
1558 {
1559 KIWAY_PLAYER* player = Kiway().Player( FRAME_CVPCB, false ); // test open already.
1560
1561 if( !player )
1562 {
1563 player = Kiway().Player( FRAME_CVPCB, true );
1564
1565 // player can be null if Cvpcb cannot be run. No need to show a warning
1566 // Kiway() generates the error messages
1567 if( !player )
1568 return;
1569
1570 player->Show( true );
1571 }
1572
1573 // Ensure the netlist (mainly info about symbols) is up to date
1576
1577 player->Raise();
1578 }
1579 catch( const IO_ERROR& )
1580 {
1581 DisplayError( this, _( "Could not open CvPcb" ) );
1582 }
1583}
1584
1585
1586void SCH_EDIT_FRAME::OnExit( wxCommandEvent& event )
1587{
1588 if( event.GetId() == wxID_EXIT )
1589 Kiway().OnKiCadExit();
1590
1591 if( event.GetId() == wxID_CLOSE || Kiface().IsSingle() )
1592 Close( false );
1593}
1594
1595
1597{
1598 SCHEMATIC_SETTINGS& settings = m_schematic->Settings();
1599 SIM_LIB_MGR simLibMgr( &Prj() );
1600 NULL_REPORTER devnull;
1601 SCH_SHEET_PATH& sheetPath = GetCurrentSheet();
1602 wxString variant = m_schematic->GetCurrentVariant();
1603
1604 // Patch for bug early in V7.99 dev
1605 if( settings.m_OPO_VRange.EndsWith( 'A' ) )
1606 settings.m_OPO_VRange[ settings.m_OPO_VRange.Length() - 1 ] = 'V';
1607
1608 // Update items which may have ${OP} text variables
1609 //
1611 [&]( KIGFX::VIEW_ITEM* aItem ) -> int
1612 {
1613 int flags = 0;
1614
1615 auto invalidateTextVars =
1616 [&flags]( EDA_TEXT* text )
1617 {
1618 if( text->HasTextVars() )
1619 {
1620 text->ClearRenderCache();
1621 text->ClearBoundingBoxCache();
1623 }
1624 };
1625
1626 if( SCH_ITEM* item = dynamic_cast<SCH_ITEM*>( aItem ) )
1627 {
1628 item->RunOnChildren(
1629 [&invalidateTextVars]( SCH_ITEM* aChild )
1630 {
1631 if( EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( aChild ) )
1632 invalidateTextVars( text );
1633 },
1635 }
1636
1637 if( EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( aItem ) )
1638 invalidateTextVars( text );
1639
1640 return flags;
1641 } );
1642
1643 // Update OP overlay items
1644 //
1645 for( SCH_ITEM* item : GetScreen()->Items() )
1646 {
1647 if( sheetPath.GetExcludedFromSim( variant ) )
1648 continue;
1649
1650 if( item->Type() == SCH_LINE_T )
1651 {
1652 SCH_LINE* line = static_cast<SCH_LINE*>( item );
1653
1654 if( !line->GetOperatingPoint().IsEmpty() )
1655 GetCanvas()->GetView()->Update( line );
1656
1657 line->SetOperatingPoint( wxEmptyString );
1658
1659 // update value from netlist, below
1660 }
1661 else if( item->Type() == SCH_SYMBOL_T )
1662 {
1663 SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( item );
1664 wxString ref = symbol->GetRef( &sheetPath );
1665 std::vector<SCH_PIN*> pins = symbol->GetPins( &sheetPath );
1666
1667 // Power symbols and other symbols which have the reference starting with "#" are
1668 // not included in simulation
1669 if( ref.StartsWith( '#' ) || symbol->ResolveExcludedFromSim( &sheetPath, variant ) )
1670 continue;
1671
1672 for( SCH_PIN* pin : pins )
1673 {
1674 if( !pin->GetOperatingPoint().IsEmpty() )
1675 GetCanvas()->GetView()->Update( pin );
1676
1677 pin->SetOperatingPoint( wxEmptyString );
1678 }
1679
1680 if( pins.size() == 2 )
1681 {
1682 wxString op = m_schematic->GetOperatingPoint( ref, settings.m_OPO_IPrecision, settings.m_OPO_IRange );
1683
1684 if( !op.IsEmpty() && op != wxS( "--" ) && op != wxS( "?" ) )
1685 {
1686 pins[0]->SetOperatingPoint( op );
1687 GetCanvas()->GetView()->Update( symbol );
1688 }
1689 }
1690 else
1691 {
1692 std::vector<EMBEDDED_FILES*> embeddedFilesStack;
1693 embeddedFilesStack.push_back( m_schematic->GetEmbeddedFiles() );
1694
1695 if( EMBEDDED_FILES* symbolEmbeddedFiles = symbol->GetEmbeddedFiles() )
1696 {
1697 embeddedFilesStack.push_back( symbolEmbeddedFiles );
1698 symbol->GetLibSymbolRef()->AppendParentEmbeddedFiles( embeddedFilesStack );
1699 }
1700
1701 simLibMgr.SetFilesStack( std::move( embeddedFilesStack ) );
1702
1703 SIM_MODEL& model = simLibMgr.CreateModel( &sheetPath, *symbol, true, 0, variant, devnull ).model;
1704
1705 SPICE_ITEM spiceItem;
1706 spiceItem.refName = ref;
1707 ref = model.SpiceGenerator().ItemName( spiceItem );
1708
1709 for( const auto& modelPin : model.GetPins() )
1710 {
1711 SCH_PIN* symbolPin = symbol->GetPin( modelPin.get().symbolPinNumber );
1712 wxString signalName = ref + wxS( ":" ) + modelPin.get().modelPinName;
1713 wxString op = m_schematic->GetOperatingPoint( signalName, settings.m_OPO_IPrecision,
1714 settings.m_OPO_IRange );
1715
1716 if( symbolPin && !op.IsEmpty() && op != wxS( "--" ) && op != wxS( "?" ) )
1717 {
1718 symbolPin->SetOperatingPoint( op );
1719 GetCanvas()->GetView()->Update( symbol );
1720 }
1721 }
1722 }
1723 }
1724 }
1725
1726 for( const auto& [ key, subgraphList ] : m_schematic->m_connectionGraph->GetNetMap() )
1727 {
1728 wxString op = m_schematic->GetOperatingPoint( key.Name, settings.m_OPO_VPrecision, settings.m_OPO_VRange );
1729
1730 if( !op.IsEmpty() && op != wxS( "--" ) && op != wxS( "?" ) )
1731 {
1732 for( CONNECTION_SUBGRAPH* subgraph : subgraphList )
1733 {
1734 SCH_LINE* longestWire = nullptr;
1735 double length = 0.0;
1736
1737 if( subgraph->GetSheet().GetExcludedFromSim( variant ) )
1738 continue;
1739
1740 for( SCH_ITEM* item : subgraph->GetItems() )
1741 {
1742 if( item->Type() == SCH_LINE_T )
1743 {
1744 SCH_LINE* line = static_cast<SCH_LINE*>( item );
1745
1746 if( line->IsWire() && line->GetLength() > length )
1747 {
1748 longestWire = line;
1749 length = line->GetLength();
1750 }
1751 }
1752 }
1753
1754 if( longestWire )
1755 {
1756 longestWire->SetOperatingPoint( op );
1757 GetCanvas()->GetView()->Update( longestWire );
1758 }
1759 }
1760 }
1761 }
1762}
1763
1764
1766{
1767 if( aItem->Type() == SCH_GLOBAL_LABEL_T || aItem->Type() == SCH_HIER_LABEL_T )
1768 {
1769 SCH_LABEL_BASE* label = static_cast<SCH_LABEL_BASE*>( aItem );
1770
1771 if( label->AutoRotateOnPlacement() )
1772 {
1773 SPIN_STYLE spin = aScreen->GetLabelOrientationForPoint( label->GetPosition(), label->GetSpinStyle(),
1774 &GetCurrentSheet() );
1775
1776 if( spin != label->GetSpinStyle() )
1777 {
1778 label->SetSpinStyle( spin );
1779
1780 for( SCH_ITEM* item : aScreen->Items().OfType( SCH_GLOBAL_LABEL_T ) )
1781 {
1782 SCH_LABEL_BASE* otherLabel = static_cast<SCH_LABEL_BASE*>( item );
1783
1784 if( otherLabel != label && otherLabel->GetText() == label->GetText() )
1785 otherLabel->AutoplaceFields( aScreen, AUTOPLACE_AUTO );
1786 }
1787 }
1788 }
1789 }
1790}
1791
1792
1794{
1795 SCH_SCREEN* screen = GetScreen();
1796
1797 wxCHECK( screen, /* void */ );
1798
1799 wxString title;
1800
1801 if( !screen->GetFileName().IsEmpty() )
1802 {
1803 wxFileName fn( Prj().AbsolutePath( screen->GetFileName() ) );
1804 bool readOnly = false;
1805 bool unsaved = false;
1806
1807 if( fn.IsOk() && screen->FileExists() )
1808 readOnly = screen->IsReadOnly();
1809 else
1810 unsaved = true;
1811
1812 if( IsContentModified() )
1813 title = wxT( "*" );
1814
1815 title += fn.GetName();
1816
1817 wxString sheetPath = GetCurrentSheet().PathHumanReadable( false, true );
1818
1819 if( sheetPath != fn.GetName() )
1820 title += wxString::Format( wxT( " [%s]" ), sheetPath );
1821
1822 if( readOnly )
1823 title += wxS( " " ) + _( "[Read Only]" );
1824
1825 if( unsaved )
1826 title += wxS( " " ) + _( "[Unsaved]" );
1827 }
1828 else
1829 {
1830 title = _( "[no schematic loaded]" );
1831 }
1832
1833 title += wxT( " \u2014 " ) + _( "Schematic Editor" );
1834
1835 SetTitle( title );
1836}
1837
1838
1840{
1842
1843 if( GetScreen() )
1844 GetScreen()->m_zoomInitialized = true;
1845}
1846
1847
1849 PROGRESS_REPORTER* aProgressReporter )
1850{
1851 wxString highlightedConn = GetHighlightedConnection();
1852 bool hasHighlightedConn = !highlightedConn.IsEmpty();
1853
1854 std::function<void( SCH_ITEM* )> changeHandler =
1855 [&]( SCH_ITEM* aChangedItem ) -> void
1856 {
1857 GetCanvas()->GetView()->Update( aChangedItem, KIGFX::REPAINT );
1858
1859 SCH_CONNECTION* connection = aChangedItem->Connection();
1860
1862 return;
1863
1864 if( !hasHighlightedConn )
1865 {
1866 // No highlighted connection, but connectivity has changed, so refresh
1867 // the list of all nets
1869 }
1870 else if( connection && ( connection->Name() == highlightedConn
1871 || connection->HasDriverChanged() ) )
1872 {
1874 }
1875 };
1876
1877 Schematic().RecalculateConnections( aCommit, aCleanupFlags,
1879 aProgressReporter,
1880 GetCanvas()->GetView(),
1881 &changeHandler,
1882 m_undoList.m_CommandsList.empty() ? nullptr
1883 : m_undoList.m_CommandsList.back() );
1884
1886 [&]( KIGFX::VIEW_ITEM* aItem ) -> int
1887 {
1888 int flags = 0;
1889 SCH_ITEM* item = dynamic_cast<SCH_ITEM*>( aItem );
1890 SCH_CONNECTION* connection = item ? item->Connection() : nullptr;
1891
1892 auto invalidateTextVars =
1893 [&flags]( EDA_TEXT* text )
1894 {
1895 if( text->HasTextVars() )
1896 {
1897 text->ClearRenderCache();
1898 text->ClearBoundingBoxCache();
1900 }
1901 };
1902
1903 if( connection && connection->HasDriverChanged() )
1904 {
1905 connection->ClearDriverChanged();
1906 flags |= KIGFX::REPAINT;
1907 }
1908
1909 if( item )
1910 {
1911 item->RunOnChildren(
1912 [&invalidateTextVars]( SCH_ITEM* aChild )
1913 {
1914 if( EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( aChild ) )
1915 invalidateTextVars( text );
1916 },
1918
1919 if( flags & KIGFX::GEOMETRY )
1920 GetScreen()->Update( item, false ); // Refresh RTree
1921 }
1922
1923 if( EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( aItem ) )
1924 invalidateTextVars( text );
1925
1926 return flags;
1927 } );
1928
1930 || !Schematic().ConnectionGraph()->FindFirstSubgraphByName( highlightedConn ) )
1931 {
1935 }
1936}
1937
1938
1943
1944
1946{
1947 GetCanvas()->GetView()->Update( aItem );
1948}
1949
1950
1957
1958
1959std::unique_ptr<GRID_HELPER> SCH_EDIT_FRAME::MakeGridHelper()
1960{
1961 return std::make_unique<EE_GRID_HELPER>( m_toolManager );
1962}
1963
1964
1966{
1968
1969 SCHEMATIC_SETTINGS& settings = Schematic().Settings();
1970
1972
1973 if( EESCHEMA_SETTINGS* cfg = GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" ) )
1974 {
1975 GetGalDisplayOptions().ReadWindowSettings( cfg->m_Window );
1976 GetRenderSettings()->SetDefaultFont( cfg->m_Appearance.default_font );
1977
1978 KIGFX::VIEW* view = GetCanvas()->GetView();
1979 view->SetLayerVisible( LAYER_ERC_ERR, cfg->m_Appearance.show_erc_errors );
1980 view->SetLayerVisible( LAYER_ERC_WARN, cfg->m_Appearance.show_erc_warnings );
1981 view->SetLayerVisible( LAYER_ERC_EXCLUSION, cfg->m_Appearance.show_erc_exclusions );
1982 view->SetLayerVisible( LAYER_OP_VOLTAGES, cfg->m_Appearance.show_op_voltages );
1983 view->SetLayerVisible( LAYER_OP_CURRENTS, cfg->m_Appearance.show_op_currents );
1984
1985 GetRenderSettings()->m_ShowPinAltIcons = cfg->m_Appearance.show_pin_alt_icons;
1986
1988
1989 settings.m_TemplateFieldNames.DeleteAllFieldNameTemplates( true /* global */ );
1990
1991 if( !cfg->m_Drawing.field_names.IsEmpty() )
1992 settings.m_TemplateFieldNames.AddTemplateFieldNames( cfg->m_Drawing.field_names );
1993 }
1994
1996
1997 for( SCH_ITEM* item : screen->Items() )
1998 {
1999 item->ClearCaches();
2000
2001 if( item->Type() == SCH_LINE_T )
2002 {
2003 SCH_LINE* line = static_cast<SCH_LINE*>( item );
2004
2005 if( line->IsWire() || line->IsBus() )
2006 UpdateHopOveredWires( line );
2007 }
2008 }
2009
2010 for( const auto& [ libItemName, libSymbol ] : screen->GetLibSymbols() )
2011 libSymbol->ClearCaches();
2012
2014
2016 Layout();
2017 SendSizeEvent();
2018}
2019
2020
2022{
2023 // Store the current zoom level into the current screen before calling
2024 // DisplayCurrentSheet() that set the zoom to GetScreen()->m_LastZoomLevel
2026
2027 // Rebuild the sheet view (draw area and any other items):
2029}
2030
2031
2033{
2034 // call my base class
2036
2037 // tooltips in toolbars
2039
2040 // For some obscure reason, the AUI manager hides the first modified pane.
2041 // So force show panes
2042 wxAuiPaneInfo& design_blocks_pane_info = m_auimgr.GetPane( m_designBlocksPane );
2043 bool panel_shown = design_blocks_pane_info.IsShown();
2044 design_blocks_pane_info.Caption( _( "Design Blocks" ) );
2045 design_blocks_pane_info.Show( panel_shown );
2046
2047 m_auimgr.GetPane( m_hierarchy ).Caption( _( "Schematic Hierarchy" ) );
2048 m_auimgr.GetPane( m_selectionFilterPanel ).Caption( _( "Selection Filter" ) );
2049 m_auimgr.GetPane( m_propertiesPanel ).Caption( _( "Properties" ) );
2050 m_auimgr.GetPane( m_designBlocksPane ).Caption( _( "Design Blocks" ) );
2051 m_auimgr.GetPane( RemoteSymbolPaneName() ).Caption( _( "Remote Symbols" ) );
2052 m_auimgr.Update();
2053 m_hierarchy->UpdateHierarchyTree();
2054
2055 // status bar
2057
2058 updateTitle();
2059
2060 // This ugly hack is to fix an option(left) toolbar update bug that seems to only affect
2061 // windows. See https://bugs.launchpad.net/kicad/+bug/1816492. For some reason, calling
2062 // wxWindow::Refresh() does not resolve the issue. Only a resize event seems to force the
2063 // toolbar to update correctly.
2064#if defined( __WXMSW__ )
2065 PostSizeEvent();
2066#endif
2067}
2068
2069
2071{
2072 if( !GetHighlightedConnection().IsEmpty() )
2073 {
2074 SetStatusText( wxString::Format( _( "Highlighted net: %s" ),
2076 }
2077 else
2078 {
2079 SetStatusText( wxT( "" ) );
2080 }
2081}
2082
2083
2085{
2086 if( m_toolManager )
2088
2089 SCH_BASE_FRAME::SetScreen( aScreen );
2090 GetCanvas()->DisplaySheet( static_cast<SCH_SCREEN*>( aScreen ) );
2091
2092 if( m_toolManager )
2094}
2095
2096
2097const BOX2I SCH_EDIT_FRAME::GetDocumentExtents( bool aIncludeAllVisible ) const
2098{
2099 BOX2I bBoxDoc;
2100
2101 if( !GetScreen() )
2102 return bBoxDoc;
2103
2104 if( aIncludeAllVisible )
2105 {
2106 // Get the whole page size and return that
2107 int sizeX = GetScreen()->GetPageSettings().GetWidthIU( schIUScale.IU_PER_MILS );
2108 int sizeY = GetScreen()->GetPageSettings().GetHeightIU( schIUScale.IU_PER_MILS );
2109 bBoxDoc = BOX2I( VECTOR2I( 0, 0 ), VECTOR2I( sizeX, sizeY ) );
2110 }
2111 else
2112 {
2113 // Get current drawing-sheet in a form we can compare to an EDA_ITEM
2115 EDA_ITEM* dsAsItem = static_cast<EDA_ITEM*>( ds );
2116
2117 // Calc the bounding box of all items on screen except the page border
2118 for( EDA_ITEM* item : GetScreen()->Items() )
2119 {
2120 if( item != dsAsItem ) // Ignore the drawing-sheet itself
2121 bBoxDoc.Merge( item->GetBoundingBox() );
2122 }
2123 }
2124
2125 return bBoxDoc;
2126}
2127
2128
2130{
2131 if( !Schematic().HasHierarchy() )
2132 return false;
2133
2134 return Schematic().Hierarchy().IsModified();
2135}
2136
2137
2139{
2140 EESCHEMA_SETTINGS* cfg = eeconfig();
2141 return cfg && cfg->m_Appearance.show_hidden_pins;
2142}
2143
2144
2145void SCH_EDIT_FRAME::FocusOnItem( EDA_ITEM* aItem, bool aAllowScroll )
2146{
2147 // nullptr will clear the current focus
2148 if( aItem != nullptr && !aItem->IsSCH_ITEM() )
2149 return;
2150
2151 static KIID lastBrightenedItemID( niluuid );
2152
2153 SCH_ITEM* lastItem = Schematic().ResolveItem( lastBrightenedItemID, nullptr, true );
2154
2155 if( lastItem && lastItem != aItem )
2156 {
2157 lastItem->ClearBrightened();
2158
2159 UpdateItem( lastItem );
2160 lastBrightenedItemID = niluuid;
2161 }
2162
2163 if( aItem )
2164 {
2165 if( !aItem->IsBrightened() )
2166 {
2167 aItem->SetBrightened();
2168
2169 UpdateItem( aItem );
2170 lastBrightenedItemID = aItem->m_Uuid;
2171 }
2172
2173 FocusOnLocation( aItem->GetFocusPosition(), aAllowScroll );
2174 }
2175}
2176
2177
2179{
2180 return Schematic().GetFileName();
2181}
2182
2183
2185{
2186 return m_toolManager->GetTool<SCH_SELECTION_TOOL>()->GetSelection();
2187}
2188
2189void SCH_EDIT_FRAME::onSize( wxSizeEvent& aEvent )
2190{
2191 if( IsShown() )
2192 {
2193 // We only need this until the frame is done resizing and the final client size is
2194 // established.
2195 Unbind( wxEVT_SIZE, &SCH_EDIT_FRAME::onSize, this );
2197 }
2198
2199 // Skip() is called in the base class.
2200 EDA_DRAW_FRAME::OnSize( aEvent );
2201}
2202
2203
2205 const KIID& aSchematicSymbolUUID )
2206{
2207 SCH_SHEET_PATH principalPath;
2208 SCH_SHEET_LIST sheets = Schematic().Hierarchy();
2209 SCH_ITEM* item = sheets.ResolveItem( aSchematicSymbolUUID, &principalPath, true );
2210 SCH_SYMBOL* principalSymbol = dynamic_cast<SCH_SYMBOL*>( item );
2211 SCH_COMMIT commit( m_toolManager );
2212
2213 if( !principalSymbol )
2214 return;
2215
2216 wxString principalRef;
2217
2218 if( principalSymbol->IsAnnotated( &principalPath ) )
2219 principalRef = principalSymbol->GetRef( &principalPath, false );
2220
2221 std::vector< std::pair<SCH_SYMBOL*, SCH_SHEET_PATH> > allUnits;
2222
2223 for( const SCH_SHEET_PATH& path : sheets )
2224 {
2225 for( SCH_ITEM* candidate : path.LastScreen()->Items().OfType( SCH_SYMBOL_T ) )
2226 {
2227 SCH_SYMBOL* candidateSymbol = static_cast<SCH_SYMBOL*>( candidate );
2228
2229 if( candidateSymbol == principalSymbol
2230 || ( candidateSymbol->IsAnnotated( &path )
2231 && candidateSymbol->GetRef( &path, false ) == principalRef ) )
2232 {
2233 allUnits.emplace_back( candidateSymbol, path );
2234 }
2235 }
2236 }
2237
2238 for( auto& [ unit, path ] : allUnits )
2239 {
2240 // This needs to be done before the LIB_SYMBOL is changed to prevent stale
2241 // library symbols in the schematic file.
2242 path.LastScreen()->Remove( unit );
2243
2244 if( !unit->IsNew() )
2245 commit.Modify( unit, path.LastScreen() );
2246
2247 unit->SetLibSymbol( aSymbol.Flatten().release() );
2248 unit->UpdateFields( &GetCurrentSheet(),
2249 true, /* update style */
2250 true, /* update ref */
2251 true, /* update other fields */
2252 false, /* reset ref */
2253 false /* reset other fields */ );
2254
2255 path.LastScreen()->Append( unit );
2256 GetCanvas()->GetView()->Update( unit );
2257 }
2258
2259 // Clear any orphaned alternate pins.
2260 for( SCH_PIN* pin : principalSymbol->GetPins() )
2261 {
2262 wxString altName = pin->GetAlt();
2263
2264 if( altName.IsEmpty() )
2265 continue;
2266
2267 if( pin->GetAlternates().count( altName ) == 0 )
2268 pin->SetAlt( wxEmptyString );
2269 }
2270
2271 if( !commit.Empty() )
2272 commit.Push( _( "Save Symbol to Schematic" ) );
2273}
2274
2275
2276void SCH_EDIT_FRAME::UpdateItem( EDA_ITEM* aItem, bool isAddOrDelete, bool aUpdateRtree )
2277{
2278 SCH_BASE_FRAME::UpdateItem( aItem, isAddOrDelete, aUpdateRtree );
2279
2280 if( SCH_ITEM* sch_item = dynamic_cast<SCH_ITEM*>( aItem ) )
2281 sch_item->ClearCaches();
2282}
2283
2284
2286{
2287 wxCHECK( m_toolManager, /* void */ );
2288
2292
2293 wxCHECK( screen, /* void */ );
2294
2296
2297 SCH_BASE_FRAME::SetScreen( screen );
2298
2299 SetSheetNumberAndCount(); // will also update CurrentScreen()'s sheet number info
2300
2302
2303 // update the references, units, and intersheet-refs
2305
2306 // dangling state can also have changed if different units with different pin locations are
2307 // used
2310
2311 SCH_SELECTION_TOOL* selectionTool = m_toolManager->GetTool<SCH_SELECTION_TOOL>();
2312
2313 wxCHECK( selectionTool, /* void */ );
2314
2315 auto visit =
2316 [&]( EDA_ITEM* item )
2317 {
2319 && !m_findReplaceData->findString.IsEmpty()
2320 && item->Matches( *m_findReplaceData, &GetCurrentSheet() ) )
2321 {
2322 item->SetForceVisible( true );
2323 selectionTool->BrightenItem( item );
2324 }
2325 else if( item->IsBrightened() )
2326 {
2327 item->SetForceVisible( false );
2328 selectionTool->UnbrightenItem( item );
2329 }
2330 };
2331
2332 for( SCH_ITEM* item : screen->Items() )
2333 {
2334 visit( item );
2335
2336 item->RunOnChildren(
2337 [&]( SCH_ITEM* aChild )
2338 {
2339 visit( aChild );
2340 },
2342 }
2343
2344 if( !screen->m_zoomInitialized )
2345 {
2347 }
2348 else
2349 {
2350 // Set zoom to last used in this screen
2351 GetCanvas()->GetView()->SetScale( GetScreen()->m_LastZoomLevel );
2352 GetCanvas()->GetView()->SetCenter( GetScreen()->m_ScrollCenter );
2353 }
2354
2355 updateTitle();
2356
2357 HardRedraw(); // Ensure all items are redrawn (especially the drawing-sheet items)
2358
2359 // Allow tools to re-add their VIEW_ITEMs after the last call to Clear in HardRedraw
2361
2362 SCH_EDITOR_CONTROL* editTool = m_toolManager->GetTool<SCH_EDITOR_CONTROL>();
2363
2364 wxCHECK( editTool, /* void */ );
2365
2367 editTool->UpdateNetHighlighting( dummy );
2368
2369 m_hierarchy->UpdateHierarchySelection();
2370
2371 m_schematic->OnSchSheetChanged();
2372}
2373
2374
2376{
2377 if( !m_diffSymbolDialog )
2378 {
2380 _( "Compare Symbol with Library" ) );
2381
2382 m_diffSymbolDialog->m_sdbSizerApply->SetLabel( _( "Update Symbol from Library..." ) );
2383 m_diffSymbolDialog->m_sdbSizerApply->PostSizeEventToParent();
2384 m_diffSymbolDialog->m_sdbSizerApply->Show();
2385 }
2386
2387 return m_diffSymbolDialog;
2388}
2389
2390
2391void SCH_EDIT_FRAME::onCloseSymbolDiffDialog( wxCommandEvent& aEvent )
2392{
2393 if( m_diffSymbolDialog && aEvent.GetString() == DIFF_SYMBOLS_DIALOG_NAME )
2394 {
2395 if( aEvent.GetId() == wxID_APPLY )
2396 {
2397 KIID symbolUUID = m_diffSymbolDialog->GetUserItemID();
2398
2399 CallAfter(
2400 [this, symbolUUID]()
2401 {
2402 EDA_ITEM* item = ResolveItem( symbolUUID );
2403
2404 if( SCH_SYMBOL* symbol = dynamic_cast<SCH_SYMBOL*>( item ) )
2405 {
2406 m_toolManager->RunAction<EDA_ITEM*>( ACTIONS::selectItem, symbol );
2407
2409 dlg.ShowQuasiModal();
2410 }
2411 } );
2412 }
2413
2414 m_diffSymbolDialog->Destroy();
2415 m_diffSymbolDialog = nullptr;
2416 }
2417}
2418
2419
2421{
2422 if( !m_ercDialog )
2423 m_ercDialog = new DIALOG_ERC( this );
2424
2425 return m_ercDialog;
2426}
2427
2428
2429void SCH_EDIT_FRAME::onCloseErcDialog( wxCommandEvent& aEvent )
2430{
2431 if( m_ercDialog )
2432 {
2433 m_ercDialog->Destroy();
2434 m_ercDialog = nullptr;
2435 }
2436}
2437
2438
2446
2447
2449{
2450 return m_netNavigator;
2451}
2452
2453
2455{
2457 {
2458 m_symbolFieldsTableDialog->Destroy();
2459 m_symbolFieldsTableDialog = nullptr;
2460 }
2461}
2462
2463
2464void SCH_EDIT_FRAME::AddSchematicChangeListener( wxEvtHandler* aListener )
2465{
2466 auto it = std::find( m_schematicChangeListeners.begin(), m_schematicChangeListeners.end(), aListener );
2467
2468 // Don't add duplicate listeners.
2469 if( it == m_schematicChangeListeners.end() )
2470 m_schematicChangeListeners.push_back( aListener );
2471}
2472
2473
2475{
2476 auto it = std::find( m_schematicChangeListeners.begin(), m_schematicChangeListeners.end(), aListener );
2477
2478 // Don't add duplicate listeners.
2479 if( it != m_schematicChangeListeners.end() )
2480 m_schematicChangeListeners.erase( it );
2481}
2482
2483
2485{
2486 wxPanel* panel = new wxPanel( this );
2487
2488 wxBoxSizer* sizer = new wxBoxSizer( wxVERTICAL );
2489
2490 // Create horizontal sizer for search control and gear button
2491 wxBoxSizer* searchSizer = new wxBoxSizer( wxHORIZONTAL );
2492
2493 m_netNavigatorFilter = new wxSearchCtrl( panel, wxID_ANY );
2494 m_netNavigatorFilter->SetDescriptiveText( _( "Filter nets" ) );
2495 m_netNavigatorFilter->ShowCancelButton( false );
2496 searchSizer->Add( m_netNavigatorFilter, 1, wxEXPAND | wxRIGHT, FromDIP( 2 ) );
2497
2498 m_netNavigatorMenuButton = new BITMAP_BUTTON( panel, wxID_ANY );
2500 m_netNavigatorMenuButton->SetPadding( 2 );
2501 searchSizer->Add( m_netNavigatorMenuButton, 0, wxALIGN_CENTER_VERTICAL );
2502
2503 sizer->Add( searchSizer, 0, wxEXPAND | wxALL, FromDIP( 2 ) );
2504
2505 m_netNavigator = new wxGenericTreeCtrl( panel, wxID_ANY, wxPoint( 0, 0 ), FromDIP( wxSize( 160, 250 ) ),
2506 wxTR_DEFAULT_STYLE | wxNO_BORDER );
2507 sizer->Add( m_netNavigator, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, FromDIP( 2 ) );
2508
2509 panel->SetSizer( sizer );
2510
2511 m_netNavigatorFilter->Bind( wxEVT_COMMAND_TEXT_UPDATED, &SCH_EDIT_FRAME::onNetNavigatorFilterChanged, this );
2512 m_netNavigatorFilter->Bind( wxEVT_KEY_DOWN, &SCH_EDIT_FRAME::onNetNavigatorKey, this );
2513 m_netNavigator->Bind( wxEVT_KEY_DOWN, &SCH_EDIT_FRAME::onNetNavigatorKey, this );
2514 m_netNavigator->Bind( wxEVT_TREE_ITEM_MENU, &SCH_EDIT_FRAME::onNetNavigatorItemMenu, this );
2515 m_netNavigator->Bind( wxEVT_CONTEXT_MENU, &SCH_EDIT_FRAME::onNetNavigatorContextMenu, this );
2516
2517 m_netNavigatorMenuButton->Bind( wxEVT_LEFT_DOWN,
2518 [this]( wxMouseEvent& event )
2519 {
2520 wxMenu menu;
2521 wxMenuItem* wildcardItem = menu.AppendRadioItem( ID_NET_NAVIGATOR_SEARCH_WILDCARD,
2522 _( "Wildcard Search" ) );
2523 wxMenuItem* regexItem = menu.AppendRadioItem( ID_NET_NAVIGATOR_SEARCH_REGEX,
2524 _( "Regex Search" ) );
2525
2526 EESCHEMA_SETTINGS* cfg = eeconfig();
2527
2529 wildcardItem->Check();
2530 else
2531 regexItem->Check();
2532
2533 PopupMenu( &menu );
2534 } );
2535
2541
2542 return panel;
2543}
2544
2545
2546void SCH_EDIT_FRAME::SetHighlightedConnection( const wxString& aConnection,
2547 const NET_NAVIGATOR_ITEM_DATA* aSelection )
2548{
2549 bool refreshNetNavigator = aConnection != m_highlightedConn;
2550
2551 m_highlightedConn = aConnection;
2552
2553 if( refreshNetNavigator )
2554 {
2555 RefreshNetNavigator( aSelection );
2556
2557 if( m_hierarchy )
2558 m_hierarchy->UpdateNetHighlight( aConnection );
2559 }
2560}
2561
2562
2564{
2566
2567 if( m_netNavigator )
2568 {
2569 NET_NAVIGATOR_ITEM_DATA itemData;
2570 wxTreeItemId selection = m_netNavigator->GetSelection();
2571 bool refreshSelection = selection.IsOk() && selection != m_netNavigator->GetRootItem();
2572
2573 if( refreshSelection )
2574 {
2576 dynamic_cast<NET_NAVIGATOR_ITEM_DATA*>( m_netNavigator->GetItemData( selection ) );
2577
2578 wxCHECK( tmp, /* void */ );
2579 itemData = *tmp;
2580 }
2581
2582 m_netNavigator->DeleteAllItems();
2583 RefreshNetNavigator( refreshSelection ? &itemData : nullptr );
2584 }
2585}
2586
2587
2589{
2590 if( !m_netNavigator )
2591 return;
2592
2593 wxString newFilter = m_netNavigatorFilter ? m_netNavigatorFilter->GetValue() : wxString();
2594
2595 if( newFilter == m_netNavigatorFilterValue )
2596 return;
2597
2598 m_netNavigatorFilterValue = newFilter;
2599
2600 NET_NAVIGATOR_ITEM_DATA selectionData;
2601 NET_NAVIGATOR_ITEM_DATA* selectionPtr = nullptr;
2602
2603 wxTreeItemId selection = m_netNavigator->GetSelection();
2604
2605 if( selection.IsOk() )
2606 {
2607 if( NET_NAVIGATOR_ITEM_DATA* tmp =
2608 dynamic_cast<NET_NAVIGATOR_ITEM_DATA*>( m_netNavigator->GetItemData( selection ) ) )
2609 {
2610 selectionData = *tmp;
2611 selectionPtr = &selectionData;
2612 }
2613 }
2614
2615 RefreshNetNavigator( selectionPtr );
2616
2617 aEvent.Skip();
2618}
2619
2620
2621void SCH_EDIT_FRAME::onNetNavigatorKey( wxKeyEvent& aEvent )
2622{
2623 if( aEvent.GetKeyCode() == WXK_ESCAPE )
2624 {
2625 // Clear the search string and refresh
2627 m_netNavigatorFilter->SetValue( wxEmptyString );
2628
2629 m_netNavigatorFilterValue = wxEmptyString;
2630
2632
2633 // Don't skip the event - we handled it
2634 return;
2635 }
2636
2637 aEvent.Skip();
2638}
2639
2640
2641
2643{
2644 showNetNavigatorMenu( aEvent.GetItem() );
2645}
2646
2647
2648void SCH_EDIT_FRAME::onNetNavigatorContextMenu( wxContextMenuEvent& aEvent )
2649{
2650 if( !m_netNavigator )
2651 return;
2652
2653 wxPoint screenPos = aEvent.GetPosition();
2654
2655 if( screenPos == wxDefaultPosition )
2656 screenPos = wxGetMousePosition();
2657
2658 wxPoint clientPos = m_netNavigator->ScreenToClient( screenPos );
2659 int flags = 0;
2660 wxTreeItemId item = m_netNavigator->HitTest( clientPos, flags );
2661
2662 showNetNavigatorMenu( item );
2663}
2664
2665
2666void SCH_EDIT_FRAME::showNetNavigatorMenu( const wxTreeItemId& aItem )
2667{
2668 if( !m_netNavigator )
2669 return;
2670
2671 wxMenu menu;
2672
2673 menu.Append( ID_NET_NAVIGATOR_EXPAND_ALL, _( "Expand All" ) );
2674 menu.Append( ID_NET_NAVIGATOR_COLLAPSE_ALL, _( "Collapse All" ) );
2675
2676 wxMenuItem* findInInspector = new wxMenuItem( &menu, ID_NET_NAVIGATOR_FIND_IN_INSPECTOR,
2677 _( "Find in Net Inspector" ) );
2678 menu.Append( findInInspector );
2679
2680 wxString netName;
2681
2682 if( aItem.IsOk() )
2683 {
2684 wxTreeItemId netItem = aItem;
2685
2686 if( m_netNavigator->GetItemParent( netItem ) != m_netNavigator->GetRootItem() )
2687 {
2688 wxTreeItemId parent = m_netNavigator->GetItemParent( netItem );
2689
2690 while( parent.IsOk() && parent != m_netNavigator->GetRootItem() )
2691 {
2692 netItem = parent;
2693 parent = m_netNavigator->GetItemParent( netItem );
2694 }
2695
2696 if( parent == m_netNavigator->GetRootItem() )
2697 {
2698 if( wxStringClientData* data =
2699 dynamic_cast<wxStringClientData*>( m_netNavigator->GetItemData( netItem ) ) )
2700 {
2701 netName = data->GetData();
2702 }
2703 }
2704 }
2705 else if( m_netNavigator->GetItemParent( netItem ) == m_netNavigator->GetRootItem() )
2706 {
2707 if( wxStringClientData* data =
2708 dynamic_cast<wxStringClientData*>( m_netNavigator->GetItemData( netItem ) ) )
2709 {
2710 netName = data->GetData();
2711 }
2712 }
2713 else if( !m_highlightedConn.IsEmpty() && netItem == m_netNavigator->GetRootItem() )
2714 {
2715 netName = m_highlightedConn;
2716 }
2717 }
2718 else if( !m_highlightedConn.IsEmpty() && m_netNavigator->GetRootItem().IsOk() )
2719 {
2720 netName = m_highlightedConn;
2721 }
2722
2723 if( netName.IsEmpty() )
2724 {
2725 findInInspector->Enable( false );
2727 }
2728 else
2729 {
2730 m_netNavigatorMenuNetName = netName;
2731 }
2732
2733 PopupMenu( &menu );
2734}
2735
2736
2737void SCH_EDIT_FRAME::onNetNavigatorMenuCommand( wxCommandEvent& aEvent )
2738{
2739 if( !m_netNavigator )
2740 return;
2741
2742 switch( aEvent.GetId() )
2743 {
2745 m_netNavigator->ExpandAll();
2746 break;
2747
2749 m_netNavigator->CollapseAll();
2750
2751 if( m_netNavigator->GetRootItem().IsOk() )
2752 m_netNavigator->Expand( m_netNavigator->GetRootItem() );
2753 break;
2754
2756 if( !m_netNavigatorMenuNetName.IsEmpty() )
2758 break;
2759
2762 if( EESCHEMA_SETTINGS* cfg = eeconfig() )
2763 {
2764 cfg->m_AuiPanels.net_nav_search_mode_wildcard = ( aEvent.GetId() == ID_NET_NAVIGATOR_SEARCH_WILDCARD );
2765
2766 // Refresh the navigator with current filter
2768 }
2769
2770 break;
2771
2772 default:
2773 aEvent.Skip();
2774 return;
2775 }
2776
2778
2779 aEvent.Skip( false );
2780}
2781
2782
2784{
2785 wxAuiPaneInfo& hierarchyPane = m_auimgr.GetPane( SchematicHierarchyPaneName() );
2786 wxAuiPaneInfo& netNavigatorPane = m_auimgr.GetPane( NetNavigatorPaneName() );
2787 wxAuiPaneInfo& propertiesPane = m_auimgr.GetPane( PropertiesPaneName() );
2788 wxAuiPaneInfo& selectionFilterPane = m_auimgr.GetPane( wxS( "SelectionFilter" ) );
2789
2790 // Don't give the selection filter its own visibility controls; instead show it if
2791 // anything else is visible
2792 bool showFilter = ( hierarchyPane.IsShown() && hierarchyPane.IsDocked() )
2793 || ( netNavigatorPane.IsShown() && netNavigatorPane.IsDocked() )
2794 || ( propertiesPane.IsShown() && propertiesPane.IsDocked() );
2795
2796 selectionFilterPane.Show( showFilter );
2797}
2798
2799
2800#ifdef KICAD_IPC_API
2801void SCH_EDIT_FRAME::onPluginAvailabilityChanged( wxCommandEvent& aEvt )
2802{
2803 wxLogTrace( traceApi, "SCH frame: EDA_EVT_PLUGIN_AVAILABILITY_CHANGED" );
2805 aEvt.Skip();
2806}
2807#endif
2808
2809
2811{
2812 EESCHEMA_SETTINGS* cfg = eeconfig();
2813
2814 // Ensure m_show_search is up to date (the pane can be closed outside the menu)
2815 m_show_search = m_auimgr.GetPane( SearchPaneName() ).IsShown();
2816
2818
2819 wxAuiPaneInfo& searchPaneInfo = m_auimgr.GetPane( SearchPaneName() );
2820 searchPaneInfo.Show( m_show_search );
2821
2822 if( m_show_search )
2823 {
2824 searchPaneInfo.Direction( cfg->m_AuiPanels.search_panel_dock_direction );
2825
2826 if( cfg->m_AuiPanels.search_panel_dock_direction == wxAUI_DOCK_TOP
2827 || cfg->m_AuiPanels.search_panel_dock_direction == wxAUI_DOCK_BOTTOM )
2828 {
2829 SetAuiPaneSize( m_auimgr, searchPaneInfo, -1, cfg->m_AuiPanels.search_panel_height );
2830 }
2831 else if( cfg->m_AuiPanels.search_panel_dock_direction == wxAUI_DOCK_LEFT
2832 || cfg->m_AuiPanels.search_panel_dock_direction == wxAUI_DOCK_RIGHT )
2833 {
2834 SetAuiPaneSize( m_auimgr, searchPaneInfo, cfg->m_AuiPanels.search_panel_width, -1 );
2835 }
2836
2837 m_searchPane->FocusSearch();
2838 m_searchPane->RefreshSearch();
2839 }
2840 else
2841 {
2842 cfg->m_AuiPanels.search_panel_height = m_searchPane->GetSize().y;
2843 cfg->m_AuiPanels.search_panel_width = m_searchPane->GetSize().x;
2844 cfg->m_AuiPanels.search_panel_dock_direction = searchPaneInfo.dock_direction;
2845 m_auimgr.Update();
2846 }
2847}
2848
2849
2851{
2852 if( !m_propertiesPanel )
2853 return;
2854
2855 bool show = !m_propertiesPanel->IsShownOnScreen();
2856
2857 wxAuiPaneInfo& propertiesPaneInfo = m_auimgr.GetPane( PropertiesPaneName() );
2858 propertiesPaneInfo.Show( show );
2859
2861
2862 EESCHEMA_SETTINGS* settings = eeconfig();
2863
2864 if( show )
2865 {
2866 SetAuiPaneSize( m_auimgr, propertiesPaneInfo, settings->m_AuiPanels.properties_panel_width, -1 );
2867 }
2868 else
2869 {
2870 settings->m_AuiPanels.properties_panel_width = m_propertiesPanel->GetSize().x;
2871 m_auimgr.Update();
2872 }
2873}
2874
2875
2877{
2878 EESCHEMA_SETTINGS* cfg = eeconfig();
2879
2880 wxCHECK( cfg, /* void */ );
2881
2882 wxAuiPaneInfo& hierarchy_pane = m_auimgr.GetPane( SchematicHierarchyPaneName() );
2883
2884 hierarchy_pane.Show( !hierarchy_pane.IsShown() );
2885
2887
2888 if( hierarchy_pane.IsShown() )
2889 {
2890 if( hierarchy_pane.IsFloating() )
2891 {
2892 hierarchy_pane.FloatingSize( cfg->m_AuiPanels.hierarchy_panel_float_width,
2894 m_auimgr.Update();
2895 }
2896 else if( cfg->m_AuiPanels.hierarchy_panel_docked_width > 0 )
2897 {
2898 // SetAuiPaneSize also updates m_auimgr
2900 }
2901 }
2902 else
2903 {
2904 if( hierarchy_pane.IsFloating() )
2905 {
2906 cfg->m_AuiPanels.hierarchy_panel_float_width = hierarchy_pane.floating_size.x;
2907 cfg->m_AuiPanels.hierarchy_panel_float_height = hierarchy_pane.floating_size.y;
2908 }
2909 else
2910 {
2912 }
2913
2914 m_auimgr.Update();
2915 }
2916}
2917
2918
2920{
2921 EESCHEMA_SETTINGS* cfg = eeconfig();
2922
2923 wxCHECK( cfg, /* void */ );
2924
2925 wxAuiPaneInfo& db_library_pane = m_auimgr.GetPane( DesignBlocksPaneName() );
2926
2927 db_library_pane.Show( !db_library_pane.IsShown() );
2928
2929 if( db_library_pane.IsShown() )
2930 {
2931 if( db_library_pane.IsFloating() )
2932 {
2933 db_library_pane.FloatingSize( cfg->m_AuiPanels.design_blocks_panel_float_width,
2935 m_auimgr.Update();
2936 }
2938 {
2939 // SetAuiPaneSize also updates m_auimgr
2940 SetAuiPaneSize( m_auimgr, db_library_pane,
2942 }
2943 }
2944 else
2945 {
2946 if( db_library_pane.IsFloating() )
2947 {
2948 cfg->m_AuiPanels.design_blocks_panel_float_width = db_library_pane.floating_size.x;
2949 cfg->m_AuiPanels.design_blocks_panel_float_height = db_library_pane.floating_size.y;
2950 }
2951 else
2952 {
2954 }
2955
2956 m_auimgr.Update();
2957 }
2958}
2959
2960
2962{
2963 EESCHEMA_SETTINGS* cfg = eeconfig();
2964
2965 wxCHECK( cfg, /* void */ );
2966
2967 wxAuiPaneInfo& remotePane = m_auimgr.GetPane( RemoteSymbolPaneName() );
2968
2969 remotePane.Show( !remotePane.IsShown() );
2970
2971 if( remotePane.IsShown() )
2972 {
2973 if( m_remoteSymbolPane )
2974 m_remoteSymbolPane->Activate();
2975
2976 if( remotePane.IsFloating() )
2977 {
2978 remotePane.FloatingSize( cfg->m_AuiPanels.remote_symbol_panel_float_width,
2980 m_auimgr.Update();
2981 }
2983 {
2984 SetAuiPaneSize( m_auimgr, remotePane,
2986 }
2987 }
2988 else
2989 {
2990 if( remotePane.IsFloating() )
2991 {
2992 cfg->m_AuiPanels.remote_symbol_panel_float_width = remotePane.floating_size.x;
2993 cfg->m_AuiPanels.remote_symbol_panel_float_height = remotePane.floating_size.y;
2994 }
2995 else if( m_remoteSymbolPane )
2996 {
2998 }
2999
3000 m_auimgr.Update();
3001 }
3002}
3003
3004
3006{
3007 wxCHECK( aSchematic, /* void */ );
3008
3009 if( m_schematic )
3010 {
3011 m_schematic->SetProject( nullptr );
3012
3013 // Detach before the outgoing schematic (and its tracker) is freed.
3014 if( GetCanvas() && GetCanvas()->GetView() )
3016 }
3017
3018 aSchematic->SetProject( &Prj() );
3019 delete m_schematic;
3020
3021 m_schematic = aSchematic;
3022 m_schematic->SetSchematicHolder( this );
3023
3024 KIGFX::SCH_VIEW* view = GetCanvas()->GetView();
3025 static_cast<KIGFX::SCH_PAINTER*>( view->GetPainter() )->SetSchematic( m_schematic );
3026 m_toolManager->SetEnvironment( m_schematic, GetCanvas()->GetView(), GetCanvas()->GetViewControls(), config(),
3027 this );
3028}
3029
3030
3032{
3034 return;
3035
3036 m_currentVariantCtrl->SetSelection( m_currentVariantCtrl->GetCount() - 1 );
3037
3038 wxCommandEvent dummy( wxEVT_CHOICE, ID_TOOLBAR_SCH_SELECT_VARAIANT );
3040}
3041
3042
3044{
3045 wxArrayString choices = Schematic().GetVariantNamesForUI();
3046
3047 // Default variant cannot be edited.
3048 choices.RemoveAt( 0 );
3049
3050 if( choices.IsEmpty() )
3051 {
3052 GetInfoBar()->ShowMessageFor( _( "No design variants to edit." ), 10000, wxICON_ERROR );
3053 return;
3054 }
3055
3056 wxSingleChoiceDialog chooser( this, _( "Select variant to edit description:" ) + wxS( " " ),
3057 _( "Edit Variant Description" ), choices );
3058 chooser.Layout();
3059
3060 if( chooser.ShowModal() == wxID_CANCEL )
3061 return;
3062
3063 wxString variantName = chooser.GetStringSelection();
3064
3065 if( variantName.IsEmpty() )
3066 return;
3067
3068 wxString currentDesc = Schematic().GetVariantDescription( variantName );
3069
3070 wxDialog dlg( this, wxID_ANY, wxString::Format( _( "Edit Description for '%s'" ), variantName ), wxDefaultPosition,
3071 wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER );
3072
3073 wxBoxSizer* mainSizer = new wxBoxSizer( wxVERTICAL );
3074
3075 wxStaticText* label = new wxStaticText( &dlg, wxID_ANY, _( "Description:" ) );
3076 mainSizer->Add( label, 0, wxLEFT | wxRIGHT | wxTOP | wxEXPAND, 10 );
3077
3078 mainSizer->AddSpacer( 3 );
3079
3080 wxTextCtrl* descCtrl =
3081 new wxTextCtrl( &dlg, wxID_ANY, currentDesc, wxDefaultPosition, wxSize( 300, 60 ), wxTE_MULTILINE );
3082 mainSizer->Add( descCtrl, 1, wxLEFT | wxRIGHT | wxBOTTOM | wxEXPAND, 10 );
3083
3084 wxStdDialogButtonSizer* btnSizer = new wxStdDialogButtonSizer();
3085 btnSizer->AddButton( new wxButton( &dlg, wxID_OK ) );
3086 btnSizer->AddButton( new wxButton( &dlg, wxID_CANCEL ) );
3087 btnSizer->Realize();
3088 mainSizer->Add( btnSizer, 0, wxALL | wxALIGN_RIGHT, 5 );
3089
3090 dlg.SetSizer( mainSizer );
3091 dlg.Fit();
3092 dlg.Centre();
3093
3094 if( dlg.ShowModal() == wxID_CANCEL )
3095 return;
3096
3097 wxString newDesc = descCtrl->GetValue().Trim().Trim( false );
3098
3099 Schematic().SetVariantDescription( variantName, newDesc );
3100 OnModify();
3101 GetCanvas()->Refresh();
3102}
3103
3104
3106{
3108 return;
3109
3110 wxArrayString choices = Schematic().GetVariantNamesForUI();
3111
3112 // Default variant cannot be removed.
3113 choices.RemoveAt( 0 );
3114
3115 // wxSingleChoiceDialog will ellipsize the title bar if the contents aren't wide enough. The set
3116 // of spaces in the control label are to prevent this.
3117 wxSingleChoiceDialog dlg( this, _( "Select variant name to remove:" ) + wxS( " " ),
3118 _( "Remove Design Variant" ), choices );
3119 dlg.Layout();
3120
3121 if( dlg.ShowModal() == wxID_CANCEL )
3122 return;
3123
3124 wxString variantName = dlg.GetStringSelection();
3125
3126 if( variantName.IsEmpty() )
3127 return;
3128
3129 SCH_COMMIT commit( this );
3130 Schematic().DeleteVariant( variantName, &commit );
3131
3132 if( !commit.Empty() )
3133 {
3134 commit.Push( wxString::Format( wxS( "Delete variant '%s'" ), variantName ) );
3135 OnModify();
3136 }
3137
3138 if( Schematic().GetCurrentVariant() == variantName )
3139 SetCurrentVariant( wxEmptyString );
3140
3141 UpdateVariantSelectionCtrl( Schematic().GetVariantNamesForUI() );
3142
3143 GetCanvas()->Refresh();
3144}
3145
3146
3148{
3149 // Delegate to base auto-save behavior (commits pending local history) for now.
3151}
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:127
KIFACE_BASE & Kiface()
Global KIFACE_BASE "get" accessor.
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
Definition bitmap.cpp:104
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap, int aMinHeight)
Definition bitmap.cpp:110
@ icon_eeschema_16
@ icon_eeschema_32
BOX2< VECTOR2I > BOX2I
Definition box2.h:922
static TOOL_ACTION toggleGrid
Definition actions.h:198
static TOOL_ACTION paste
Definition actions.h:80
static TOOL_ACTION cancelInteractive
Definition actions.h:72
static TOOL_ACTION unselectAll
Definition actions.h:83
static TOOL_ACTION selectItem
Select an item (specified as the event parameter).
Definition actions.h:227
static TOOL_ACTION copy
Definition actions.h:78
static TOOL_ACTION selectSetLasso
Definition actions.h:221
static TOOL_ACTION selectSetRect
Set lasso selection mode.
Definition actions.h:220
static TOOL_ACTION group
Definition actions.h:239
static TOOL_ACTION pasteSpecial
Definition actions.h:81
static TOOL_ACTION ungroup
Definition actions.h:240
static TOOL_ACTION toggleBoundingBoxes
Definition actions.h:157
static TOOL_ACTION showSearch
Definition actions.h:116
static TOOL_ACTION undo
Definition actions.h:75
static TOOL_ACTION selectionActivate
Activation of the selection tool.
Definition actions.h:214
static TOOL_ACTION duplicate
Definition actions.h:84
static TOOL_ACTION doDelete
Definition actions.h:85
static TOOL_ACTION selectionTool
Definition actions.h:251
static TOOL_ACTION save
Definition actions.h:58
static TOOL_ACTION zoomFitScreen
Definition actions.h:142
static TOOL_ACTION redo
Definition actions.h:76
static TOOL_ACTION deleteTool
Definition actions.h:86
static TOOL_ACTION zoomTool
Definition actions.h:146
static TOOL_ACTION selectionClear
Clear the current selection.
Definition actions.h:224
static TOOL_ACTION showProperties
Definition actions.h:266
static TOOL_ACTION cut
Definition actions.h:77
static TOOL_ACTION copyAsText
Definition actions.h:79
static TOOL_ACTION toggleGridOverrides
Definition actions.h:199
static TOOL_ACTION selectAll
Definition actions.h:82
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...
Handles how to draw a screen (a board, a schematic ...)
Definition base_screen.h:41
void SetContentModified(bool aModified=true)
Definition base_screen.h:59
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:658
bool Empty() const
Definition commit.h:137
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:106
Handle actions that are shared between different applications.
Handles action that are shared between different applications.
A subgraph is a set of items that are electrically connected on a single sheet.
Dialog to update or change schematic library symbols.
virtual bool doAutoSave()
This should be overridden by the derived class to handle the auto save feature.
virtual APP_SETTINGS_BASE * config() const
Return the settings object used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME.
virtual void ProjectChanged()
Notification event that the project has changed.
UNDO_REDO_CONTAINER m_undoList
void ShowChangedLanguage() override
Redraw the menus and what not in current language.
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 UpdateFileHistory(const wxString &FullFileName, FILE_HISTORY *aFileHistory=nullptr)
Update the list of recently opened files.
wxAuiManager m_auimgr
virtual void RecreateToolbars()
ACTION_TOOLBAR * m_tbLeft
virtual void OnSize(wxSizeEvent &aEvent)
virtual void ClearFileHistory()
Remove all files from the file history.
virtual void OnDropFiles(wxDropFilesEvent &aEvent)
Handle event fired when a file is dropped to the window.
std::map< const wxString, TOOL_ACTION * > m_acceptedExts
Associate file extensions with action to execute.
wxString GetFileFromHistory(int cmdId, const wxString &type, FILE_HISTORY *aFileHistory=nullptr)
Fetch the file name from the file history list.
virtual int GetUndoCommandCount() const
ACTION_TOOLBAR * m_tbTopMain
wxString m_aboutTitle
bool m_isClosing
Set by the close window event handler after frames are asked if they can close.
void ReCreateMenuBar()
Recreate the menu bar.
WX_INFOBAR * GetInfoBar()
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)
virtual void SwitchCanvas(EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType)
Change the current rendering backend.
virtual void OnSize(wxSizeEvent &event) override
Recalculate the size of toolbars and display panel when the frame size changes.
virtual void OnSelectZoom(wxCommandEvent &event)
Set the zoom factor when selected by the zoom list box in the main tool bar.
GAL_DISPLAY_OPTIONS_IMPL & GetGalDisplayOptions()
Return a reference to the gal rendering options used by GAL for rendering.
virtual 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 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:100
virtual const VECTOR2I GetFocusPosition() const
Similar to GetPosition() but allows items to return their visual center rather than their anchor.
Definition eda_item.h:286
const KIID m_Uuid
Definition eda_item.h:528
KICAD_T Type() const
Returns the type of object.
Definition eda_item.h:112
void ClearBrightened()
Definition eda_item.h:145
void SetBrightened()
Definition eda_item.h:142
bool IsBrightened() const
Definition eda_item.h:131
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:93
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition eda_text.h:114
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
bool empty() const
Definition sch_rtree.h:159
EE_TYPE OfType(KICAD_T aType) const
Definition sch_rtree.h:225
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.
APP_SETTINGS_BASE * KifaceSettings() const
Definition kiface_base.h:95
void SetDefaultFont(const wxString &aFont)
Contains methods for drawing schematic-specific items.
Definition sch_painter.h:69
void SetSchematic(SCHEMATIC *aSchematic)
Definition sch_painter.h:79
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:77
DS_PROXY_VIEW_ITEM * GetDrawingSheet() const
Definition sch_view.h:129
void SetScale(double aScale, VECTOR2D aAnchor={ 0, 0 }) override
Set the scaling factor, zooming around a given anchor point.
Definition sch_view.cpp:119
void DetachTextVarTracker()
Drop every cached reference into the currently-attached SCHEMATIC's TEXT_VAR_TRACKER: unregister the ...
Definition sch_view.cpp:63
An abstract base class for deriving all objects that can be added to a VIEW.
Definition view_item.h:86
bool IsSCH_ITEM() const
Definition view_item.h:101
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition view.h:67
double GetScale() const
Definition view.h:285
void SetLayerVisible(int aLayer, bool aVisible=true)
Control the visibility of a particular layer.
Definition view.h:409
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
Definition view.h:229
void SetCenter(const VECTOR2D &aCenter)
Set the center point of the VIEW (i.e.
Definition view.cpp:664
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:1682
wxString AsString() const
Definition kiid.cpp:365
Definition kiid.h:48
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:315
void OnKiCadExit()
Definition kiway.cpp:800
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
Definition kiway.cpp:402
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:500
virtual KIFACE * KiFACE(FACE_T aFaceId, bool doLoad=true)
Return the KIFACE* given a FACE_T.
Definition kiway.cpp:211
@ FACE_SCH
eeschema DSO
Definition kiway.h:322
LOCAL_HISTORY & LocalHistory()
Return the LOCAL_HISTORY associated with this KIWAY.
Definition kiway.h:426
Define a library symbol object.
Definition lib_symbol.h:83
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 RegisterSaver(const void *aSaverObject, const std::function< void(const wxString &, std::vector< HISTORY_FILE_DATA > &)> &aSaver)
Register a saver callback invoked during autosave history commits.
void NoteFileChange(const wxString &aFile)
Record that a file has been modified and should be included in the next snapshot.
void UnregisterSaver(const void *aSaverObject)
Unregister a previously registered saver callback.
Tree view item data for the net navigator.
A singleton reporter that reports to nowhere.
Definition reporter.h:218
int GetHeightIU(double aIUScale) const
Gets the page height in IU.
Definition page_info.h:168
int GetWidthIU(double aIUScale) const
Gets the page width in IU.
Definition page_info.h:159
void PreloadDesignBlockLibraries(KIWAY *aKiway)
Starts a background job to preload the global and project design block libraries.
Definition pgm_base.cpp:887
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:181
virtual const wxString GetProjectPath() const
Return the full path of the project.
Definition project.cpp:187
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:411
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:89
void SetCurrentSheet(const SCH_SHEET_PATH &aPath)
Definition schematic.h:193
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.
SCHEMATIC_SETTINGS & Settings() const
SCH_ITEM * ResolveItem(const KIID &aID, SCH_SHEET_PATH *aPathOut=nullptr, bool aAllowNullptrReturn=false) const
Definition schematic.h:127
SCH_SHEET_LIST Hierarchy() const
Return the full schematic flattened hierarchical sheet list.
void SetProject(PROJECT *aPrj)
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.
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.
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)
Generate the connection data for the entire schematic hierarchy.
ERC_SETTINGS & ErcSettings() const
Gather all the actions that are shared by tools.
Definition sch_actions.h:40
static TOOL_ACTION rotateCCW
static TOOL_ACTION placeClassLabel
Definition sch_actions.h:79
static TOOL_ACTION placeSheetPin
Definition sch_actions.h:85
static TOOL_ACTION saveSheetAsDesignBlock
static TOOL_ACTION mirrorV
static TOOL_ACTION drawSheetFromFile
Definition sch_actions.h:83
static TOOL_ACTION toggleOPCurrents
static TOOL_ACTION saveToLinkedDesignBlock
Definition sch_actions.h:71
static TOOL_ACTION saveSelectionAsDesignBlock
static TOOL_ACTION placeGlobalLabel
Definition sch_actions.h:80
static TOOL_ACTION drawTextBox
Definition sch_actions.h:93
static TOOL_ACTION toggleAnnotateAuto
static TOOL_ACTION ddAddImage
static TOOL_ACTION drawArc
Definition sch_actions.h:97
static TOOL_ACTION drawSheet
Definition sch_actions.h:82
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
Definition sch_actions.h:95
static TOOL_ACTION drawLines
Definition sch_actions.h:99
static TOOL_ACTION placeHierLabel
Definition sch_actions.h:81
static TOOL_ACTION alignTop
static TOOL_ACTION alignRight
static TOOL_ACTION placeLabel
Definition sch_actions.h:78
static TOOL_ACTION drawCircle
Definition sch_actions.h:96
static TOOL_ACTION placeBusWireEntry
Definition sch_actions.h:77
static TOOL_ACTION showRemoteSymbolPanel
static TOOL_ACTION drawBezier
Definition sch_actions.h:98
static TOOL_ACTION drawWire
Definition sch_actions.h:72
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:76
static TOOL_ACTION markSimExclusions
static TOOL_ACTION drawRuleArea
static TOOL_ACTION placeSymbol
Definition sch_actions.h:66
static TOOL_ACTION placeImage
static TOOL_ACTION alignLeft
static TOOL_ACTION toggleERCErrors
static TOOL_ACTION alignCenterX
static TOOL_ACTION angleSnapModeChanged
static TOOL_ACTION placeLinkedDesignBlock
Definition sch_actions.h:70
static TOOL_ACTION drawSheetFromDesignBlock
Definition sch_actions.h:84
static TOOL_ACTION mirrorH
static TOOL_ACTION placeDesignBlock
Definition sch_actions.h:69
static TOOL_ACTION toggleOPVoltages
static TOOL_ACTION drawBus
Definition sch_actions.h:73
static TOOL_ACTION drawTable
Definition sch_actions.h:94
static TOOL_ACTION ddAppendFile
static TOOL_ACTION placeSchematicText
Definition sch_actions.h:92
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:75
static TOOL_ACTION toggleHiddenPins
static TOOL_ACTION syncSheetPins
Definition sch_actions.h:89
static TOOL_ACTION placePower
Definition sch_actions.h:68
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.
virtual void Push(const wxString &aMessage=wxT("A commit"), 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
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 #VIEW instance used in the panel.
void DisplaySheet(SCH_SCREEN *aScreen)
Group generic conditions for PCB editor states.
int UpdateNetHighlighting(const TOOL_EVENT &aEvent)
Launch a tool to highlight nets.
Schematic editor (Eeschema) main window.
void DefaultExecFlags()
Reset the execution flags to defaults for external netlist and bom generators.
void OnCrossProbeFlashTimer(wxTimerEvent &aEvent)
void ToggleProperties() override
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
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...
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
DIALOG_BOOK_REPORTER * m_diffSymbolDialog
void ToggleLibraryTree() override
void SetHighlightedConnection(const wxString &aConnection, const NET_NAVIGATOR_ITEM_DATA *aSelection=nullptr)
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
bool ReadyToNetlist(const wxString &aAnnotateMessage)
Check if we are ready to write a netlist file for the current schematic.
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 SetScreen(BASE_SCREEN *aScreen) override
friend class SCH_EDITOR_CONTROL
bool doAutoSave() override
Save the schematic files that have been modified and not yet saved.
wxChoice * m_currentVariantCtrl
void SaveSymbolToSchematic(const LIB_SYMBOL &aSymbol, const KIID &aSchematicSymbolUUID)
Update a schematic symbol from a LIB_SYMBOL.
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.
BITMAP_BUTTON * m_netNavigatorMenuButton
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.
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
void RecalculateConnections(SCH_COMMIT *aCommit, SCH_CLEANUP_FLAGS aCleanupFlags, PROGRESS_REPORTER *aProgressReporter=nullptr)
Generate the connection data for the entire schematic hierarchy.
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.
void RefreshNetNavigator(const NET_NAVIGATOR_ITEM_DATA *aSelection=nullptr)
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 ...
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.
wxGenericTreeCtrl * m_netNavigator
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.
static const wxString SchematicHierarchyPaneName()
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 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 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:52
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition sch_item.h:168
SCH_ITEM * Duplicate(bool addToParentGroup, SCH_COMMIT *aCommit=nullptr, bool doClone=false) const
Routine to create a new copy of given item.
Definition sch_item.cpp:164
virtual void RunOnChildren(const std::function< void(SCH_ITEM *)> &aFunction, RECURSE_MODE aMode)
Definition sch_item.h:634
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:491
bool ResolveExcludedFromSim(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
Definition sch_item.cpp:302
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:42
void SetOperatingPoint(const wxString &aText)
Definition sch_line.h:348
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:290
const wxString & GetOperatingPoint() const
Definition sch_line.h:347
Handle actions specific to the schematic editor.
void SetOperatingPoint(const wxString &aText)
Definition sch_pin.h:343
Tool that displays edit points allowing to modify items by dragging the points.
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
Definition sch_screen.h:750
const PAGE_INFO & GetPageSettings() const
Definition sch_screen.h:141
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:498
double m_LastZoomLevel
last value for the zoom level, useful in Eeschema when changing the current displayed sheet to reuse ...
Definition sch_screen.h:677
EE_RTREE & Items()
Get the full RTree, usually for iterating.
Definition sch_screen.h:119
const wxString & GetFileName() const
Definition sch_screen.h:154
bool IsReadOnly() const
Definition sch_screen.h:157
void Update(SCH_ITEM *aItem, bool aUpdateLibSymbol=true)
Update aItem's bounding box in the tree.
bool m_zoomInitialized
Definition sch_screen.h:702
bool FileExists() const
Definition sch_screen.h:160
SPIN_STYLE GetLabelOrientationForPoint(const VECTOR2I &aPosition, SPIN_STYLE aDefaultOrientation, const SCH_SHEET_PATH *aSheet) const
int ClearSelection(const TOOL_EVENT &aEvent)
Select all visible items in sheet.
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:140
Schematic symbol object.
Definition sch_symbol.h:76
EMBEDDED_FILES * GetEmbeddedFiles() override
SCH_SYMBOLs don't currently support embedded files, but their LIB_SYMBOL counterparts do.
bool IsAnnotated(const SCH_SHEET_PATH *aSheet) const
Check if the symbol has a valid annotation (reference) for the given sheet path.
std::vector< const SCH_PIN * > GetPins(const SCH_SHEET_PATH *aSheet) const
Retrieve a list of the SCH_PINs for the given sheet path.
SCH_PIN * GetPin(const wxString &number) const
Find a symbol pin by number.
std::unique_ptr< LIB_SYMBOL > & GetLibSymbolRef()
Definition sch_symbol.h:184
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const override
VECTOR2I GetPosition() const override
Definition sch_text.h:150
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, const std::vector< SCH_PIN * > &aPins, REPORTER &aReporter)
void SetFilesStack(std::vector< EMBEDDED_FILES * > aFilesStack)
Definition sim_lib_mgr.h:48
Symbol library viewer main window.
The symbol library editor main window.
Symbol library viewer main window.
void AddTemplateFieldNames(const wxString &aSerializedFieldNames)
Add a serialized list of template field names.
void DeleteAllFieldNameTemplates(bool aGlobal)
Delete the entire contents.
TOOL_MANAGER * m_toolManager
TOOL_DISPATCHER * m_toolDispatcher
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
ACTIONS * m_actions
@ REDRAW
Full drawing refresh.
Definition tool_base.h:83
@ MODEL_RELOAD
Model changes (the sheet for a schematic)
Definition tool_base.h:80
Generic, UI-independent tool event.
Definition tool_event.h:171
Master controller class:
bool RunAction(const std::string &aActionName, T aParam)
Run the specified action immediately, pausing the current action to run the new one.
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:778
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:150
int GetLastUnsavedChangesResponse()
Return the result code from the last call to HandleUnsavedChanges(): wxID_YES, wxID_NO or wxID_CANCEL...
Definition confirm.cpp:163
void DisplayError(wxWindow *aParent, const wxString &aText)
Display an error or warning message box with aMessage.
Definition confirm.cpp:196
This file is part of the common library.
#define CHECK(x)
#define ENABLE(x)
#define _(s)
wxDEFINE_EVENT(wxEVT_REFRESH_CUSTOM_COMMAND, wxEvent)
#define KICAD_DEFAULT_DRAWFRAME_STYLE
#define SCH_EDIT_FRAME_NAME
@ NO_RECURSE
Definition eda_item.h:54
#define IGNORE_PARENT_GROUP
Definition eda_item.h:57
@ 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:42
@ FRAME_SCH_SYMBOL_EDITOR
Definition frame_type.h:35
@ FRAME_SCH_VIEWER
Definition frame_type.h:36
@ FRAME_SCH
Definition frame_type.h:34
@ FRAME_SIMULATOR
Definition frame_type.h:38
@ FRAME_CVPCB
Definition frame_type.h:52
@ FRAME_SYMBOL_CHOOSER
Definition frame_type.h:37
int ExecuteFile(const wxString &aEditorName, const wxString &aFileName, wxProcess *aCallback, bool aFileForKicad)
Call the executable file aEditorName with the parameter aFileName.
Definition gestfich.cpp:147
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:29
@ ID_ON_GRID_SELECT
Definition id.h:116
@ ID_FILE_LIST_CLEAR
Definition id.h:62
@ ID_EDA_SOCKET_EVENT
Definition id.h:136
@ ID_EDA_SOCKET_EVENT_SERV
Definition id.h:135
@ ID_ON_ZOOM_SELECT
Definition id.h:115
@ ID_FILEMAX
Definition id.h:60
@ ID_FILE1
Definition id.h:59
PROJECT & Prj()
Definition kicad.cpp:644
KIID niluuid(0)
#define KICTL_CREATE
caller thinks requested project files may not exist.
@ LAYER_ERC_WARN
Definition layer_ids.h:481
@ LAYER_ERC_EXCLUSION
Definition layer_ids.h:483
@ LAYER_ERC_ERR
Definition layer_ids.h:482
@ LAYER_OP_CURRENTS
Definition layer_ids.h:504
@ LAYER_INTERSHEET_REFS
Definition layer_ids.h:465
@ LAYER_OP_VOLTAGES
Definition layer_ids.h:503
@ MAIL_PCB_UPDATE
Definition mail_type.h:46
@ REPAINT
Item needs to be redrawn.
Definition view_item.h:58
@ GEOMETRY
Position or shape has changed.
Definition view_item.h:55
void SetShutdownBlockReason(wxWindow *aWindow, const wxString &aReason)
Sets the block reason why the window/application is preventing OS shutdown.
Definition unix/app.cpp: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:435
#define _HKI(x)
Definition page_info.cpp:44
PGM_BASE & Pgm()
The global program "get" accessor.
see class PGM_BASE
SEVERITY
#define DIFF_SYMBOLS_DIALOG_NAME
#define CURRENT_TOOL(action)
@ AUTOPLACE_AUTO
Definition sch_item.h:71
SCH_CLEANUP_FLAGS
Definition schematic.h:75
@ GLOBAL_CLEANUP
Definition schematic.h:78
T * GetToolbarSettings(const wxString &aFilename)
T * GetAppSettings(const char *aFilename)
KIWAY Kiway(KFCTL_STANDALONE)
std::vector< FAB_LAYER_COLOR > dummy
wxString UnescapeString(const wxString &aSource)
Implement a participant in the KIWAY alchemy.
Definition kiway.h:156
virtual void PreloadLibraries(KIWAY *aKiway)
Definition kiway.h:279
std::string refName
std::string path
KIBIS_MODEL * model
KIBIS_PIN * pin
wxLogTrace helper definitions.
@ SCH_GROUP_T
Definition typeinfo.h:174
@ SCH_LINE_T
Definition typeinfo.h:164
@ SCH_SYMBOL_T
Definition typeinfo.h:173
@ SCH_HIER_LABEL_T
Definition typeinfo.h:170
@ SCH_GLOBAL_LABEL_T
Definition typeinfo.h:169
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:687
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.