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
146
147 EVT_MENU( wxID_EXIT, SCH_EDIT_FRAME::OnExit )
148 EVT_MENU( wxID_CLOSE, SCH_EDIT_FRAME::OnExit )
149
152
153 // Drop files event
154 EVT_DROP_FILES( SCH_EDIT_FRAME::OnDropFiles )
155END_EVENT_TABLE()
156
157
158wxDEFINE_EVENT( EDA_EVT_SCHEMATIC_CHANGING, wxCommandEvent );
159wxDEFINE_EVENT( EDA_EVT_SCHEMATIC_CHANGED, wxCommandEvent );
160
161
162SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
163 SCH_BASE_FRAME( aKiway, aParent, FRAME_SCH, wxT( "Eeschema" ), wxDefaultPosition,
165 m_ercDialog( nullptr ),
166 m_diffSymbolDialog( nullptr ),
167 m_symbolFieldsTableDialog( nullptr ),
168 m_netNavigator( nullptr ),
169 m_netNavigatorFilter( nullptr ),
173 m_designBlocksPane( nullptr ),
174 m_remoteSymbolPane( nullptr ),
175 m_currentVariantCtrl( nullptr )
176{
177 m_maximizeByDefault = true;
178 m_schematic = new SCHEMATIC( &Prj() );
179 m_schematic->SetSchematicHolder( this );
181
182 m_showBorderAndTitleBlock = true; // true to show sheet references
183 m_supportsAutoSave = true;
185 m_aboutTitle = _HKI( "KiCad Schematic Editor" );
186 m_show_search = false;
187 // Ensure timer has an owner before binding so it generates events.
188 m_crossProbeFlashTimer.SetOwner( this );
189 Bind( wxEVT_TIMER, &SCH_EDIT_FRAME::OnCrossProbeFlashTimer, this, m_crossProbeFlashTimer.GetId() );
190
191 // Give an icon
192 wxIcon icon;
193 wxIconBundle icon_bundle;
194
195 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_eeschema, 48 ) );
196 icon_bundle.AddIcon( icon );
197 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_eeschema, 128 ) );
198 icon_bundle.AddIcon( icon );
199 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_eeschema, 256 ) );
200 icon_bundle.AddIcon( icon );
201 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_eeschema_32 ) );
202 icon_bundle.AddIcon( icon );
203 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_eeschema_16 ) );
204 icon_bundle.AddIcon( icon );
205
206 SetIcons( icon_bundle );
207
209
210 setupTools();
213
217
218 // Ensure the "Line modes" toolbar group shows the current angle mode on startup
219 if( GetToolManager() )
221
222#ifdef KICAD_IPC_API
223 wxTheApp->Bind( EDA_EVT_PLUGIN_AVAILABILITY_CHANGED, &SCH_EDIT_FRAME::onPluginAvailabilityChanged, this );
224#endif
225
226 m_hierarchy = new HIERARCHY_PANE( this );
227
228 // Initialize common print setup dialog settings.
229 m_pageSetupData.GetPrintData().SetPrintMode( wxPRINT_MODE_PRINTER );
230 m_pageSetupData.GetPrintData().SetQuality( wxPRINT_QUALITY_MEDIUM );
231 m_pageSetupData.GetPrintData().SetBin( wxPRINTBIN_AUTO );
232 m_pageSetupData.GetPrintData().SetNoCopies( 1 );
233
234 m_searchPane = new SCH_SEARCH_PANE( this );
235 m_propertiesPanel = new SCH_PROPERTIES_PANEL( this, this );
237
238 m_propertiesPanel->SetSplitterProportion( eeconfig()->m_AuiPanels.properties_splitter );
239
242
243 m_auimgr.SetManagedWindow( this );
244
246
247 // Fetch a COPY of the config as a lot of these initializations are going to overwrite our
248 // data.
249 EESCHEMA_SETTINGS::AUI_PANELS aui_cfg = eeconfig()->m_AuiPanels;
250 EESCHEMA_SETTINGS::APPEARANCE appearance_cfg = eeconfig()->m_Appearance;
251
252 // Rows; layers 4 - 6
253 m_auimgr.AddPane( m_tbTopMain, EDA_PANE().HToolbar().Name( wxS( "TopMainToolbar" ) )
254 .Top().Layer( 6 ) );
255
256 m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( wxS( "MsgPanel" ) )
257 .Bottom().Layer( 6 ) );
258
259 // Columns; layers 1 - 3
260 m_auimgr.AddPane( m_hierarchy, EDA_PANE().Palette().Name( SchematicHierarchyPaneName() )
261 .Caption( _( "Schematic Hierarchy" ) )
262 .Left().Layer( 3 ).Position( 1 )
263 .TopDockable( false )
264 .BottomDockable( false )
265 .CloseButton( true )
266 .MinSize( FromDIP( wxSize( 120, 60 ) ) )
267 .BestSize( FromDIP( wxSize( 200, 200 ) ) )
268 .FloatingSize( FromDIP( wxSize( 200, 200 ) ) )
269 .FloatingPosition( FromDIP( wxPoint( 50, 50 ) ) )
270 .Show( false ) );
271
274
277
279
280 m_auimgr.AddPane( m_tbLeft, EDA_PANE().VToolbar().Name( wxS( "LeftToolbar" ) )
281 .Left().Layer( 2 ) );
282
283 m_auimgr.AddPane( m_tbRight, EDA_PANE().VToolbar().Name( wxS( "RightToolbar" ) )
284 .Right().Layer( 2 ) );
285
286 // Center
287 m_auimgr.AddPane( GetCanvas(), EDA_PANE().Canvas().Name( wxS( "DrawFrame" ) )
288 .Center() );
289
290 m_auimgr.AddPane( m_searchPane, EDA_PANE()
291 .Name( SearchPaneName() )
292 .Bottom()
293 .Caption( _( "Search" ) )
294 .PaneBorder( false )
295 .MinSize( FromDIP( wxSize( 180, 60 ) ) )
296 .BestSize( FromDIP( wxSize( 180, 100 ) ) )
297 .FloatingSize( FromDIP( wxSize( 480, 200 ) ) )
298 .CloseButton( true )
299 .DestroyOnClose( false )
300 .Show( m_show_search ) );
301
304
305 wxAuiPaneInfo& hierarchy_pane = m_auimgr.GetPane( SchematicHierarchyPaneName() );
306 wxAuiPaneInfo& netNavigatorPane = m_auimgr.GetPane( NetNavigatorPaneName() );
307 wxAuiPaneInfo& propertiesPane = m_auimgr.GetPane( PropertiesPaneName() );
308 wxAuiPaneInfo& selectionFilterPane = m_auimgr.GetPane( wxS( "SelectionFilter" ) );
309 wxAuiPaneInfo& designBlocksPane = m_auimgr.GetPane( DesignBlocksPaneName() );
310 wxAuiPaneInfo& remoteSymbolPane = m_auimgr.GetPane( RemoteSymbolPaneName() );
311
312 hierarchy_pane.Show( aui_cfg.show_schematic_hierarchy );
313 netNavigatorPane.Show( aui_cfg.show_net_nav_panel );
314 propertiesPane.Show( aui_cfg.show_properties );
315 designBlocksPane.Show( aui_cfg.design_blocks_show );
316
317 if( m_remoteSymbolPane && !m_remoteSymbolPane->HasDataSources() )
318 remoteSymbolPane.Show( false );
319 else
320 remoteSymbolPane.Show( aui_cfg.remote_symbol_show );
321
323
324 // The selection filter doesn't need to grow in the vertical direction when docked
325 selectionFilterPane.dock_proportion = 0;
326
327 if( aui_cfg.hierarchy_panel_float_width > 0 && aui_cfg.hierarchy_panel_float_height > 0 )
328 {
329 // Show at end, after positioning
330 hierarchy_pane.FloatingSize( aui_cfg.hierarchy_panel_float_width,
332 }
333
334 if( aui_cfg.net_nav_panel_float_size.GetWidth() > 0
335 && aui_cfg.net_nav_panel_float_size.GetHeight() > 0 )
336 {
337 netNavigatorPane.FloatingSize( aui_cfg.net_nav_panel_float_size );
338 netNavigatorPane.FloatingPosition( aui_cfg.net_nav_panel_float_pos );
339 }
340
341 if( aui_cfg.properties_panel_width > 0 )
342 SetAuiPaneSize( m_auimgr, propertiesPane, aui_cfg.properties_panel_width, -1 );
343
344 if( aui_cfg.schematic_hierarchy_float )
345 hierarchy_pane.Float();
346
347 if( aui_cfg.search_panel_height > 0 && ( aui_cfg.search_panel_dock_direction == wxAUI_DOCK_TOP
348 || aui_cfg.search_panel_dock_direction == wxAUI_DOCK_BOTTOM ) )
349 {
350 wxAuiPaneInfo& searchPane = m_auimgr.GetPane( SearchPaneName() );
351 searchPane.Direction( aui_cfg.search_panel_dock_direction );
352 SetAuiPaneSize( m_auimgr, searchPane, -1, aui_cfg.search_panel_height );
353 }
354
355 else if( aui_cfg.search_panel_width > 0 && ( aui_cfg.search_panel_dock_direction == wxAUI_DOCK_LEFT
356 || aui_cfg.search_panel_dock_direction == wxAUI_DOCK_RIGHT ) )
357 {
358 wxAuiPaneInfo& searchPane = m_auimgr.GetPane( SearchPaneName() );
359 searchPane.Direction( aui_cfg.search_panel_dock_direction );
360 SetAuiPaneSize( m_auimgr, searchPane, aui_cfg.search_panel_width, -1 );
361 }
362
363 if( aui_cfg.float_net_nav_panel )
364 netNavigatorPane.Float();
365
366 if( aui_cfg.design_blocks_show )
367 SetAuiPaneSize( m_auimgr, designBlocksPane, aui_cfg.design_blocks_panel_docked_width, -1 );
368
369 if( aui_cfg.remote_symbol_show )
370 {
371 SetAuiPaneSize( m_auimgr, remoteSymbolPane, aui_cfg.remote_symbol_panel_docked_width, -1 );
372 }
373
374 if( aui_cfg.hierarchy_panel_docked_width > 0 )
375 {
376 // If the net navigator is not show, let the hierarchy navigator take all of the vertical
377 // space.
378 if( !aui_cfg.show_net_nav_panel )
379 {
380 SetAuiPaneSize( m_auimgr, hierarchy_pane, aui_cfg.hierarchy_panel_docked_width, -1 );
381 }
382 else
383 {
384 SetAuiPaneSize( m_auimgr, hierarchy_pane,
387
388 SetAuiPaneSize( m_auimgr, netNavigatorPane,
389 aui_cfg.net_nav_panel_docked_size.GetWidth(),
390 aui_cfg.net_nav_panel_docked_size.GetHeight() );
391 }
392
393 // wxAUI hack: force width by setting MinSize() and then Fixed()
394 // thanks to ZenJu https://github.com/wxWidgets/wxWidgets/issues/13180
395 hierarchy_pane.MinSize( aui_cfg.hierarchy_panel_docked_width, 60 );
396 hierarchy_pane.Fixed();
397 netNavigatorPane.MinSize( aui_cfg.net_nav_panel_docked_size.GetWidth(), 60 );
398 netNavigatorPane.Fixed();
399 m_auimgr.Update();
400
401 // now make it resizable again
402 hierarchy_pane.Resizable();
403 netNavigatorPane.Resizable();
404 m_auimgr.Update();
405
406 // Note: DO NOT call m_auimgr.Update() anywhere after this; it will nuke the size
407 // back to minimum.
408 hierarchy_pane.MinSize( FromDIP( wxSize( 120, 60 ) ) );
409 netNavigatorPane.MinSize( FromDIP( wxSize( 120, 60 ) ) );
410 }
411 else
412 {
413 m_auimgr.Update();
414 }
415
416 CallAfter( [this]()
417 {
418 wxAuiPaneInfo& remotePane = m_auimgr.GetPane( RemoteSymbolPaneName() );
419
420 if( remotePane.IsShown() && m_remoteSymbolPane )
421 m_remoteSymbolPane->Activate();
422 } );
423
426
427 GetCanvas()->GetGAL()->SetAxesEnabled( false );
428
429 KIGFX::SCH_VIEW* view = GetCanvas()->GetView();
430 static_cast<KIGFX::SCH_PAINTER*>( view->GetPainter() )->SetSchematic( m_schematic );
431
434
435 view->SetLayerVisible( LAYER_ERC_ERR, appearance_cfg.show_erc_errors );
436 view->SetLayerVisible( LAYER_ERC_WARN, appearance_cfg.show_erc_warnings );
438 view->SetLayerVisible( LAYER_OP_VOLTAGES, appearance_cfg.show_op_voltages );
439 view->SetLayerVisible( LAYER_OP_CURRENTS, appearance_cfg.show_op_currents );
440
442
444 m_netNavigator->Bind( wxEVT_TREE_SEL_CHANGING, &SCH_EDIT_FRAME::onNetNavigatorSelChanging, this );
445 m_netNavigator->Bind( wxEVT_TREE_SEL_CHANGED, &SCH_EDIT_FRAME::onNetNavigatorSelection, this );
446 m_netNavigator->Bind( wxEVT_SIZE, &SCH_EDIT_FRAME::onResizeNetNavigator, this );
447
448 // This is used temporarily to fix a client size issue on GTK that causes zoom to fit
449 // to calculate the wrong zoom size. See SCH_EDIT_FRAME::onSize().
450 Bind( wxEVT_SIZE, &SCH_EDIT_FRAME::onSize, this );
451
452 setupUnits( eeconfig() );
453
454 // Net list generator
456
457 updateTitle();
458 m_toolManager->GetTool<SCH_NAVIGATE_TOOL>()->ResetHistory();
459
460#ifdef KICAD_IPC_API
461 m_apiHandler = std::make_unique<API_HANDLER_SCH>( this );
462 Pgm().GetApiServer().RegisterHandler( m_apiHandler.get() );
463#endif
464
465 // Default shutdown reason until a file is loaded
466 KIPLATFORM::APP::SetShutdownBlockReason( this, _( "New schematic file is unsaved" ) );
467
468 // Init for dropping files
472 m_acceptedExts.emplace( wxS( "jpeg" ), &SCH_ACTIONS::ddAddImage );
473 m_acceptedExts.emplace( wxS( "dxf" ), &SCH_ACTIONS::ddImportGraphics );
475 DragAcceptFiles( true );
476
477 // Ensure the window is on top
478 Raise();
479
480 // Now that all sizes are fixed, set the initial hierarchy_pane floating position to the
481 // top-left corner of the canvas
482 wxPoint canvas_pos = GetCanvas()->GetScreenPosition();
483 hierarchy_pane.FloatingPosition( canvas_pos.x + 10, canvas_pos.y + 10 );
484
485 Bind( wxEVT_CHOICE, &SCH_EDIT_FRAME::onVariantSelected, this );
486 Bind( EDA_EVT_CLOSE_DIALOG_BOOK_REPORTER, &SCH_EDIT_FRAME::onCloseSymbolDiffDialog, this );
487 Bind( EDA_EVT_CLOSE_ERC_DIALOG, &SCH_EDIT_FRAME::onCloseErcDialog, this );
488 Bind( EDA_EVT_CLOSE_DIALOG_SYMBOL_FIELDS_TABLE, &SCH_EDIT_FRAME::onCloseSymbolFieldsTableDialog, this );
489}
490
491void SCH_EDIT_FRAME::StartCrossProbeFlash( const std::vector<SCH_ITEM*>& aItems )
492{
493 if( !eeconfig()->m_CrossProbing.flash_selection )
494 {
495 wxLogTrace( traceCrossProbeFlash, "StartCrossProbeFlash: aborted (setting disabled) items=%zu", aItems.size() );
496 return;
497 }
498
499 if( aItems.empty() )
500 {
501 wxLogTrace( traceCrossProbeFlash, "StartCrossProbeFlash: aborted (no items)" );
502 return;
503 }
504
506 {
507 wxLogTrace( traceCrossProbeFlash, "StartCrossProbeFlash: restarting existing flash (phase=%d)",
510 }
511
512 wxLogTrace( traceCrossProbeFlash, "StartCrossProbeFlash: starting with %zu items", aItems.size() );
514
515 for( SCH_ITEM* it : aItems )
516 m_crossProbeFlashItems.push_back( it->m_Uuid );
517
520
521 if( !m_crossProbeFlashTimer.GetOwner() )
522 m_crossProbeFlashTimer.SetOwner( this );
523
524 bool started = m_crossProbeFlashTimer.Start( 500, wxTIMER_CONTINUOUS );
525 wxLogTrace( traceCrossProbeFlash, "StartCrossProbeFlash: timer start=%d id=%d", (int) started,
526 m_crossProbeFlashTimer.GetId() );
527}
528
529
530void SCH_EDIT_FRAME::OnCrossProbeFlashTimer( wxTimerEvent& aEvent )
531{
532 wxLogTrace( traceCrossProbeFlash, "Timer(SCH) fired: phase=%d running=%d items=%zu", m_crossProbeFlashPhase,
534
536 {
537 wxLogTrace( traceCrossProbeFlash, "Timer fired but not flashing (ignored)" );
538 return;
539 }
540
542
543 if( !selTool )
544 return;
545
546 bool prevGuard = m_syncingPcbToSchSelection;
548
549 if( m_crossProbeFlashPhase % 2 == 0 )
550 {
551 selTool->ClearSelection( true );
552 wxLogTrace( traceCrossProbeFlash, "Phase %d: cleared selection", m_crossProbeFlashPhase );
553 }
554 else
555 {
556 for( const KIID& id : m_crossProbeFlashItems )
557 {
558 if( SCH_ITEM* item = Schematic().ResolveItem( id, nullptr, true ) )
559 selTool->AddItemToSel( item, true );
560 }
561
562 wxLogTrace( traceCrossProbeFlash, "Phase %d: restored %zu items", m_crossProbeFlashPhase,
563 m_crossProbeFlashItems.size() );
564 }
565
566 if( GetCanvas() )
567 {
569 wxLogTrace( traceCrossProbeFlash, "Phase %d: forced canvas refresh", m_crossProbeFlashPhase );
570 }
571
572 m_syncingPcbToSchSelection = prevGuard;
574
575 if( m_crossProbeFlashPhase > 6 )
576 {
577 for( const KIID& id : m_crossProbeFlashItems )
578 {
579 if( SCH_ITEM* item = Schematic().ResolveItem( id, nullptr, true ) )
580 selTool->AddItemToSel( item, true );
581 }
582
583 m_crossProbeFlashing = false;
585 wxLogTrace( traceCrossProbeFlash, "Flashing complete. Final selection size=%zu",
586 m_crossProbeFlashItems.size() );
587 }
588}
589
590
592{
593 m_hierarchy->Unbind( wxEVT_SIZE, &SCH_EDIT_FRAME::OnResizeHierarchyNavigator, this );
594
595 // Ensure m_canvasType is up to date, to save it in config
597
598 SetScreen( nullptr );
599
600 if( m_schematic )
601 m_schematic->RemoveAllListeners();
602
603 // Delete all items not in draw list before deleting schematic
604 // to avoid dangling pointers stored in these items
607
608 delete m_schematic;
609 m_schematic = nullptr;
610
611 // Close the project if we are standalone, so it gets cleaned up properly
612 if( Kiface().IsSingle() )
613 {
614 try
615 {
616 GetSettingsManager()->UnloadProject( &Prj(), false );
617 }
618 catch( const std::runtime_error& e )
619 {
620 wxFAIL_MSG( wxString::Format( wxT( "Settings exception occurred: %s" ), e.what() ) );
621 }
622 }
623
624 // We passed ownership of these to wxAuiManager.
625 // delete m_hierarchy;
626 // delete m_selectionFilterPanel;
627}
628
629
631{
632 aEvent.Skip();
633
634 // 1st Call: Handle the size update during the first resize event.
636
637 // Defer the second size capture
638 CallAfter( [this]()
639 {
641 } );
642}
643
644
646{
647 // Called when resizing the Hierarchy Navigator panel
648 // Store the current pane size
649 // It allows to retrieve the last defined pane size when switching between
650 // docked and floating pane state
651 // Note: *DO NOT* call m_auimgr.Update() here: it crashes KiCad at least on Windows
652
653 EESCHEMA_SETTINGS* cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
654 wxAuiPaneInfo& hierarchy_pane = m_auimgr.GetPane( SchematicHierarchyPaneName() );
655
656 if( cfg && m_hierarchy->IsShownOnScreen() )
657 {
658 cfg->m_AuiPanels.hierarchy_panel_float_width = hierarchy_pane.floating_size.x;
659 cfg->m_AuiPanels.hierarchy_panel_float_height = hierarchy_pane.floating_size.y;
660
661 // initialize hierarchy_panel_docked_width and best size only if the hierarchy_pane
662 // width is > 0 (i.e. if its size is already set and has meaning)
663 // if it is floating, its size is not initialized (only floating_size is initialized)
664 // initializing hierarchy_pane.best_size is useful when switching to float pane and
665 // after switching to the docked pane, to retrieve the last docked pane width
666 if( hierarchy_pane.rect.width > 50 ) // 50 is a good margin
667 {
668 cfg->m_AuiPanels.hierarchy_panel_docked_width = hierarchy_pane.rect.width;
669 hierarchy_pane.best_size.x = hierarchy_pane.rect.width;
670 }
671 }
672}
673
674
676{
677 // Create the manager and dispatcher & route draw panel events to the dispatcher
679 m_toolManager->SetEnvironment( &Schematic(), GetCanvas()->GetView(),
680 GetCanvas()->GetViewControls(), config(), this );
681 m_actions = new SCH_ACTIONS();
683
684 // Register tools
685 m_toolManager->RegisterTool( new COMMON_CONTROL );
686 m_toolManager->RegisterTool( new COMMON_TOOLS );
687 m_toolManager->RegisterTool( new ZOOM_TOOL );
688 m_toolManager->RegisterTool( new SCH_SELECTION_TOOL );
689 m_toolManager->RegisterTool( new PICKER_TOOL );
690 m_toolManager->RegisterTool( new SCH_DRAWING_TOOLS );
691 m_toolManager->RegisterTool( new SCH_LINE_WIRE_BUS_TOOL );
692 m_toolManager->RegisterTool( new SCH_MOVE_TOOL );
693 m_toolManager->RegisterTool( new SCH_ALIGN_TOOL );
694 m_toolManager->RegisterTool( new SCH_EDIT_TOOL );
695 m_toolManager->RegisterTool( new SCH_EDIT_TABLE_TOOL );
696 m_toolManager->RegisterTool( new SCH_GROUP_TOOL );
697 m_toolManager->RegisterTool( new SCH_INSPECTION_TOOL );
698 m_toolManager->RegisterTool( new SCH_DESIGN_BLOCK_CONTROL );
699 m_toolManager->RegisterTool( new SCH_EDITOR_CONTROL );
700 m_toolManager->RegisterTool( new SCH_FIND_REPLACE_TOOL );
701 m_toolManager->RegisterTool( new SCH_POINT_EDITOR );
702 m_toolManager->RegisterTool( new SCH_NAVIGATE_TOOL );
703 m_toolManager->RegisterTool( new PROPERTIES_TOOL );
704 m_toolManager->RegisterTool( new EMBED_TOOL );
705 m_toolManager->InitTools();
706
707 // Run the selection tool, it is supposed to be always active
709
711}
712
713
715{
717
718 ACTION_MANAGER* mgr = m_toolManager->GetActionManager();
719 SCH_EDITOR_CONDITIONS cond( this );
720
721 wxASSERT( mgr );
722
723 auto hasElements =
724 [ this ] ( const SELECTION& aSel )
725 {
726 return GetScreen() &&
727 ( !GetScreen()->Items().empty() || !SELECTION_CONDITIONS::Idle( aSel ) );
728 };
729
730 auto searchPaneCond =
731 [this] ( const SELECTION& )
732 {
733 return m_auimgr.GetPane( SearchPaneName() ).IsShown();
734 };
735
736 auto propertiesCond =
737 [this] ( const SELECTION& )
738 {
739 return m_auimgr.GetPane( PropertiesPaneName() ).IsShown();
740 };
741
742 auto hierarchyNavigatorCond =
743 [ this ] ( const SELECTION& aSel )
744 {
745 return m_auimgr.GetPane( SchematicHierarchyPaneName() ).IsShown();
746 };
747
748 auto netNavigatorCond =
749 [ this ] (const SELECTION& aSel )
750 {
751 return m_auimgr.GetPane( NetNavigatorPaneName() ).IsShown();
752 };
753
754 auto designBlockCond =
755 [ this ] (const SELECTION& aSel )
756 {
757 return m_auimgr.GetPane( DesignBlocksPaneName() ).IsShown();
758 };
759
760 auto remoteSymbolCond =
761 [ this ] (const SELECTION& aSel )
762 {
763 return m_auimgr.GetPane( RemoteSymbolPaneName() ).IsShown();
764 };
765
766 auto undoCond =
767 [ this ] (const SELECTION& aSel )
768 {
770 return true;
771
772 return GetUndoCommandCount() > 0;
773 };
774
775 auto groupWithDesignBlockLink =
776 [] ( const SELECTION& aSel )
777 {
778 if( aSel.Size() != 1 )
779 return false;
780
781 if( aSel[0]->Type() != SCH_GROUP_T )
782 return false;
783
784 SCH_GROUP* group = static_cast<SCH_GROUP*>( aSel.GetItem( 0 ) );
785
786 return group->HasDesignBlockLink();
787 };
788
789#define ENABLE( x ) ACTION_CONDITIONS().Enable( x )
790#define CHECK( x ) ACTION_CONDITIONS().Check( x )
791
793 mgr->SetConditions( ACTIONS::undo, ENABLE( undoCond ) );
795
796 mgr->SetConditions( SCH_ACTIONS::showSearch, CHECK( searchPaneCond ) );
797 mgr->SetConditions( SCH_ACTIONS::showHierarchy, CHECK( hierarchyNavigatorCond ) );
798 mgr->SetConditions( SCH_ACTIONS::showNetNavigator, CHECK( netNavigatorCond ) );
799 mgr->SetConditions( ACTIONS::showProperties, CHECK( propertiesCond ) );
800 mgr->SetConditions( SCH_ACTIONS::showDesignBlockPanel, CHECK( designBlockCond ) );
801 mgr->SetConditions( SCH_ACTIONS::showRemoteSymbolPanel, CHECK( remoteSymbolCond ) );
804
805 mgr->SetConditions( ACTIONS::cut, ENABLE( hasElements ) );
806 mgr->SetConditions( ACTIONS::copy, ENABLE( hasElements ) );
807 mgr->SetConditions( ACTIONS::copyAsText, ENABLE( hasElements ) );
810 mgr->SetConditions( ACTIONS::doDelete, ENABLE( hasElements ) );
811 mgr->SetConditions( ACTIONS::duplicate, ENABLE( hasElements ) );
818 mgr->SetConditions( ACTIONS::selectAll, ENABLE( hasElements ) );
819 mgr->SetConditions( ACTIONS::unselectAll, ENABLE( hasElements ) );
820
821 mgr->SetConditions( SCH_ACTIONS::rotateCW, ENABLE( hasElements ) );
822 mgr->SetConditions( SCH_ACTIONS::rotateCCW, ENABLE( hasElements ) );
823 mgr->SetConditions( SCH_ACTIONS::mirrorH, ENABLE( hasElements ) );
824 mgr->SetConditions( SCH_ACTIONS::mirrorV, ENABLE( hasElements ) );
827
828 mgr->SetConditions( SCH_ACTIONS::placeLinkedDesignBlock, ENABLE( groupWithDesignBlockLink ) );
829 mgr->SetConditions( SCH_ACTIONS::saveToLinkedDesignBlock, ENABLE( groupWithDesignBlockLink ) );
830
835
836 auto showHiddenPinsCond =
837 [this]( const SELECTION& )
838 {
839 return GetShowAllPins();
840 };
841
842 auto showHiddenFieldsCond =
843 [this]( const SELECTION& )
844 {
846 return cfg && cfg->m_Appearance.show_hidden_fields;
847 };
848
849 auto showDirectiveLabelsCond =
850 [this]( const SELECTION& )
851 {
853 return cfg && cfg->m_Appearance.show_directive_labels;
854 };
855
856 auto showERCErrorsCond =
857 [this]( const SELECTION& )
858 {
860 return cfg && cfg->m_Appearance.show_erc_errors;
861 };
862
863 auto showERCWarningsCond =
864 [this]( const SELECTION& )
865 {
867 return cfg && cfg->m_Appearance.show_erc_warnings;
868 };
869
870 auto showERCExclusionsCond =
871 [this]( const SELECTION& )
872 {
874 return cfg && cfg->m_Appearance.show_erc_exclusions;
875 };
876
877 auto markSimExclusionsCond =
878 [this]( const SELECTION& )
879 {
881 return cfg && cfg->m_Appearance.mark_sim_exclusions;
882 };
883
884 auto showOPVoltagesCond =
885 [this]( const SELECTION& )
886 {
888 return cfg && cfg->m_Appearance.show_op_voltages;
889 };
890
891 auto showOPCurrentsCond =
892 [this]( const SELECTION& )
893 {
895 return cfg && cfg->m_Appearance.show_op_currents;
896 };
897
898 auto showPinAltModeIconsCond =
899 [this]( const SELECTION& )
900 {
902 return cfg && cfg->m_Appearance.show_pin_alt_icons;
903 };
904
905 auto showAnnotateAutomaticallyCond =
906 [this]( const SELECTION& )
907 {
909 };
910
911 auto remapSymbolsCondition =
912 [&]( const SELECTION& aSel )
913 {
914 SCH_SCREENS schematic( Schematic().Root() );
915
916 // The remapping can only be performed on legacy projects.
917 return schematic.HasNoFullyDefinedLibIds();
918 };
919
920 auto belowRootSheetCondition =
921 [this]( const SELECTION& aSel )
922 {
923 SCH_NAVIGATE_TOOL* navigateTool = m_toolManager->GetTool<SCH_NAVIGATE_TOOL>();
924 return navigateTool && navigateTool->CanGoUp();
925 };
926
927 mgr->SetConditions( SCH_ACTIONS::leaveSheet, ENABLE( belowRootSheetCondition ) );
928
929 /* Some of these are bound by default to arrow keys which will get a different action if we
930 * disable the buttons. So always leave them enabled so the action is consistent.
931 * https://gitlab.com/kicad/code/kicad/-/issues/14783
932 mgr->SetConditions( SCH_ACTIONS::navigateUp, ENABLE( belowRootSheetCondition ) );
933 mgr->SetConditions( SCH_ACTIONS::navigateForward, ENABLE( navHistoryHasForward ) );
934 mgr->SetConditions( SCH_ACTIONS::navigateBack, ENABLE( navHistoryHsBackward ) );
935 */
936
937 mgr->SetConditions( SCH_ACTIONS::remapSymbols, ENABLE( remapSymbolsCondition ) );
938 mgr->SetConditions( SCH_ACTIONS::toggleHiddenPins, CHECK( showHiddenPinsCond ) );
939 mgr->SetConditions( SCH_ACTIONS::toggleHiddenFields, CHECK( showHiddenFieldsCond ) );
940 mgr->SetConditions( SCH_ACTIONS::toggleDirectiveLabels, CHECK( showDirectiveLabelsCond ) );
941 mgr->SetConditions( SCH_ACTIONS::toggleERCErrors, CHECK( showERCErrorsCond ) );
942 mgr->SetConditions( SCH_ACTIONS::toggleERCWarnings, CHECK( showERCWarningsCond ) );
943 mgr->SetConditions( SCH_ACTIONS::toggleERCExclusions, CHECK( showERCExclusionsCond ) );
944 mgr->SetConditions( SCH_ACTIONS::markSimExclusions, CHECK( markSimExclusionsCond ) );
945 mgr->SetConditions( SCH_ACTIONS::toggleOPVoltages, CHECK( showOPVoltagesCond ) );
946 mgr->SetConditions( SCH_ACTIONS::toggleOPCurrents, CHECK( showOPCurrentsCond ) );
947 mgr->SetConditions( SCH_ACTIONS::togglePinAltIcons, CHECK( showPinAltModeIconsCond ) );
948 mgr->SetConditions( SCH_ACTIONS::toggleAnnotateAuto, CHECK( showAnnotateAutomaticallyCond ) );
950
953
954#define CURRENT_TOOL( action ) mgr->SetConditions( action, CHECK( cond.CurrentTool( action ) ) )
955
985
986#undef CURRENT_TOOL
987#undef CHECK
988#undef ENABLE
989}
990
991
993{
994 // we cannot store a pointer to an item in the display list here since
995 // that item may be deleted, such as part of a line concatenation or other.
996 // So simply always keep a copy of the object which is to be repeated.
997
998 if( aItem )
999 {
1000 m_items_to_repeat.clear();
1001
1002 AddCopyForRepeatItem( aItem );
1003 }
1004}
1005
1006
1008{
1009 // we cannot store a pointer to an item in the display list here since
1010 // that item may be deleted, such as part of a line concatenation or other.
1011 // So simply always keep a copy of the object which is to be repeated.
1012
1013 if( aItem )
1014 {
1015 std::unique_ptr<SCH_ITEM> repeatItem( static_cast<SCH_ITEM*>( aItem->Duplicate( IGNORE_PARENT_GROUP ) ) );
1016
1017 // Clone() preserves the flags & parent, we want 'em cleared.
1018 repeatItem->ClearFlags();
1019 repeatItem->SetParent( nullptr );
1020
1021 m_items_to_repeat.emplace_back( std::move( repeatItem ) );
1022 }
1023}
1024
1025
1026EDA_ITEM* SCH_EDIT_FRAME::ResolveItem( const KIID& aId, bool aAllowNullptrReturn ) const
1027{
1028 return Schematic().ResolveItem( aId, nullptr, aAllowNullptrReturn );
1029}
1030
1031
1036
1037
1042
1043
1045{
1046 return *m_schematic;
1047}
1048
1049
1051{
1052 return GetCurrentSheet().Last()->GetName();
1053}
1054
1055
1057{
1059}
1060
1061
1063{
1064 m_schematic->CreateDefaultScreens();
1065 SetScreen( Schematic().RootScreen() );
1066
1067 if( GetScreen() == nullptr )
1068 {
1069 SCH_SCREEN* screen = new SCH_SCREEN( m_schematic );
1070 SetScreen( screen );
1071 }
1072}
1073
1074
1076{
1077 return m_schematic->CurrentSheet();
1078}
1079
1080
1082{
1083 if( aSheet != GetCurrentSheet() )
1084 {
1085 ClearFocus();
1086
1087 wxLogTrace( traceSchCurrentSheet,
1088 "SCH_EDIT_FRAME::SetCurrentSheet: Changing from path='%s' (size=%zu) to path='%s' (size=%zu)",
1089 GetCurrentSheet().Path().AsString(),
1090 GetCurrentSheet().size(),
1091 aSheet.Path().AsString(),
1092 aSheet.size() );
1093
1094 Schematic().SetCurrentSheet( aSheet );
1095 GetCanvas()->DisplaySheet( aSheet.LastScreen() );
1096 }
1097}
1098
1099
1101{
1103
1104 for( SCH_ITEM* item : screen->Items() )
1105 item->ClearCaches();
1106
1107 for( const std::pair<const wxString, LIB_SYMBOL*>& libSymbol : screen->GetLibSymbols() )
1108 {
1109 wxCHECK2( libSymbol.second, continue );
1110 libSymbol.second->ClearCaches();
1111 }
1112
1113 if( Schematic().Settings().m_IntersheetRefsShow )
1115
1116 ClearFocus();
1117
1118 GetCanvas()->DisplaySheet( GetCurrentSheet().LastScreen() );
1119
1120 if( SCH_SELECTION_TOOL* selectionTool = m_toolManager->GetTool<SCH_SELECTION_TOOL>() )
1121 selectionTool->Reset( TOOL_BASE::REDRAW );
1122
1124}
1125
1126
1127bool SCH_EDIT_FRAME::canCloseWindow( wxCloseEvent& aEvent )
1128{
1129 // Exit interactive editing
1130 // Note this this will commit *some* pending changes. For instance, the SCH_POINT_EDITOR
1131 // will cancel any drag currently in progress, but commit all changes from previous drags.
1132 if( m_toolManager )
1134
1135 // Shutdown blocks must be determined and vetoed as early as possible
1136 if( KIPLATFORM::APP::SupportsShutdownBlockReason() && aEvent.GetId() == wxEVT_QUERY_END_SESSION
1137 && IsContentModified() )
1138 {
1139 return false;
1140 }
1141
1142 if( Kiface().IsSingle() )
1143 {
1144 auto* symbolEditor = (SYMBOL_EDIT_FRAME*) Kiway().Player( FRAME_SCH_SYMBOL_EDITOR, false );
1145
1146 if( symbolEditor && !symbolEditor->Close() ) // Can close symbol editor?
1147 return false;
1148
1149 auto* symbolViewer = (SYMBOL_VIEWER_FRAME*) Kiway().Player( FRAME_SCH_VIEWER, false );
1150
1151 if( symbolViewer && !symbolViewer->Close() ) // Can close symbol viewer?
1152 return false;
1153
1154 // SYMBOL_CHOOSER_FRAME is always modal so this shouldn't come up, but better safe than
1155 // sorry.
1156 auto* chooser = (SYMBOL_CHOOSER_FRAME*) Kiway().Player( FRAME_SYMBOL_CHOOSER, false );
1157
1158 if( chooser && !chooser->Close() ) // Can close symbol chooser?
1159 return false;
1160 }
1161 else
1162 {
1163 auto* symbolEditor = (SYMBOL_EDIT_FRAME*) Kiway().Player( FRAME_SCH_SYMBOL_EDITOR, false );
1164
1165 if( symbolEditor && symbolEditor->IsSymbolFromSchematic() )
1166 {
1167 if( !symbolEditor->CanCloseSymbolFromSchematic( true ) )
1168 return false;
1169 }
1170 }
1171
1172 if( !Kiway().PlayerClose( FRAME_SIMULATOR, false ) ) // Can close the simulator?
1173 return false;
1174
1176 && !m_symbolFieldsTableDialog->Close( false ) ) // Can close the symbol fields table?
1177 {
1178 return false;
1179 }
1180
1181 // We may have gotten multiple events; don't clean up twice
1182 if( !Schematic().IsValid() )
1183 return false;
1184
1185 if( IsContentModified() )
1186 {
1187 wxFileName fileName = Schematic().RootScreen()->GetFileName();
1188 wxString msg = _( "Save changes to '%s' before closing?" );
1189
1190 if( !HandleUnsavedChanges( this, wxString::Format( msg, fileName.GetFullName() ),
1191 [&]() -> bool
1192 {
1193 return SaveProject();
1194 } ) )
1195 {
1196 return false;
1197 }
1198
1199 // If user selected 'No' (discard), create duplicate commit of last saved state and
1200 // move Last_Save tag forward so history shows an explicit discard event.
1201 if( GetLastUnsavedChangesResponse() == wxID_NO )
1202 {
1203 wxString projPath = Prj().GetProjectPath();
1204
1205 if( !projPath.IsEmpty() && Kiway().LocalHistory().HistoryExists( projPath ) )
1206 {
1207 Kiway().LocalHistory().CommitDuplicateOfLastSave( projPath, wxS( "Schematic" ),
1208 wxS( "Discard unsaved schematic changes" ) );
1209 }
1210 }
1211 }
1212
1213 return true;
1214}
1215
1216
1218{
1219 // Unregister the autosave saver before any cleanup that might invalidate m_schematic
1220 if( m_schematic )
1222
1224
1225 SCH_SHEET_LIST sheetlist = Schematic().Hierarchy();
1226
1227#ifdef KICAD_IPC_API
1228 Pgm().GetApiServer().DeregisterHandler( m_apiHandler.get() );
1229 wxTheApp->Unbind( EDA_EVT_PLUGIN_AVAILABILITY_CHANGED, &SCH_EDIT_FRAME::onPluginAvailabilityChanged, this );
1230#endif
1231
1232 // Close modeless dialogs. They're trouble when they get destroyed after the frame.
1233 Unbind( EDA_EVT_CLOSE_DIALOG_BOOK_REPORTER, &SCH_EDIT_FRAME::onCloseSymbolDiffDialog, this );
1234 Unbind( EDA_EVT_CLOSE_ERC_DIALOG, &SCH_EDIT_FRAME::onCloseErcDialog, this );
1235 Unbind( EDA_EVT_CLOSE_DIALOG_SYMBOL_FIELDS_TABLE, &SCH_EDIT_FRAME::onCloseSymbolFieldsTableDialog, this );
1236 m_netNavigator->Unbind( wxEVT_TREE_SEL_CHANGING, &SCH_EDIT_FRAME::onNetNavigatorSelChanging, this );
1237 m_netNavigator->Unbind( wxEVT_TREE_SEL_CHANGED, &SCH_EDIT_FRAME::onNetNavigatorSelection, this );
1238
1239 if( m_diffSymbolDialog )
1240 {
1241 m_diffSymbolDialog->Destroy();
1242 m_diffSymbolDialog = nullptr;
1243 }
1244
1245 if( m_ercDialog )
1246 {
1247 m_ercDialog->Destroy();
1248 m_ercDialog = nullptr;
1249 }
1250
1252 {
1253 m_symbolFieldsTableDialog->Destroy();
1254 m_symbolFieldsTableDialog = nullptr;
1255 }
1256
1257 // Make sure local settings are persisted
1258 if( Prj().GetLocalSettings().ShouldAutoSave() )
1260
1261 delete m_toolManager;
1262 m_toolManager = nullptr;
1263
1264 wxAuiPaneInfo& hierarchy_pane = m_auimgr.GetPane( SchematicHierarchyPaneName() );
1265
1266 if( hierarchy_pane.IsShown() && hierarchy_pane.IsFloating() )
1267 {
1268 hierarchy_pane.Show( false );
1269 m_auimgr.Update();
1270 }
1271
1272 sheetlist.ClearModifyStatus();
1273
1274 wxString fileName = Prj().AbsolutePath( Schematic().RootScreen()->GetFileName() );
1275
1276 if( !Schematic().GetFileName().IsEmpty() && !Schematic().RootScreen()->IsEmpty() )
1277 UpdateFileHistory( fileName );
1278
1279 Schematic().RootScreen()->Clear( true );
1280
1281 // all sub sheets are deleted, only the main sheet is usable
1283
1284 // Clear view before destroying schematic as repaints depend on schematic being valid
1285 SetScreen( nullptr );
1286
1287 Schematic().Reset();
1288
1289 // Prevents any rogue events from continuing (i.e. search panel tries to redraw)
1290 Show( false );
1291
1292 Destroy();
1293}
1294
1295
1297{
1298 m_searchPane->FocusSearch();
1299}
1300
1301
1303{
1304 return Schematic().ErcSettings().GetSeverity( aErrorCode );
1305}
1306
1307
1309{
1311
1312 if( GetScreen() )
1313 {
1315 Kiway().LocalHistory().NoteFileChange( GetScreen()->GetFileName() );
1316 }
1317
1318 if( m_isClosing )
1319 return;
1320
1321 if( GetCanvas() )
1322 GetCanvas()->Refresh();
1323
1324 if( GetScreen() && !GetTitle().StartsWith( wxS( "*" ) ) )
1325 updateTitle();
1326}
1327
1328
1330{
1331 if( Kiface().IsSingle() )
1332 {
1333 DisplayError( this, _( "Cannot update the PCB because the Schematic Editor is opened in stand-alone "
1334 "mode. In order to create/update PCBs from schematics, launch the main KiCad "
1335 "application and create a project." ) );
1336 return;
1337 }
1338
1339 KIWAY_PLAYER* frame = Kiway().Player( FRAME_PCB_EDITOR, false );
1340 wxEventBlocker blocker( this );
1341
1342 if( !frame )
1343 {
1344 wxFileName fn = Prj().GetProjectFullName();
1345 fn.SetExt( FILEEXT::PcbFileExtension );
1346
1347 frame = Kiway().Player( FRAME_PCB_EDITOR, true );
1348
1349 // If Kiway() cannot create the Pcbnew frame, it shows a error message, and
1350 // frame is null
1351 if( !frame )
1352 return;
1353
1354 frame->OpenProjectFiles( std::vector<wxString>( 1, fn.GetFullPath() ) );
1355 }
1356
1357 if( !frame->IsVisible() )
1358 frame->Show( true );
1359
1360 // On Windows, Raise() does not bring the window on screen, when iconized
1361 if( frame->IsIconized() )
1362 frame->Iconize( false );
1363
1364 frame->Raise();
1365
1366 std::string payload;
1368}
1369
1370
1371void SCH_EDIT_FRAME::UpdateHierarchyNavigator( bool aRefreshNetNavigator, bool aClear )
1372{
1373 m_toolManager->GetTool<SCH_NAVIGATE_TOOL>()->CleanHistory();
1374 m_hierarchy->UpdateHierarchyTree( aClear );
1375
1376 if( aRefreshNetNavigator )
1378}
1379
1380
1382{
1383 // Update only the hierarchy navigation tree labels.
1384 // The tree list is expected to be up to date
1385 m_hierarchy->UpdateLabelsHierarchyTree();
1386}
1387
1388
1390{
1391 m_hierarchy->UpdateHierarchySelection();
1392}
1393
1394
1395void SCH_EDIT_FRAME::OnLoadFile( wxCommandEvent& event )
1396{
1397 wxString filename = GetFileFromHistory( event.GetId(), _( "Schematic" ) );
1398
1399 if( !filename.IsEmpty() )
1400 OpenProjectFiles( std::vector<wxString>( 1, filename ) );
1401}
1402
1403
1404void SCH_EDIT_FRAME::OnClearFileHistory( wxCommandEvent& aEvent )
1405{
1407}
1408
1409
1411{
1412 // Only standalone mode can directly load a new document
1413 if( !Kiface().IsSingle() )
1414 return;
1415
1416 wxString pro_dir = m_mruPath;
1417
1418 wxFileDialog dlg( this, _( "New Schematic" ), pro_dir, wxEmptyString, FILEEXT::KiCadSchematicFileWildcard(),
1419 wxFD_SAVE );
1420
1422
1423 if( dlg.ShowModal() != wxID_CANCEL )
1424 {
1425 // Enforce the extension, wxFileDialog is inept.
1426 wxFileName create_me = EnsureFileExtension( dlg.GetPath(), FILEEXT::KiCadSchematicFileExtension );
1427
1428 if( create_me.FileExists() )
1429 {
1430 wxString msg;
1431 msg.Printf( _( "Schematic file '%s' already exists." ), create_me.GetFullName() );
1432 DisplayError( this, msg );
1433 return ;
1434 }
1435
1436 // OpenProjectFiles() requires absolute
1437 wxASSERT_MSG( create_me.IsAbsolute(), wxS( "wxFileDialog returned non-absolute path" ) );
1438
1439 OpenProjectFiles( std::vector<wxString>( 1, create_me.GetFullPath() ), KICTL_CREATE );
1440 m_mruPath = create_me.GetPath();
1441 }
1442}
1443
1444
1446{
1447 // Only standalone mode can directly load a new document
1448 if( !Kiface().IsSingle() )
1449 return;
1450
1451 wxString pro_dir = m_mruPath;
1452 wxString wildcards = FILEEXT::AllSchematicFilesWildcard()
1454 + wxS( "|" ) + FILEEXT::LegacySchematicFileWildcard();
1455
1456 wxFileDialog dlg( this, _( "Open Schematic" ), pro_dir, wxEmptyString, wildcards,
1457 wxFD_OPEN | wxFD_FILE_MUST_EXIST );
1458
1460
1461 if( dlg.ShowModal() != wxID_CANCEL )
1462 {
1463 OpenProjectFiles( std::vector<wxString>( 1, dlg.GetPath() ) );
1465 }
1466
1467 // Since we know we're single-top here: trigger library reload
1468 CallAfter(
1469 [&]()
1470 {
1471 KIFACE *schface = Kiway().KiFACE( KIWAY::FACE_SCH );
1472 schface->PreloadLibraries( &Kiway() );
1473
1475 } );
1476}
1477
1478
1480{
1482
1483 // Register schematic saver for autosave history
1485 [this]( const wxString& aProjectPath, std::vector<HISTORY_FILE_DATA>& aFileData )
1486 {
1487 m_schematic->SaveToHistory( aProjectPath, aFileData );
1488 } );
1489
1490 m_designBlocksPane->ProjectChanged();
1491}
1492
1493
1495{
1496 wxFileName kicad_board = Prj().AbsolutePath( Schematic().GetFileName() );
1497
1498 if( kicad_board.IsOk() && !Schematic().GetFileName().IsEmpty() )
1499 {
1500 kicad_board.SetExt( FILEEXT::PcbFileExtension );
1501 wxFileName legacy_board( kicad_board );
1502 legacy_board.SetExt( FILEEXT::LegacyPcbFileExtension );
1503 wxFileName& boardfn = legacy_board;
1504
1505 if( !legacy_board.FileExists() || kicad_board.FileExists() )
1506 boardfn = kicad_board;
1507
1508 if( Kiface().IsSingle() )
1509 {
1510 ExecuteFile( PCBNEW_EXE, boardfn.GetFullPath() );
1511 }
1512 else
1513 {
1514 wxEventBlocker blocker(this);
1515 KIWAY_PLAYER* frame = Kiway().Player( FRAME_PCB_EDITOR, false );
1516
1517 if( !frame )
1518 {
1519 frame = Kiway().Player( FRAME_PCB_EDITOR, true );
1520
1521 // frame can be null if Cvpcb cannot be run. No need to show a warning
1522 // Kiway() generates the error messages
1523 if( !frame )
1524 return;
1525
1526 frame->OpenProjectFiles( std::vector<wxString>( 1, boardfn.GetFullPath() ) );
1527 }
1528
1529 if( !frame->IsVisible() )
1530 frame->Show( true );
1531
1532 // On Windows, Raise() does not bring the window on screen, when iconized
1533 if( frame->IsIconized() )
1534 frame->Iconize( false );
1535
1536 frame->Raise();
1537 }
1538 }
1539 else
1540 {
1542 }
1543}
1544
1545
1547{
1548 wxFileName fn = Prj().AbsolutePath( Schematic().GetFileName() );
1549 fn.SetExt( FILEEXT::NetlistFileExtension );
1550
1551 if( !ReadyToNetlist( _( "Assigning footprints requires a fully annotated schematic." ) ) )
1552 return;
1553
1554 try
1555 {
1556 KIWAY_PLAYER* player = Kiway().Player( FRAME_CVPCB, false ); // test open already.
1557
1558 if( !player )
1559 {
1560 player = Kiway().Player( FRAME_CVPCB, true );
1561
1562 // player can be null if Cvpcb cannot be run. No need to show a warning
1563 // Kiway() generates the error messages
1564 if( !player )
1565 return;
1566
1567 player->Show( true );
1568 }
1569
1570 // Ensure the netlist (mainly info about symbols) is up to date
1573
1574 player->Raise();
1575 }
1576 catch( const IO_ERROR& )
1577 {
1578 DisplayError( this, _( "Could not open CvPcb" ) );
1579 }
1580}
1581
1582
1583void SCH_EDIT_FRAME::OnExit( wxCommandEvent& event )
1584{
1585 if( event.GetId() == wxID_EXIT )
1586 Kiway().OnKiCadExit();
1587
1588 if( event.GetId() == wxID_CLOSE || Kiface().IsSingle() )
1589 Close( false );
1590}
1591
1592
1594{
1595 SCHEMATIC_SETTINGS& settings = m_schematic->Settings();
1596 SIM_LIB_MGR simLibMgr( &Prj() );
1597 NULL_REPORTER devnull;
1598 SCH_SHEET_PATH& sheetPath = GetCurrentSheet();
1599 wxString variant = m_schematic->GetCurrentVariant();
1600
1601 // Patch for bug early in V7.99 dev
1602 if( settings.m_OPO_VRange.EndsWith( 'A' ) )
1603 settings.m_OPO_VRange[ settings.m_OPO_VRange.Length() - 1 ] = 'V';
1604
1605 // Update items which may have ${OP} text variables
1606 //
1608 [&]( KIGFX::VIEW_ITEM* aItem ) -> int
1609 {
1610 int flags = 0;
1611
1612 auto invalidateTextVars =
1613 [&flags]( EDA_TEXT* text )
1614 {
1615 if( text->HasTextVars() )
1616 {
1617 text->ClearRenderCache();
1618 text->ClearBoundingBoxCache();
1620 }
1621 };
1622
1623 if( SCH_ITEM* item = dynamic_cast<SCH_ITEM*>( aItem ) )
1624 {
1625 item->RunOnChildren(
1626 [&invalidateTextVars]( SCH_ITEM* aChild )
1627 {
1628 if( EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( aChild ) )
1629 invalidateTextVars( text );
1630 },
1632 }
1633
1634 if( EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( aItem ) )
1635 invalidateTextVars( text );
1636
1637 return flags;
1638 } );
1639
1640 // Update OP overlay items
1641 //
1642 for( SCH_ITEM* item : GetScreen()->Items() )
1643 {
1644 if( sheetPath.GetExcludedFromSim( variant ) )
1645 continue;
1646
1647 if( item->Type() == SCH_LINE_T )
1648 {
1649 SCH_LINE* line = static_cast<SCH_LINE*>( item );
1650
1651 if( !line->GetOperatingPoint().IsEmpty() )
1652 GetCanvas()->GetView()->Update( line );
1653
1654 line->SetOperatingPoint( wxEmptyString );
1655
1656 // update value from netlist, below
1657 }
1658 else if( item->Type() == SCH_SYMBOL_T )
1659 {
1660 SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( item );
1661 wxString ref = symbol->GetRef( &sheetPath );
1662 std::vector<SCH_PIN*> pins = symbol->GetPins( &sheetPath );
1663
1664 // Power symbols and other symbols which have the reference starting with "#" are
1665 // not included in simulation
1666 if( ref.StartsWith( '#' ) || symbol->ResolveExcludedFromSim( &sheetPath, variant ) )
1667 continue;
1668
1669 for( SCH_PIN* pin : pins )
1670 {
1671 if( !pin->GetOperatingPoint().IsEmpty() )
1672 GetCanvas()->GetView()->Update( pin );
1673
1674 pin->SetOperatingPoint( wxEmptyString );
1675 }
1676
1677 if( pins.size() == 2 )
1678 {
1679 wxString op = m_schematic->GetOperatingPoint( ref, settings.m_OPO_IPrecision, settings.m_OPO_IRange );
1680
1681 if( !op.IsEmpty() && op != wxS( "--" ) && op != wxS( "?" ) )
1682 {
1683 pins[0]->SetOperatingPoint( op );
1684 GetCanvas()->GetView()->Update( symbol );
1685 }
1686 }
1687 else
1688 {
1689 std::vector<EMBEDDED_FILES*> embeddedFilesStack;
1690 embeddedFilesStack.push_back( m_schematic->GetEmbeddedFiles() );
1691
1692 if( EMBEDDED_FILES* symbolEmbeddedFiles = symbol->GetEmbeddedFiles() )
1693 {
1694 embeddedFilesStack.push_back( symbolEmbeddedFiles );
1695 symbol->GetLibSymbolRef()->AppendParentEmbeddedFiles( embeddedFilesStack );
1696 }
1697
1698 simLibMgr.SetFilesStack( std::move( embeddedFilesStack ) );
1699
1700 SIM_MODEL& model = simLibMgr.CreateModel( &sheetPath, *symbol, true, 0, variant, devnull ).model;
1701
1702 SPICE_ITEM spiceItem;
1703 spiceItem.refName = ref;
1704 ref = model.SpiceGenerator().ItemName( spiceItem );
1705
1706 for( const auto& modelPin : model.GetPins() )
1707 {
1708 SCH_PIN* symbolPin = symbol->GetPin( modelPin.get().symbolPinNumber );
1709 wxString signalName = ref + wxS( ":" ) + modelPin.get().modelPinName;
1710 wxString op = m_schematic->GetOperatingPoint( signalName, settings.m_OPO_IPrecision,
1711 settings.m_OPO_IRange );
1712
1713 if( symbolPin && !op.IsEmpty() && op != wxS( "--" ) && op != wxS( "?" ) )
1714 {
1715 symbolPin->SetOperatingPoint( op );
1716 GetCanvas()->GetView()->Update( symbol );
1717 }
1718 }
1719 }
1720 }
1721 }
1722
1723 for( const auto& [ key, subgraphList ] : m_schematic->m_connectionGraph->GetNetMap() )
1724 {
1725 wxString op = m_schematic->GetOperatingPoint( key.Name, settings.m_OPO_VPrecision, settings.m_OPO_VRange );
1726
1727 if( !op.IsEmpty() && op != wxS( "--" ) && op != wxS( "?" ) )
1728 {
1729 for( CONNECTION_SUBGRAPH* subgraph : subgraphList )
1730 {
1731 SCH_LINE* longestWire = nullptr;
1732 double length = 0.0;
1733
1734 if( subgraph->GetSheet().GetExcludedFromSim( variant ) )
1735 continue;
1736
1737 for( SCH_ITEM* item : subgraph->GetItems() )
1738 {
1739 if( item->Type() == SCH_LINE_T )
1740 {
1741 SCH_LINE* line = static_cast<SCH_LINE*>( item );
1742
1743 if( line->IsWire() && line->GetLength() > length )
1744 {
1745 longestWire = line;
1746 length = line->GetLength();
1747 }
1748 }
1749 }
1750
1751 if( longestWire )
1752 {
1753 longestWire->SetOperatingPoint( op );
1754 GetCanvas()->GetView()->Update( longestWire );
1755 }
1756 }
1757 }
1758 }
1759}
1760
1761
1763{
1764 if( aItem->Type() == SCH_GLOBAL_LABEL_T || aItem->Type() == SCH_HIER_LABEL_T )
1765 {
1766 SCH_LABEL_BASE* label = static_cast<SCH_LABEL_BASE*>( aItem );
1767
1768 if( label->AutoRotateOnPlacement() )
1769 {
1770 SPIN_STYLE spin = aScreen->GetLabelOrientationForPoint( label->GetPosition(), label->GetSpinStyle(),
1771 &GetCurrentSheet() );
1772
1773 if( spin != label->GetSpinStyle() )
1774 {
1775 label->SetSpinStyle( spin );
1776
1777 for( SCH_ITEM* item : aScreen->Items().OfType( SCH_GLOBAL_LABEL_T ) )
1778 {
1779 SCH_LABEL_BASE* otherLabel = static_cast<SCH_LABEL_BASE*>( item );
1780
1781 if( otherLabel != label && otherLabel->GetText() == label->GetText() )
1782 otherLabel->AutoplaceFields( aScreen, AUTOPLACE_AUTO );
1783 }
1784 }
1785 }
1786 }
1787}
1788
1789
1791{
1792 SCH_SCREEN* screen = GetScreen();
1793
1794 wxCHECK( screen, /* void */ );
1795
1796 wxString title;
1797
1798 if( !screen->GetFileName().IsEmpty() )
1799 {
1800 wxFileName fn( Prj().AbsolutePath( screen->GetFileName() ) );
1801 bool readOnly = false;
1802 bool unsaved = false;
1803
1804 if( fn.IsOk() && screen->FileExists() )
1805 readOnly = screen->IsReadOnly();
1806 else
1807 unsaved = true;
1808
1809 if( IsContentModified() )
1810 title = wxT( "*" );
1811
1812 title += fn.GetName();
1813
1814 wxString sheetPath = GetCurrentSheet().PathHumanReadable( false, true );
1815
1816 if( sheetPath != fn.GetName() )
1817 title += wxString::Format( wxT( " [%s]" ), sheetPath );
1818
1819 if( readOnly )
1820 title += wxS( " " ) + _( "[Read Only]" );
1821
1822 if( unsaved )
1823 title += wxS( " " ) + _( "[Unsaved]" );
1824 }
1825 else
1826 {
1827 title = _( "[no schematic loaded]" );
1828 }
1829
1830 title += wxT( " \u2014 " ) + _( "Schematic Editor" );
1831
1832 SetTitle( title );
1833}
1834
1835
1837{
1839
1840 if( GetScreen() )
1841 GetScreen()->m_zoomInitialized = true;
1842}
1843
1844
1846 PROGRESS_REPORTER* aProgressReporter )
1847{
1848 wxString highlightedConn = GetHighlightedConnection();
1849 bool hasHighlightedConn = !highlightedConn.IsEmpty();
1850
1851 std::function<void( SCH_ITEM* )> changeHandler =
1852 [&]( SCH_ITEM* aChangedItem ) -> void
1853 {
1854 GetCanvas()->GetView()->Update( aChangedItem, KIGFX::REPAINT );
1855
1856 SCH_CONNECTION* connection = aChangedItem->Connection();
1857
1859 return;
1860
1861 if( !hasHighlightedConn )
1862 {
1863 // No highlighted connection, but connectivity has changed, so refresh
1864 // the list of all nets
1866 }
1867 else if( connection && ( connection->Name() == highlightedConn
1868 || connection->HasDriverChanged() ) )
1869 {
1871 }
1872 };
1873
1874 Schematic().RecalculateConnections( aCommit, aCleanupFlags,
1876 aProgressReporter,
1877 GetCanvas()->GetView(),
1878 &changeHandler,
1879 m_undoList.m_CommandsList.empty() ? nullptr
1880 : m_undoList.m_CommandsList.back() );
1881
1883 [&]( KIGFX::VIEW_ITEM* aItem ) -> int
1884 {
1885 int flags = 0;
1886 SCH_ITEM* item = dynamic_cast<SCH_ITEM*>( aItem );
1887 SCH_CONNECTION* connection = item ? item->Connection() : nullptr;
1888
1889 auto invalidateTextVars =
1890 [&flags]( EDA_TEXT* text )
1891 {
1892 if( text->HasTextVars() )
1893 {
1894 text->ClearRenderCache();
1895 text->ClearBoundingBoxCache();
1897 }
1898 };
1899
1900 if( connection && connection->HasDriverChanged() )
1901 {
1902 connection->ClearDriverChanged();
1903 flags |= KIGFX::REPAINT;
1904 }
1905
1906 if( item )
1907 {
1908 item->RunOnChildren(
1909 [&invalidateTextVars]( SCH_ITEM* aChild )
1910 {
1911 if( EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( aChild ) )
1912 invalidateTextVars( text );
1913 },
1915
1916 if( flags & KIGFX::GEOMETRY )
1917 GetScreen()->Update( item, false ); // Refresh RTree
1918 }
1919
1920 if( EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( aItem ) )
1921 invalidateTextVars( text );
1922
1923 return flags;
1924 } );
1925
1927 || !Schematic().ConnectionGraph()->FindFirstSubgraphByName( highlightedConn ) )
1928 {
1932 }
1933}
1934
1935
1940
1941
1943{
1944 GetCanvas()->GetView()->Update( aItem );
1945}
1946
1947
1954
1955
1956std::unique_ptr<GRID_HELPER> SCH_EDIT_FRAME::MakeGridHelper()
1957{
1958 return std::make_unique<EE_GRID_HELPER>( m_toolManager );
1959}
1960
1961
1963{
1965
1966 SCHEMATIC_SETTINGS& settings = Schematic().Settings();
1967
1969
1970 if( EESCHEMA_SETTINGS* cfg = GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" ) )
1971 {
1972 GetGalDisplayOptions().ReadWindowSettings( cfg->m_Window );
1973 GetRenderSettings()->SetDefaultFont( cfg->m_Appearance.default_font );
1974
1975 KIGFX::VIEW* view = GetCanvas()->GetView();
1976 view->SetLayerVisible( LAYER_ERC_ERR, cfg->m_Appearance.show_erc_errors );
1977 view->SetLayerVisible( LAYER_ERC_WARN, cfg->m_Appearance.show_erc_warnings );
1978 view->SetLayerVisible( LAYER_ERC_EXCLUSION, cfg->m_Appearance.show_erc_exclusions );
1979 view->SetLayerVisible( LAYER_OP_VOLTAGES, cfg->m_Appearance.show_op_voltages );
1980 view->SetLayerVisible( LAYER_OP_CURRENTS, cfg->m_Appearance.show_op_currents );
1981
1982 GetRenderSettings()->m_ShowPinAltIcons = cfg->m_Appearance.show_pin_alt_icons;
1983
1985
1986 settings.m_TemplateFieldNames.DeleteAllFieldNameTemplates( true /* global */ );
1987
1988 if( !cfg->m_Drawing.field_names.IsEmpty() )
1989 settings.m_TemplateFieldNames.AddTemplateFieldNames( cfg->m_Drawing.field_names );
1990 }
1991
1993
1994 for( SCH_ITEM* item : screen->Items() )
1995 {
1996 item->ClearCaches();
1997
1998 if( item->Type() == SCH_LINE_T )
1999 {
2000 SCH_LINE* line = static_cast<SCH_LINE*>( item );
2001
2002 if( line->IsWire() || line->IsBus() )
2003 UpdateHopOveredWires( line );
2004 }
2005 }
2006
2007 for( const auto& [ libItemName, libSymbol ] : screen->GetLibSymbols() )
2008 libSymbol->ClearCaches();
2009
2011
2013 Layout();
2014 SendSizeEvent();
2015}
2016
2017
2019{
2020 // Store the current zoom level into the current screen before calling
2021 // DisplayCurrentSheet() that set the zoom to GetScreen()->m_LastZoomLevel
2023
2024 // Rebuild the sheet view (draw area and any other items):
2026}
2027
2028
2030{
2031 // call my base class
2033
2034 // tooltips in toolbars
2036
2037 // For some obscure reason, the AUI manager hides the first modified pane.
2038 // So force show panes
2039 wxAuiPaneInfo& design_blocks_pane_info = m_auimgr.GetPane( m_designBlocksPane );
2040 bool panel_shown = design_blocks_pane_info.IsShown();
2041 design_blocks_pane_info.Caption( _( "Design Blocks" ) );
2042 design_blocks_pane_info.Show( panel_shown );
2043
2044 m_auimgr.GetPane( m_hierarchy ).Caption( _( "Schematic Hierarchy" ) );
2045 m_auimgr.GetPane( m_selectionFilterPanel ).Caption( _( "Selection Filter" ) );
2046 m_auimgr.GetPane( m_propertiesPanel ).Caption( _( "Properties" ) );
2047 m_auimgr.GetPane( m_designBlocksPane ).Caption( _( "Design Blocks" ) );
2048 m_auimgr.GetPane( RemoteSymbolPaneName() ).Caption( _( "Remote Symbols" ) );
2049 m_auimgr.Update();
2050 m_hierarchy->UpdateHierarchyTree();
2051
2052 // status bar
2054
2055 updateTitle();
2056
2057 // This ugly hack is to fix an option(left) toolbar update bug that seems to only affect
2058 // windows. See https://bugs.launchpad.net/kicad/+bug/1816492. For some reason, calling
2059 // wxWindow::Refresh() does not resolve the issue. Only a resize event seems to force the
2060 // toolbar to update correctly.
2061#if defined( __WXMSW__ )
2062 PostSizeEvent();
2063#endif
2064}
2065
2066
2068{
2069 if( !GetHighlightedConnection().IsEmpty() )
2070 {
2071 SetStatusText( wxString::Format( _( "Highlighted net: %s" ),
2073 }
2074 else
2075 {
2076 SetStatusText( wxT( "" ) );
2077 }
2078}
2079
2080
2082{
2083 if( m_toolManager )
2085
2086 SCH_BASE_FRAME::SetScreen( aScreen );
2087 GetCanvas()->DisplaySheet( static_cast<SCH_SCREEN*>( aScreen ) );
2088
2089 if( m_toolManager )
2091}
2092
2093
2094const BOX2I SCH_EDIT_FRAME::GetDocumentExtents( bool aIncludeAllVisible ) const
2095{
2096 BOX2I bBoxDoc;
2097
2098 if( !GetScreen() )
2099 return bBoxDoc;
2100
2101 if( aIncludeAllVisible )
2102 {
2103 // Get the whole page size and return that
2104 int sizeX = GetScreen()->GetPageSettings().GetWidthIU( schIUScale.IU_PER_MILS );
2105 int sizeY = GetScreen()->GetPageSettings().GetHeightIU( schIUScale.IU_PER_MILS );
2106 bBoxDoc = BOX2I( VECTOR2I( 0, 0 ), VECTOR2I( sizeX, sizeY ) );
2107 }
2108 else
2109 {
2110 // Get current drawing-sheet in a form we can compare to an EDA_ITEM
2112 EDA_ITEM* dsAsItem = static_cast<EDA_ITEM*>( ds );
2113
2114 // Calc the bounding box of all items on screen except the page border
2115 for( EDA_ITEM* item : GetScreen()->Items() )
2116 {
2117 if( item != dsAsItem ) // Ignore the drawing-sheet itself
2118 bBoxDoc.Merge( item->GetBoundingBox() );
2119 }
2120 }
2121
2122 return bBoxDoc;
2123}
2124
2125
2127{
2128 if( !Schematic().HasHierarchy() )
2129 return false;
2130
2131 return Schematic().Hierarchy().IsModified();
2132}
2133
2134
2136{
2137 EESCHEMA_SETTINGS* cfg = eeconfig();
2138 return cfg && cfg->m_Appearance.show_hidden_pins;
2139}
2140
2141
2142void SCH_EDIT_FRAME::FocusOnItem( EDA_ITEM* aItem, bool aAllowScroll )
2143{
2144 // nullptr will clear the current focus
2145 if( aItem != nullptr && !aItem->IsSCH_ITEM() )
2146 return;
2147
2148 static KIID lastBrightenedItemID( niluuid );
2149
2150 SCH_ITEM* lastItem = Schematic().ResolveItem( lastBrightenedItemID, nullptr, true );
2151
2152 if( lastItem && lastItem != aItem )
2153 {
2154 lastItem->ClearBrightened();
2155
2156 UpdateItem( lastItem );
2157 lastBrightenedItemID = niluuid;
2158 }
2159
2160 if( aItem )
2161 {
2162 if( !aItem->IsBrightened() )
2163 {
2164 aItem->SetBrightened();
2165
2166 UpdateItem( aItem );
2167 lastBrightenedItemID = aItem->m_Uuid;
2168 }
2169
2170 FocusOnLocation( aItem->GetFocusPosition(), aAllowScroll );
2171 }
2172}
2173
2174
2176{
2177 return Schematic().GetFileName();
2178}
2179
2180
2182{
2183 return m_toolManager->GetTool<SCH_SELECTION_TOOL>()->GetSelection();
2184}
2185
2186void SCH_EDIT_FRAME::onSize( wxSizeEvent& aEvent )
2187{
2188 if( IsShown() )
2189 {
2190 // We only need this until the frame is done resizing and the final client size is
2191 // established.
2192 Unbind( wxEVT_SIZE, &SCH_EDIT_FRAME::onSize, this );
2194 }
2195
2196 // Skip() is called in the base class.
2197 EDA_DRAW_FRAME::OnSize( aEvent );
2198}
2199
2200
2202 const KIID& aSchematicSymbolUUID )
2203{
2204 SCH_SHEET_PATH principalPath;
2205 SCH_SHEET_LIST sheets = Schematic().Hierarchy();
2206 SCH_ITEM* item = sheets.ResolveItem( aSchematicSymbolUUID, &principalPath, true );
2207 SCH_SYMBOL* principalSymbol = dynamic_cast<SCH_SYMBOL*>( item );
2208 SCH_COMMIT commit( m_toolManager );
2209
2210 if( !principalSymbol )
2211 return;
2212
2213 wxString principalRef;
2214
2215 if( principalSymbol->IsAnnotated( &principalPath ) )
2216 principalRef = principalSymbol->GetRef( &principalPath, false );
2217
2218 std::vector< std::pair<SCH_SYMBOL*, SCH_SHEET_PATH> > allUnits;
2219
2220 for( const SCH_SHEET_PATH& path : sheets )
2221 {
2222 for( SCH_ITEM* candidate : path.LastScreen()->Items().OfType( SCH_SYMBOL_T ) )
2223 {
2224 SCH_SYMBOL* candidateSymbol = static_cast<SCH_SYMBOL*>( candidate );
2225
2226 if( candidateSymbol == principalSymbol
2227 || ( candidateSymbol->IsAnnotated( &path )
2228 && candidateSymbol->GetRef( &path, false ) == principalRef ) )
2229 {
2230 allUnits.emplace_back( candidateSymbol, path );
2231 }
2232 }
2233 }
2234
2235 for( auto& [ unit, path ] : allUnits )
2236 {
2237 // This needs to be done before the LIB_SYMBOL is changed to prevent stale
2238 // library symbols in the schematic file.
2239 path.LastScreen()->Remove( unit );
2240
2241 if( !unit->IsNew() )
2242 commit.Modify( unit, path.LastScreen() );
2243
2244 unit->SetLibSymbol( aSymbol.Flatten().release() );
2245 unit->UpdateFields( &GetCurrentSheet(),
2246 true, /* update style */
2247 true, /* update ref */
2248 true, /* update other fields */
2249 false, /* reset ref */
2250 false /* reset other fields */ );
2251
2252 path.LastScreen()->Append( unit );
2253 GetCanvas()->GetView()->Update( unit );
2254 }
2255
2256 // Clear any orphaned alternate pins.
2257 for( SCH_PIN* pin : principalSymbol->GetPins() )
2258 {
2259 wxString altName = pin->GetAlt();
2260
2261 if( altName.IsEmpty() )
2262 continue;
2263
2264 if( pin->GetAlternates().count( altName ) == 0 )
2265 pin->SetAlt( wxEmptyString );
2266 }
2267
2268 if( !commit.Empty() )
2269 commit.Push( _( "Save Symbol to Schematic" ) );
2270}
2271
2272
2273void SCH_EDIT_FRAME::UpdateItem( EDA_ITEM* aItem, bool isAddOrDelete, bool aUpdateRtree )
2274{
2275 SCH_BASE_FRAME::UpdateItem( aItem, isAddOrDelete, aUpdateRtree );
2276
2277 if( SCH_ITEM* sch_item = dynamic_cast<SCH_ITEM*>( aItem ) )
2278 sch_item->ClearCaches();
2279}
2280
2281
2283{
2284 wxCHECK( m_toolManager, /* void */ );
2285
2289
2290 wxCHECK( screen, /* void */ );
2291
2293
2294 SCH_BASE_FRAME::SetScreen( screen );
2295
2296 SetSheetNumberAndCount(); // will also update CurrentScreen()'s sheet number info
2297
2299
2300 // update the references, units, and intersheet-refs
2302
2303 // dangling state can also have changed if different units with different pin locations are
2304 // used
2307
2308 SCH_SELECTION_TOOL* selectionTool = m_toolManager->GetTool<SCH_SELECTION_TOOL>();
2309
2310 wxCHECK( selectionTool, /* void */ );
2311
2312 auto visit =
2313 [&]( EDA_ITEM* item )
2314 {
2316 && !m_findReplaceData->findString.IsEmpty()
2317 && item->Matches( *m_findReplaceData, &GetCurrentSheet() ) )
2318 {
2319 item->SetForceVisible( true );
2320 selectionTool->BrightenItem( item );
2321 }
2322 else if( item->IsBrightened() )
2323 {
2324 item->SetForceVisible( false );
2325 selectionTool->UnbrightenItem( item );
2326 }
2327 };
2328
2329 for( SCH_ITEM* item : screen->Items() )
2330 {
2331 visit( item );
2332
2333 item->RunOnChildren(
2334 [&]( SCH_ITEM* aChild )
2335 {
2336 visit( aChild );
2337 },
2339 }
2340
2341 if( !screen->m_zoomInitialized )
2342 {
2344 }
2345 else
2346 {
2347 // Set zoom to last used in this screen
2348 GetCanvas()->GetView()->SetScale( GetScreen()->m_LastZoomLevel );
2349 GetCanvas()->GetView()->SetCenter( GetScreen()->m_ScrollCenter );
2350 }
2351
2352 updateTitle();
2353
2354 HardRedraw(); // Ensure all items are redrawn (especially the drawing-sheet items)
2355
2356 // Allow tools to re-add their VIEW_ITEMs after the last call to Clear in HardRedraw
2358
2359 SCH_EDITOR_CONTROL* editTool = m_toolManager->GetTool<SCH_EDITOR_CONTROL>();
2360
2361 wxCHECK( editTool, /* void */ );
2362
2364 editTool->UpdateNetHighlighting( dummy );
2365
2366 m_hierarchy->UpdateHierarchySelection();
2367
2368 m_schematic->OnSchSheetChanged();
2369}
2370
2371
2373{
2374 if( !m_diffSymbolDialog )
2375 {
2377 _( "Compare Symbol with Library" ) );
2378
2379 m_diffSymbolDialog->m_sdbSizerApply->SetLabel( _( "Update Symbol from Library..." ) );
2380 m_diffSymbolDialog->m_sdbSizerApply->PostSizeEventToParent();
2381 m_diffSymbolDialog->m_sdbSizerApply->Show();
2382 }
2383
2384 return m_diffSymbolDialog;
2385}
2386
2387
2388void SCH_EDIT_FRAME::onCloseSymbolDiffDialog( wxCommandEvent& aEvent )
2389{
2390 if( m_diffSymbolDialog && aEvent.GetString() == DIFF_SYMBOLS_DIALOG_NAME )
2391 {
2392 if( aEvent.GetId() == wxID_APPLY )
2393 {
2394 KIID symbolUUID = m_diffSymbolDialog->GetUserItemID();
2395
2396 CallAfter(
2397 [this, symbolUUID]()
2398 {
2399 EDA_ITEM* item = ResolveItem( symbolUUID );
2400
2401 if( SCH_SYMBOL* symbol = dynamic_cast<SCH_SYMBOL*>( item ) )
2402 {
2403 m_toolManager->RunAction<EDA_ITEM*>( ACTIONS::selectItem, symbol );
2404
2406 dlg.ShowQuasiModal();
2407 }
2408 } );
2409 }
2410
2411 m_diffSymbolDialog->Destroy();
2412 m_diffSymbolDialog = nullptr;
2413 }
2414}
2415
2416
2418{
2419 if( !m_ercDialog )
2420 m_ercDialog = new DIALOG_ERC( this );
2421
2422 return m_ercDialog;
2423}
2424
2425
2426void SCH_EDIT_FRAME::onCloseErcDialog( wxCommandEvent& aEvent )
2427{
2428 if( m_ercDialog )
2429 {
2430 m_ercDialog->Destroy();
2431 m_ercDialog = nullptr;
2432 }
2433}
2434
2435
2443
2444
2446{
2447 return m_netNavigator;
2448}
2449
2450
2452{
2454 {
2455 m_symbolFieldsTableDialog->Destroy();
2456 m_symbolFieldsTableDialog = nullptr;
2457 }
2458}
2459
2460
2461void SCH_EDIT_FRAME::AddSchematicChangeListener( wxEvtHandler* aListener )
2462{
2463 auto it = std::find( m_schematicChangeListeners.begin(), m_schematicChangeListeners.end(), aListener );
2464
2465 // Don't add duplicate listeners.
2466 if( it == m_schematicChangeListeners.end() )
2467 m_schematicChangeListeners.push_back( aListener );
2468}
2469
2470
2472{
2473 auto it = std::find( m_schematicChangeListeners.begin(), m_schematicChangeListeners.end(), aListener );
2474
2475 // Don't add duplicate listeners.
2476 if( it != m_schematicChangeListeners.end() )
2477 m_schematicChangeListeners.erase( it );
2478}
2479
2480
2482{
2483 wxPanel* panel = new wxPanel( this );
2484
2485 wxBoxSizer* sizer = new wxBoxSizer( wxVERTICAL );
2486
2487 // Create horizontal sizer for search control and gear button
2488 wxBoxSizer* searchSizer = new wxBoxSizer( wxHORIZONTAL );
2489
2490 m_netNavigatorFilter = new wxSearchCtrl( panel, wxID_ANY );
2491 m_netNavigatorFilter->SetDescriptiveText( _( "Filter nets" ) );
2492 m_netNavigatorFilter->ShowCancelButton( false );
2493 searchSizer->Add( m_netNavigatorFilter, 1, wxEXPAND | wxRIGHT, FromDIP( 2 ) );
2494
2495 m_netNavigatorMenuButton = new BITMAP_BUTTON( panel, wxID_ANY );
2497 m_netNavigatorMenuButton->SetPadding( 2 );
2498 searchSizer->Add( m_netNavigatorMenuButton, 0, wxALIGN_CENTER_VERTICAL );
2499
2500 sizer->Add( searchSizer, 0, wxEXPAND | wxALL, FromDIP( 2 ) );
2501
2502 m_netNavigator = new wxGenericTreeCtrl( panel, wxID_ANY, wxPoint( 0, 0 ), FromDIP( wxSize( 160, 250 ) ),
2503 wxTR_DEFAULT_STYLE | wxNO_BORDER );
2504 sizer->Add( m_netNavigator, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, FromDIP( 2 ) );
2505
2506 panel->SetSizer( sizer );
2507
2508 m_netNavigatorFilter->Bind( wxEVT_COMMAND_TEXT_UPDATED, &SCH_EDIT_FRAME::onNetNavigatorFilterChanged, this );
2509 m_netNavigatorFilter->Bind( wxEVT_KEY_DOWN, &SCH_EDIT_FRAME::onNetNavigatorKey, this );
2510 m_netNavigator->Bind( wxEVT_KEY_DOWN, &SCH_EDIT_FRAME::onNetNavigatorKey, this );
2511 m_netNavigator->Bind( wxEVT_TREE_ITEM_MENU, &SCH_EDIT_FRAME::onNetNavigatorItemMenu, this );
2512 m_netNavigator->Bind( wxEVT_CONTEXT_MENU, &SCH_EDIT_FRAME::onNetNavigatorContextMenu, this );
2513
2514 m_netNavigatorMenuButton->Bind( wxEVT_LEFT_DOWN,
2515 [this]( wxMouseEvent& event )
2516 {
2517 wxMenu menu;
2518 wxMenuItem* wildcardItem = menu.AppendRadioItem( ID_NET_NAVIGATOR_SEARCH_WILDCARD,
2519 _( "Wildcard Search" ) );
2520 wxMenuItem* regexItem = menu.AppendRadioItem( ID_NET_NAVIGATOR_SEARCH_REGEX,
2521 _( "Regex Search" ) );
2522
2523 EESCHEMA_SETTINGS* cfg = eeconfig();
2524
2526 wildcardItem->Check();
2527 else
2528 regexItem->Check();
2529
2530 PopupMenu( &menu );
2531 } );
2532
2538
2539 return panel;
2540}
2541
2542
2543void SCH_EDIT_FRAME::SetHighlightedConnection( const wxString& aConnection,
2544 const NET_NAVIGATOR_ITEM_DATA* aSelection )
2545{
2546 bool refreshNetNavigator = aConnection != m_highlightedConn;
2547
2548 m_highlightedConn = aConnection;
2549
2550 if( refreshNetNavigator )
2551 RefreshNetNavigator( aSelection );
2552}
2553
2554
2556{
2558
2559 if( m_netNavigator )
2560 {
2561 NET_NAVIGATOR_ITEM_DATA itemData;
2562 wxTreeItemId selection = m_netNavigator->GetSelection();
2563 bool refreshSelection = selection.IsOk() && selection != m_netNavigator->GetRootItem();
2564
2565 if( refreshSelection )
2566 {
2568 dynamic_cast<NET_NAVIGATOR_ITEM_DATA*>( m_netNavigator->GetItemData( selection ) );
2569
2570 wxCHECK( tmp, /* void */ );
2571 itemData = *tmp;
2572 }
2573
2574 m_netNavigator->DeleteAllItems();
2575 RefreshNetNavigator( refreshSelection ? &itemData : nullptr );
2576 }
2577}
2578
2579
2581{
2582 if( !m_netNavigator )
2583 return;
2584
2585 wxString newFilter = m_netNavigatorFilter ? m_netNavigatorFilter->GetValue() : wxString();
2586
2587 if( newFilter == m_netNavigatorFilterValue )
2588 return;
2589
2590 m_netNavigatorFilterValue = newFilter;
2591
2592 NET_NAVIGATOR_ITEM_DATA selectionData;
2593 NET_NAVIGATOR_ITEM_DATA* selectionPtr = nullptr;
2594
2595 wxTreeItemId selection = m_netNavigator->GetSelection();
2596
2597 if( selection.IsOk() )
2598 {
2599 if( NET_NAVIGATOR_ITEM_DATA* tmp =
2600 dynamic_cast<NET_NAVIGATOR_ITEM_DATA*>( m_netNavigator->GetItemData( selection ) ) )
2601 {
2602 selectionData = *tmp;
2603 selectionPtr = &selectionData;
2604 }
2605 }
2606
2607 RefreshNetNavigator( selectionPtr );
2608
2609 aEvent.Skip();
2610}
2611
2612
2613void SCH_EDIT_FRAME::onNetNavigatorKey( wxKeyEvent& aEvent )
2614{
2615 if( aEvent.GetKeyCode() == WXK_ESCAPE )
2616 {
2617 // Clear the search string and refresh
2619 m_netNavigatorFilter->SetValue( wxEmptyString );
2620
2621 m_netNavigatorFilterValue = wxEmptyString;
2622
2624
2625 // Don't skip the event - we handled it
2626 return;
2627 }
2628
2629 aEvent.Skip();
2630}
2631
2632
2633
2635{
2636 showNetNavigatorMenu( aEvent.GetItem() );
2637}
2638
2639
2640void SCH_EDIT_FRAME::onNetNavigatorContextMenu( wxContextMenuEvent& aEvent )
2641{
2642 if( !m_netNavigator )
2643 return;
2644
2645 wxPoint screenPos = aEvent.GetPosition();
2646
2647 if( screenPos == wxDefaultPosition )
2648 screenPos = wxGetMousePosition();
2649
2650 wxPoint clientPos = m_netNavigator->ScreenToClient( screenPos );
2651 int flags = 0;
2652 wxTreeItemId item = m_netNavigator->HitTest( clientPos, flags );
2653
2654 showNetNavigatorMenu( item );
2655}
2656
2657
2658void SCH_EDIT_FRAME::showNetNavigatorMenu( const wxTreeItemId& aItem )
2659{
2660 if( !m_netNavigator )
2661 return;
2662
2663 wxMenu menu;
2664
2665 menu.Append( ID_NET_NAVIGATOR_EXPAND_ALL, _( "Expand All" ) );
2666 menu.Append( ID_NET_NAVIGATOR_COLLAPSE_ALL, _( "Collapse All" ) );
2667
2668 wxMenuItem* findInInspector = new wxMenuItem( &menu, ID_NET_NAVIGATOR_FIND_IN_INSPECTOR,
2669 _( "Find in Net Inspector" ) );
2670 menu.Append( findInInspector );
2671
2672 wxString netName;
2673
2674 if( aItem.IsOk() )
2675 {
2676 wxTreeItemId netItem = aItem;
2677
2678 if( m_netNavigator->GetItemParent( netItem ) != m_netNavigator->GetRootItem() )
2679 {
2680 wxTreeItemId parent = m_netNavigator->GetItemParent( netItem );
2681
2682 while( parent.IsOk() && parent != m_netNavigator->GetRootItem() )
2683 {
2684 netItem = parent;
2685 parent = m_netNavigator->GetItemParent( netItem );
2686 }
2687
2688 if( parent == m_netNavigator->GetRootItem() )
2689 {
2690 if( wxStringClientData* data =
2691 dynamic_cast<wxStringClientData*>( m_netNavigator->GetItemData( netItem ) ) )
2692 {
2693 netName = data->GetData();
2694 }
2695 }
2696 }
2697 else if( m_netNavigator->GetItemParent( netItem ) == m_netNavigator->GetRootItem() )
2698 {
2699 if( wxStringClientData* data =
2700 dynamic_cast<wxStringClientData*>( m_netNavigator->GetItemData( netItem ) ) )
2701 {
2702 netName = data->GetData();
2703 }
2704 }
2705 else if( !m_highlightedConn.IsEmpty() && netItem == m_netNavigator->GetRootItem() )
2706 {
2707 netName = m_highlightedConn;
2708 }
2709 }
2710 else if( !m_highlightedConn.IsEmpty() && m_netNavigator->GetRootItem().IsOk() )
2711 {
2712 netName = m_highlightedConn;
2713 }
2714
2715 if( netName.IsEmpty() )
2716 {
2717 findInInspector->Enable( false );
2719 }
2720 else
2721 {
2722 m_netNavigatorMenuNetName = netName;
2723 }
2724
2725 PopupMenu( &menu );
2726}
2727
2728
2729void SCH_EDIT_FRAME::onNetNavigatorMenuCommand( wxCommandEvent& aEvent )
2730{
2731 if( !m_netNavigator )
2732 return;
2733
2734 switch( aEvent.GetId() )
2735 {
2737 m_netNavigator->ExpandAll();
2738 break;
2739
2741 m_netNavigator->CollapseAll();
2742
2743 if( m_netNavigator->GetRootItem().IsOk() )
2744 m_netNavigator->Expand( m_netNavigator->GetRootItem() );
2745 break;
2746
2748 if( !m_netNavigatorMenuNetName.IsEmpty() )
2750 break;
2751
2754 if( EESCHEMA_SETTINGS* cfg = eeconfig() )
2755 {
2756 cfg->m_AuiPanels.net_nav_search_mode_wildcard = ( aEvent.GetId() == ID_NET_NAVIGATOR_SEARCH_WILDCARD );
2757
2758 // Refresh the navigator with current filter
2760 }
2761
2762 break;
2763
2764 default:
2765 aEvent.Skip();
2766 return;
2767 }
2768
2770
2771 aEvent.Skip( false );
2772}
2773
2774
2776{
2777 wxAuiPaneInfo& hierarchyPane = m_auimgr.GetPane( SchematicHierarchyPaneName() );
2778 wxAuiPaneInfo& netNavigatorPane = m_auimgr.GetPane( NetNavigatorPaneName() );
2779 wxAuiPaneInfo& propertiesPane = m_auimgr.GetPane( PropertiesPaneName() );
2780 wxAuiPaneInfo& selectionFilterPane = m_auimgr.GetPane( wxS( "SelectionFilter" ) );
2781
2782 // Don't give the selection filter its own visibility controls; instead show it if
2783 // anything else is visible
2784 bool showFilter = ( hierarchyPane.IsShown() && hierarchyPane.IsDocked() )
2785 || ( netNavigatorPane.IsShown() && netNavigatorPane.IsDocked() )
2786 || ( propertiesPane.IsShown() && propertiesPane.IsDocked() );
2787
2788 selectionFilterPane.Show( showFilter );
2789}
2790
2791
2792#ifdef KICAD_IPC_API
2793void SCH_EDIT_FRAME::onPluginAvailabilityChanged( wxCommandEvent& aEvt )
2794{
2795 wxLogTrace( traceApi, "SCH frame: EDA_EVT_PLUGIN_AVAILABILITY_CHANGED" );
2797 aEvt.Skip();
2798}
2799#endif
2800
2801
2803{
2804 EESCHEMA_SETTINGS* cfg = eeconfig();
2805
2806 // Ensure m_show_search is up to date (the pane can be closed outside the menu)
2807 m_show_search = m_auimgr.GetPane( SearchPaneName() ).IsShown();
2808
2810
2811 wxAuiPaneInfo& searchPaneInfo = m_auimgr.GetPane( SearchPaneName() );
2812 searchPaneInfo.Show( m_show_search );
2813
2814 if( m_show_search )
2815 {
2816 searchPaneInfo.Direction( cfg->m_AuiPanels.search_panel_dock_direction );
2817
2818 if( cfg->m_AuiPanels.search_panel_dock_direction == wxAUI_DOCK_TOP
2819 || cfg->m_AuiPanels.search_panel_dock_direction == wxAUI_DOCK_BOTTOM )
2820 {
2821 SetAuiPaneSize( m_auimgr, searchPaneInfo, -1, cfg->m_AuiPanels.search_panel_height );
2822 }
2823 else if( cfg->m_AuiPanels.search_panel_dock_direction == wxAUI_DOCK_LEFT
2824 || cfg->m_AuiPanels.search_panel_dock_direction == wxAUI_DOCK_RIGHT )
2825 {
2826 SetAuiPaneSize( m_auimgr, searchPaneInfo, cfg->m_AuiPanels.search_panel_width, -1 );
2827 }
2828
2829 m_searchPane->FocusSearch();
2830 m_searchPane->RefreshSearch();
2831 }
2832 else
2833 {
2834 cfg->m_AuiPanels.search_panel_height = m_searchPane->GetSize().y;
2835 cfg->m_AuiPanels.search_panel_width = m_searchPane->GetSize().x;
2836 cfg->m_AuiPanels.search_panel_dock_direction = searchPaneInfo.dock_direction;
2837 m_auimgr.Update();
2838 }
2839}
2840
2841
2843{
2844 if( !m_propertiesPanel )
2845 return;
2846
2847 bool show = !m_propertiesPanel->IsShownOnScreen();
2848
2849 wxAuiPaneInfo& propertiesPaneInfo = m_auimgr.GetPane( PropertiesPaneName() );
2850 propertiesPaneInfo.Show( show );
2851
2853
2854 EESCHEMA_SETTINGS* settings = eeconfig();
2855
2856 if( show )
2857 {
2858 SetAuiPaneSize( m_auimgr, propertiesPaneInfo, settings->m_AuiPanels.properties_panel_width, -1 );
2859 }
2860 else
2861 {
2862 settings->m_AuiPanels.properties_panel_width = m_propertiesPanel->GetSize().x;
2863 m_auimgr.Update();
2864 }
2865}
2866
2867
2869{
2870 EESCHEMA_SETTINGS* cfg = eeconfig();
2871
2872 wxCHECK( cfg, /* void */ );
2873
2874 wxAuiPaneInfo& hierarchy_pane = m_auimgr.GetPane( SchematicHierarchyPaneName() );
2875
2876 hierarchy_pane.Show( !hierarchy_pane.IsShown() );
2877
2879
2880 if( hierarchy_pane.IsShown() )
2881 {
2882 if( hierarchy_pane.IsFloating() )
2883 {
2884 hierarchy_pane.FloatingSize( cfg->m_AuiPanels.hierarchy_panel_float_width,
2886 m_auimgr.Update();
2887 }
2888 else if( cfg->m_AuiPanels.hierarchy_panel_docked_width > 0 )
2889 {
2890 // SetAuiPaneSize also updates m_auimgr
2892 }
2893 }
2894 else
2895 {
2896 if( hierarchy_pane.IsFloating() )
2897 {
2898 cfg->m_AuiPanels.hierarchy_panel_float_width = hierarchy_pane.floating_size.x;
2899 cfg->m_AuiPanels.hierarchy_panel_float_height = hierarchy_pane.floating_size.y;
2900 }
2901 else
2902 {
2904 }
2905
2906 m_auimgr.Update();
2907 }
2908}
2909
2910
2912{
2913 EESCHEMA_SETTINGS* cfg = eeconfig();
2914
2915 wxCHECK( cfg, /* void */ );
2916
2917 wxAuiPaneInfo& db_library_pane = m_auimgr.GetPane( DesignBlocksPaneName() );
2918
2919 db_library_pane.Show( !db_library_pane.IsShown() );
2920
2921 if( db_library_pane.IsShown() )
2922 {
2923 if( db_library_pane.IsFloating() )
2924 {
2925 db_library_pane.FloatingSize( cfg->m_AuiPanels.design_blocks_panel_float_width,
2927 m_auimgr.Update();
2928 }
2930 {
2931 // SetAuiPaneSize also updates m_auimgr
2932 SetAuiPaneSize( m_auimgr, db_library_pane,
2934 }
2935 }
2936 else
2937 {
2938 if( db_library_pane.IsFloating() )
2939 {
2940 cfg->m_AuiPanels.design_blocks_panel_float_width = db_library_pane.floating_size.x;
2941 cfg->m_AuiPanels.design_blocks_panel_float_height = db_library_pane.floating_size.y;
2942 }
2943 else
2944 {
2946 }
2947
2948 m_auimgr.Update();
2949 }
2950}
2951
2952
2954{
2955 EESCHEMA_SETTINGS* cfg = eeconfig();
2956
2957 wxCHECK( cfg, /* void */ );
2958
2959 wxAuiPaneInfo& remotePane = m_auimgr.GetPane( RemoteSymbolPaneName() );
2960
2961 remotePane.Show( !remotePane.IsShown() );
2962
2963 if( remotePane.IsShown() )
2964 {
2965 if( m_remoteSymbolPane )
2966 m_remoteSymbolPane->Activate();
2967
2968 if( remotePane.IsFloating() )
2969 {
2970 remotePane.FloatingSize( cfg->m_AuiPanels.remote_symbol_panel_float_width,
2972 m_auimgr.Update();
2973 }
2975 {
2976 SetAuiPaneSize( m_auimgr, remotePane,
2978 }
2979 }
2980 else
2981 {
2982 if( remotePane.IsFloating() )
2983 {
2984 cfg->m_AuiPanels.remote_symbol_panel_float_width = remotePane.floating_size.x;
2985 cfg->m_AuiPanels.remote_symbol_panel_float_height = remotePane.floating_size.y;
2986 }
2987 else if( m_remoteSymbolPane )
2988 {
2990 }
2991
2992 m_auimgr.Update();
2993 }
2994}
2995
2996
2998{
2999 wxCHECK( aSchematic, /* void */ );
3000
3001 if( m_schematic )
3002 m_schematic->SetProject( nullptr );
3003
3004 aSchematic->SetProject( &Prj() );
3005 delete m_schematic;
3006
3007 m_schematic = aSchematic;
3008 m_schematic->SetSchematicHolder( this );
3009
3010 KIGFX::SCH_VIEW* view = GetCanvas()->GetView();
3011 static_cast<KIGFX::SCH_PAINTER*>( view->GetPainter() )->SetSchematic( m_schematic );
3012 m_toolManager->SetEnvironment( m_schematic, GetCanvas()->GetView(), GetCanvas()->GetViewControls(), config(),
3013 this );
3014}
3015
3016
3018{
3020 return;
3021
3022 m_currentVariantCtrl->SetSelection( m_currentVariantCtrl->GetCount() - 1 );
3023
3024 wxCommandEvent dummy( wxEVT_CHOICE, ID_TOOLBAR_SCH_SELECT_VARAIANT );
3026}
3027
3028
3030{
3032 return;
3033
3034 wxArrayString choices = Schematic().GetVariantNamesForUI();
3035
3036 // Default variant cannot be removed.
3037 choices.RemoveAt( 0 );
3038
3039 // wxSingleChoiceDialog will ellipsize the title bar if the contents aren't wide enough. The set
3040 // of spaces in the control label are to prevent this.
3041 wxSingleChoiceDialog dlg( this, _( "Select variant name to remove:" ) + wxS( " " ),
3042 _( "Remove Design Variant" ), choices );
3043 dlg.Layout();
3044
3045 if( dlg.ShowModal() == wxID_CANCEL )
3046 return;
3047
3048 wxString variantName = dlg.GetStringSelection();
3049
3050 if( variantName.IsEmpty() )
3051 return;
3052
3053 SCH_COMMIT commit( this );
3054 Schematic().DeleteVariant( variantName, &commit );
3055
3056 if( !commit.Empty() )
3057 {
3058 commit.Push( wxString::Format( wxS( "Delete variant '%s'" ), variantName ) );
3059 OnModify();
3060 }
3061
3062 if( Schematic().GetCurrentVariant() == variantName )
3063 SetCurrentVariant( wxEmptyString );
3064
3065 UpdateVariantSelectionCtrl( Schematic().GetVariantNamesForUI() );
3066
3067 GetCanvas()->Refresh();
3068}
3069
3070
3072{
3073 // Delegate to base auto-save behavior (commits pending local history) for now.
3075}
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:114
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.
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:91
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition eda_text.h:109
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:60
DS_PROXY_VIEW_ITEM * GetDrawingSheet() const
Definition sch_view.h:120
void SetScale(double aScale, VECTOR2D aAnchor={ 0, 0 }) override
Set the scaling factor, zooming around a given anchor point.
Definition sch_view.cpp:102
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:798
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:216
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 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.
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.
void OnImportProject(wxCommandEvent &event)
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:161
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:488
bool ResolveExcludedFromSim(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
Definition sch_item.cpp:299
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.
Definition sch_line.cpp:992
bool IsBus() const
Return true if the line is a bus.
Definition sch_line.cpp:998
double GetLength() const
Definition sch_line.cpp:250
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:340
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:749
bool HasNoFullyDefinedLibIds()
Test all of the schematic symbols to see if all LIB_ID objects library nickname is not set.
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:497
double m_LastZoomLevel
last value for the zoom level, useful in Eeschema when changing the current displayed sheet to reuse ...
Definition sch_screen.h:676
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:701
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:137
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:147
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.
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:629
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:131
int GetLastUnsavedChangesResponse()
Return the result code from the last call to HandleUnsavedChanges(): wxID_YES, wxID_NO or wxID_CANCEL...
Definition confirm.cpp:144
void DisplayError(wxWindow *aParent, const wxString &aText)
Display an error or warning message box with aMessage.
Definition confirm.cpp:177
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
@ ID_IMPORT_NON_KICAD_SCH
Definition eeschema_id.h:62
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:146
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:27
@ 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.