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