KiCad PCB EDA Suite
Loading...
Searching...
No Matches
sch_edit_frame.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, you may find one here:
19 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20 * or you may search the http://www.gnu.org website for the version 2 license,
21 * or you may write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
25#include <algorithm>
26#include <api/api_handler_sch.h>
27#include <api/api_server.h>
28#include <base_units.h>
29#include <bitmaps.h>
30#include <confirm.h>
31#include <connection_graph.h>
32#include <dialogs/dialog_erc.h>
37#include <wx/srchctrl.h>
38#include <mail_type.h>
39#include <wx/clntdata.h>
40#include <wx/panel.h>
41#include <wx/sizer.h>
42#include <wx/menu.h>
43#include <local_history.h>
44#include <eeschema_id.h>
45#include <executable_names.h>
48#include <gestfich.h>
50#include <string_utils.h>
51#include <kiface_base.h>
52#include <kiplatform/app.h>
53#include <kiplatform/ui.h>
54#include <kiway.h>
55#include <symbol_edit_frame.h>
56#include <symbol_viewer_frame.h>
57#include <pgm_base.h>
58#include <core/profile.h>
61#include <python_scripting.h>
62#include <sch_edit_frame.h>
64#include <sch_painter.h>
65#include <sch_marker.h>
66#include <sch_sheet_pin.h>
67#include <sch_commit.h>
68#include <sch_rule_area.h>
70#include <advanced_config.h>
71#include <sim/simulator_frame.h>
72#include <tool/action_manager.h>
73#include <tool/action_toolbar.h>
74#include <tool/common_control.h>
75#include <tool/common_tools.h>
76#include <tool/embed_tool.h>
77#include <tool/picker_tool.h>
79#include <tool/selection.h>
81#include <tool/tool_manager.h>
82#include <tool/zoom_tool.h>
83#include <tools/sch_actions.h>
89#include <sch_io/sch_io_mgr.h>
90#include <sch_io/sch_io.h>
92#include <tools/sch_edit_tool.h>
98#include <tools/sch_move_tool.h>
101#include <trace_helpers.h>
102#include <unordered_set>
103#include <view/view_controls.h>
104#include <widgets/wx_infobar.h>
110#include <wx/cmdline.h>
111#include <wx/app.h>
112#include <wx/filedlg.h>
113#include <wx/socket.h>
114#include <wx/debug.h>
116#include <widgets/wx_aui_utils.h>
119#include <toolbars_sch_editor.h>
120#include <wx/log.h>
121#include <wx/choicdlg.h>
122#include <wx/textdlg.h>
123#include <wx/generic/treectlg.h>
124
125
126#ifdef KICAD_IPC_API
128#include <api/api_utils.h>
129#endif
130
132
133
134#define DIFF_SYMBOLS_DIALOG_NAME wxT( "DiffSymbolsDialog" )
135
136
137BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, SCH_BASE_FRAME )
140
141 EVT_SIZE( SCH_EDIT_FRAME::OnSize )
142
145
147
148 EVT_MENU( wxID_EXIT, SCH_EDIT_FRAME::OnExit )
149 EVT_MENU( wxID_CLOSE, SCH_EDIT_FRAME::OnExit )
150
153
154 // Drop files event
155 EVT_DROP_FILES( SCH_EDIT_FRAME::OnDropFiles )
156END_EVENT_TABLE()
157
158
159wxDEFINE_EVENT( EDA_EVT_SCHEMATIC_CHANGING, wxCommandEvent );
160wxDEFINE_EVENT( EDA_EVT_SCHEMATIC_CHANGED, wxCommandEvent );
161
162
163SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
164 SCH_BASE_FRAME( aKiway, aParent, FRAME_SCH, wxT( "Eeschema" ), wxDefaultPosition,
166 m_ercDialog( nullptr ),
167 m_diffSymbolDialog( nullptr ),
168 m_symbolFieldsTableDialog( nullptr ),
169 m_netNavigator( nullptr ),
170 m_netNavigatorFilter( nullptr ),
174 m_designBlocksPane( nullptr ),
175 m_remoteSymbolPane( nullptr ),
176 m_currentVariantCtrl( nullptr )
177{
178 m_maximizeByDefault = true;
179 m_schematic = new SCHEMATIC( &Prj() );
180 m_schematic->SetSchematicHolder( this );
182
183 m_showBorderAndTitleBlock = true; // true to show sheet references
184 m_supportsAutoSave = true;
186 m_aboutTitle = _HKI( "KiCad Schematic Editor" );
187 m_show_search = false;
188 // Ensure timer has an owner before binding so it generates events.
189 m_crossProbeFlashTimer.SetOwner( this );
190 Bind( wxEVT_TIMER, &SCH_EDIT_FRAME::OnCrossProbeFlashTimer, this, m_crossProbeFlashTimer.GetId() );
191
192 // Give an icon
193 wxIcon icon;
194 wxIconBundle icon_bundle;
195
196 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_eeschema, 48 ) );
197 icon_bundle.AddIcon( icon );
198 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_eeschema, 128 ) );
199 icon_bundle.AddIcon( icon );
200 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_eeschema, 256 ) );
201 icon_bundle.AddIcon( icon );
202 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_eeschema_32 ) );
203 icon_bundle.AddIcon( icon );
204 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_eeschema_16 ) );
205 icon_bundle.AddIcon( icon );
206
207 SetIcons( icon_bundle );
208
210
211 setupTools();
214
218
219 // Ensure the "Line modes" toolbar group shows the current angle mode on startup
220 if( GetToolManager() )
222
223#ifdef KICAD_IPC_API
224 wxTheApp->Bind( EDA_EVT_PLUGIN_AVAILABILITY_CHANGED, &SCH_EDIT_FRAME::onPluginAvailabilityChanged, this );
225#endif
226
227 m_hierarchy = new HIERARCHY_PANE( this );
228
229 // Initialize common print setup dialog settings.
230 m_pageSetupData.GetPrintData().SetPrintMode( wxPRINT_MODE_PRINTER );
231 m_pageSetupData.GetPrintData().SetQuality( wxPRINT_QUALITY_MEDIUM );
232 m_pageSetupData.GetPrintData().SetBin( wxPRINTBIN_AUTO );
233 m_pageSetupData.GetPrintData().SetNoCopies( 1 );
234
235 m_searchPane = new SCH_SEARCH_PANE( this );
236 m_propertiesPanel = new SCH_PROPERTIES_PANEL( this, this );
238
239 m_propertiesPanel->SetSplitterProportion( eeconfig()->m_AuiPanels.properties_splitter );
240
243
244 m_auimgr.SetManagedWindow( this );
245
247
248 // Fetch a COPY of the config as a lot of these initializations are going to overwrite our
249 // data.
250 EESCHEMA_SETTINGS::AUI_PANELS aui_cfg = eeconfig()->m_AuiPanels;
251 EESCHEMA_SETTINGS::APPEARANCE appearance_cfg = eeconfig()->m_Appearance;
252
253 // Rows; layers 4 - 6
254 m_auimgr.AddPane( m_tbTopMain, EDA_PANE().HToolbar().Name( wxS( "TopMainToolbar" ) )
255 .Top().Layer( 6 ) );
256
257 m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( wxS( "MsgPanel" ) )
258 .Bottom().Layer( 6 ) );
259
260 // Columns; layers 1 - 3
261 m_auimgr.AddPane( m_hierarchy, EDA_PANE().Palette().Name( SchematicHierarchyPaneName() )
262 .Caption( _( "Schematic Hierarchy" ) )
263 .Left().Layer( 3 ).Position( 1 )
264 .TopDockable( false )
265 .BottomDockable( false )
266 .CloseButton( true )
267 .MinSize( FromDIP( wxSize( 120, 60 ) ) )
268 .BestSize( FromDIP( wxSize( 200, 200 ) ) )
269 .FloatingSize( FromDIP( wxSize( 200, 200 ) ) )
270 .FloatingPosition( FromDIP( wxPoint( 50, 50 ) ) )
271 .Show( false ) );
272
275
278
280
281 m_auimgr.AddPane( m_tbLeft, EDA_PANE().VToolbar().Name( wxS( "LeftToolbar" ) )
282 .Left().Layer( 2 ) );
283
284 m_auimgr.AddPane( m_tbRight, EDA_PANE().VToolbar().Name( wxS( "RightToolbar" ) )
285 .Right().Layer( 2 ) );
286
287 // Center
288 m_auimgr.AddPane( GetCanvas(), EDA_PANE().Canvas().Name( wxS( "DrawFrame" ) )
289 .Center() );
290
291 m_auimgr.AddPane( m_searchPane, EDA_PANE()
292 .Name( SearchPaneName() )
293 .Bottom()
294 .Caption( _( "Search" ) )
295 .PaneBorder( false )
296 .MinSize( FromDIP( wxSize( 180, 60 ) ) )
297 .BestSize( FromDIP( wxSize( 180, 100 ) ) )
298 .FloatingSize( FromDIP( wxSize( 480, 200 ) ) )
299 .CloseButton( true )
300 .DestroyOnClose( false )
301 .Show( m_show_search ) );
302
305
306 wxAuiPaneInfo& hierarchy_pane = m_auimgr.GetPane( SchematicHierarchyPaneName() );
307 wxAuiPaneInfo& netNavigatorPane = m_auimgr.GetPane( NetNavigatorPaneName() );
308 wxAuiPaneInfo& propertiesPane = m_auimgr.GetPane( PropertiesPaneName() );
309 wxAuiPaneInfo& selectionFilterPane = m_auimgr.GetPane( wxS( "SelectionFilter" ) );
310 wxAuiPaneInfo& designBlocksPane = m_auimgr.GetPane( DesignBlocksPaneName() );
311 wxAuiPaneInfo& remoteSymbolPane = m_auimgr.GetPane( RemoteSymbolPaneName() );
312
313 hierarchy_pane.Show( aui_cfg.show_schematic_hierarchy );
314 netNavigatorPane.Show( aui_cfg.show_net_nav_panel );
315 propertiesPane.Show( aui_cfg.show_properties );
316 designBlocksPane.Show( aui_cfg.design_blocks_show );
317
318 if( m_remoteSymbolPane && !m_remoteSymbolPane->HasDataSources() )
319 remoteSymbolPane.Show( false );
320 else
321 remoteSymbolPane.Show( aui_cfg.remote_symbol_show );
322
324
325 // The selection filter doesn't need to grow in the vertical direction when docked
326 selectionFilterPane.dock_proportion = 0;
327
328 if( aui_cfg.hierarchy_panel_float_width > 0 && aui_cfg.hierarchy_panel_float_height > 0 )
329 {
330 // Show at end, after positioning
331 hierarchy_pane.FloatingSize( aui_cfg.hierarchy_panel_float_width,
333 }
334
335 if( aui_cfg.net_nav_panel_float_size.GetWidth() > 0
336 && aui_cfg.net_nav_panel_float_size.GetHeight() > 0 )
337 {
338 netNavigatorPane.FloatingSize( aui_cfg.net_nav_panel_float_size );
339 netNavigatorPane.FloatingPosition( aui_cfg.net_nav_panel_float_pos );
340 }
341
342 if( aui_cfg.properties_panel_width > 0 )
343 SetAuiPaneSize( m_auimgr, propertiesPane, aui_cfg.properties_panel_width, -1 );
344
345 if( aui_cfg.schematic_hierarchy_float )
346 hierarchy_pane.Float();
347
348 if( aui_cfg.search_panel_height > 0 && ( aui_cfg.search_panel_dock_direction == wxAUI_DOCK_TOP
349 || aui_cfg.search_panel_dock_direction == wxAUI_DOCK_BOTTOM ) )
350 {
351 wxAuiPaneInfo& searchPane = m_auimgr.GetPane( SearchPaneName() );
352 searchPane.Direction( aui_cfg.search_panel_dock_direction );
353 SetAuiPaneSize( m_auimgr, searchPane, -1, aui_cfg.search_panel_height );
354 }
355
356 else if( aui_cfg.search_panel_width > 0 && ( aui_cfg.search_panel_dock_direction == wxAUI_DOCK_LEFT
357 || aui_cfg.search_panel_dock_direction == wxAUI_DOCK_RIGHT ) )
358 {
359 wxAuiPaneInfo& searchPane = m_auimgr.GetPane( SearchPaneName() );
360 searchPane.Direction( aui_cfg.search_panel_dock_direction );
361 SetAuiPaneSize( m_auimgr, searchPane, aui_cfg.search_panel_width, -1 );
362 }
363
364 if( aui_cfg.float_net_nav_panel )
365 netNavigatorPane.Float();
366
367 if( aui_cfg.design_blocks_show )
368 SetAuiPaneSize( m_auimgr, designBlocksPane, aui_cfg.design_blocks_panel_docked_width, -1 );
369
370 if( aui_cfg.remote_symbol_show )
371 SetAuiPaneSize( m_auimgr, remoteSymbolPane, aui_cfg.remote_symbol_panel_docked_width, -1 );
372
373 if( aui_cfg.hierarchy_panel_docked_width > 0 )
374 {
375 // If the net navigator is not show, let the hierarchy navigator take all of the vertical
376 // space.
377 if( !aui_cfg.show_net_nav_panel )
378 {
379 SetAuiPaneSize( m_auimgr, hierarchy_pane, aui_cfg.hierarchy_panel_docked_width, -1 );
380 }
381 else
382 {
383 SetAuiPaneSize( m_auimgr, hierarchy_pane,
386
387 SetAuiPaneSize( m_auimgr, netNavigatorPane,
388 aui_cfg.net_nav_panel_docked_size.GetWidth(),
389 aui_cfg.net_nav_panel_docked_size.GetHeight() );
390 }
391
392 // wxAUI hack: force width by setting MinSize() and then Fixed()
393 // thanks to ZenJu https://github.com/wxWidgets/wxWidgets/issues/13180
394 hierarchy_pane.MinSize( aui_cfg.hierarchy_panel_docked_width, 60 );
395 hierarchy_pane.Fixed();
396 netNavigatorPane.MinSize( aui_cfg.net_nav_panel_docked_size.GetWidth(), 60 );
397 netNavigatorPane.Fixed();
398 m_auimgr.Update();
399
400 // now make it resizable again
401 hierarchy_pane.Resizable();
402 netNavigatorPane.Resizable();
403 m_auimgr.Update();
404
405 // Note: DO NOT call m_auimgr.Update() anywhere after this; it will nuke the size
406 // back to minimum.
407 hierarchy_pane.MinSize( FromDIP( wxSize( 120, 60 ) ) );
408 netNavigatorPane.MinSize( FromDIP( wxSize( 120, 60 ) ) );
409 }
410 else
411 {
412 m_auimgr.Update();
413 }
414
417
418 GetCanvas()->GetGAL()->SetAxesEnabled( false );
419
420 KIGFX::SCH_VIEW* view = GetCanvas()->GetView();
421 static_cast<KIGFX::SCH_PAINTER*>( view->GetPainter() )->SetSchematic( m_schematic );
422
425
426 view->SetLayerVisible( LAYER_ERC_ERR, appearance_cfg.show_erc_errors );
427 view->SetLayerVisible( LAYER_ERC_WARN, appearance_cfg.show_erc_warnings );
429 view->SetLayerVisible( LAYER_OP_VOLTAGES, appearance_cfg.show_op_voltages );
430 view->SetLayerVisible( LAYER_OP_CURRENTS, appearance_cfg.show_op_currents );
431
433
435 m_netNavigator->Bind( wxEVT_TREE_SEL_CHANGING, &SCH_EDIT_FRAME::onNetNavigatorSelChanging, this );
436 m_netNavigator->Bind( wxEVT_TREE_SEL_CHANGED, &SCH_EDIT_FRAME::onNetNavigatorSelection, this );
437 m_netNavigator->Bind( wxEVT_SIZE, &SCH_EDIT_FRAME::onResizeNetNavigator, this );
438
439 // This is used temporarily to fix a client size issue on GTK that causes zoom to fit
440 // to calculate the wrong zoom size. See SCH_EDIT_FRAME::onSize().
441 Bind( wxEVT_SIZE, &SCH_EDIT_FRAME::onSize, this );
442
443 setupUnits( eeconfig() );
444
445 // Net list generator
447
448 updateTitle();
449 m_toolManager->GetTool<SCH_NAVIGATE_TOOL>()->ResetHistory();
450
451#ifdef KICAD_IPC_API
452 m_apiHandler = std::make_unique<API_HANDLER_SCH>( this );
453 Pgm().GetApiServer().RegisterHandler( m_apiHandler.get() );
454#endif
455
456 // Default shutdown reason until a file is loaded
457 KIPLATFORM::APP::SetShutdownBlockReason( this, _( "New schematic file is unsaved" ) );
458
459 // Init for dropping files
463 m_acceptedExts.emplace( wxS( "jpeg" ), &SCH_ACTIONS::ddAddImage );
464 m_acceptedExts.emplace( wxS( "dxf" ), &SCH_ACTIONS::ddImportGraphics );
466 DragAcceptFiles( true );
467
468 // Ensure the window is on top
469 Raise();
470
471 // Now that all sizes are fixed, set the initial hierarchy_pane floating position to the
472 // top-left corner of the canvas
473 wxPoint canvas_pos = GetCanvas()->GetScreenPosition();
474 hierarchy_pane.FloatingPosition( canvas_pos.x + 10, canvas_pos.y + 10 );
475
476 Bind( wxEVT_CHOICE, &SCH_EDIT_FRAME::onVariantSelected, this );
477 Bind( EDA_EVT_CLOSE_DIALOG_BOOK_REPORTER, &SCH_EDIT_FRAME::onCloseSymbolDiffDialog, this );
478 Bind( EDA_EVT_CLOSE_ERC_DIALOG, &SCH_EDIT_FRAME::onCloseErcDialog, this );
479 Bind( EDA_EVT_CLOSE_DIALOG_SYMBOL_FIELDS_TABLE, &SCH_EDIT_FRAME::onCloseSymbolFieldsTableDialog, this );
480}
481
482void SCH_EDIT_FRAME::StartCrossProbeFlash( const std::vector<SCH_ITEM*>& aItems )
483{
484 if( !eeconfig()->m_CrossProbing.flash_selection )
485 {
486 wxLogTrace( traceCrossProbeFlash, "StartCrossProbeFlash: aborted (setting disabled) items=%zu", aItems.size() );
487 return;
488 }
489
490 if( aItems.empty() )
491 {
492 wxLogTrace( traceCrossProbeFlash, "StartCrossProbeFlash: aborted (no items)" );
493 return;
494 }
495
497 {
498 wxLogTrace( traceCrossProbeFlash, "StartCrossProbeFlash: restarting existing flash (phase=%d)",
501 }
502
503 wxLogTrace( traceCrossProbeFlash, "StartCrossProbeFlash: starting with %zu items", aItems.size() );
505
506 for( SCH_ITEM* it : aItems )
507 m_crossProbeFlashItems.push_back( it->m_Uuid );
508
511
512 if( !m_crossProbeFlashTimer.GetOwner() )
513 m_crossProbeFlashTimer.SetOwner( this );
514
515 bool started = m_crossProbeFlashTimer.Start( 500, wxTIMER_CONTINUOUS );
516 wxLogTrace( traceCrossProbeFlash, "StartCrossProbeFlash: timer start=%d id=%d", (int) started,
517 m_crossProbeFlashTimer.GetId() );
518}
519
520
521void SCH_EDIT_FRAME::OnCrossProbeFlashTimer( wxTimerEvent& aEvent )
522{
523 wxLogTrace( traceCrossProbeFlash, "Timer(SCH) fired: phase=%d running=%d items=%zu", m_crossProbeFlashPhase,
525
527 {
528 wxLogTrace( traceCrossProbeFlash, "Timer fired but not flashing (ignored)" );
529 return;
530 }
531
533
534 if( !selTool )
535 return;
536
537 bool prevGuard = m_syncingPcbToSchSelection;
539
540 if( m_crossProbeFlashPhase % 2 == 0 )
541 {
542 selTool->ClearSelection( true );
543 wxLogTrace( traceCrossProbeFlash, "Phase %d: cleared selection", m_crossProbeFlashPhase );
544 }
545 else
546 {
547 for( const KIID& id : m_crossProbeFlashItems )
548 {
549 if( SCH_ITEM* item = Schematic().ResolveItem( id, nullptr, true ) )
550 selTool->AddItemToSel( item, true );
551 }
552
553 wxLogTrace( traceCrossProbeFlash, "Phase %d: restored %zu items", m_crossProbeFlashPhase,
554 m_crossProbeFlashItems.size() );
555 }
556
557 if( GetCanvas() )
558 {
560 wxLogTrace( traceCrossProbeFlash, "Phase %d: forced canvas refresh", m_crossProbeFlashPhase );
561 }
562
563 m_syncingPcbToSchSelection = prevGuard;
565
566 if( m_crossProbeFlashPhase > 6 )
567 {
568 for( const KIID& id : m_crossProbeFlashItems )
569 {
570 if( SCH_ITEM* item = Schematic().ResolveItem( id, nullptr, true ) )
571 selTool->AddItemToSel( item, true );
572 }
573
574 m_crossProbeFlashing = false;
576 wxLogTrace( traceCrossProbeFlash, "Flashing complete. Final selection size=%zu",
577 m_crossProbeFlashItems.size() );
578 }
579}
580
581
583{
584 m_hierarchy->Unbind( wxEVT_SIZE, &SCH_EDIT_FRAME::OnResizeHierarchyNavigator, this );
585
586 // Ensure m_canvasType is up to date, to save it in config
588
589 SetScreen( nullptr );
590
591 if( m_schematic )
592 m_schematic->RemoveAllListeners();
593
594 // Delete all items not in draw list before deleting schematic
595 // to avoid dangling pointers stored in these items
598
599 delete m_schematic;
600 m_schematic = nullptr;
601
602 // Close the project if we are standalone, so it gets cleaned up properly
603 if( Kiface().IsSingle() )
604 {
605 try
606 {
607 GetSettingsManager()->UnloadProject( &Prj(), false );
608 }
609 catch( const std::runtime_error& e )
610 {
611 wxFAIL_MSG( wxString::Format( wxT( "Settings exception occurred: %s" ), e.what() ) );
612 }
613 }
614
615 // We passed ownership of these to wxAuiManager.
616 // delete m_hierarchy;
617 // delete m_selectionFilterPanel;
618}
619
620
622{
623 aEvent.Skip();
624
625 // 1st Call: Handle the size update during the first resize event.
627
628 // Defer the second size capture
629 CallAfter( [this]()
630 {
632 } );
633}
634
635
637{
638 // Called when resizing the Hierarchy Navigator panel
639 // Store the current pane size
640 // It allows to retrieve the last defined pane size when switching between
641 // docked and floating pane state
642 // Note: *DO NOT* call m_auimgr.Update() here: it crashes KiCad at least on Windows
643
644 EESCHEMA_SETTINGS* cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
645 wxAuiPaneInfo& hierarchy_pane = m_auimgr.GetPane( SchematicHierarchyPaneName() );
646
647 if( cfg && m_hierarchy->IsShownOnScreen() )
648 {
649 cfg->m_AuiPanels.hierarchy_panel_float_width = hierarchy_pane.floating_size.x;
650 cfg->m_AuiPanels.hierarchy_panel_float_height = hierarchy_pane.floating_size.y;
651
652 // initialize hierarchy_panel_docked_width and best size only if the hierarchy_pane
653 // width is > 0 (i.e. if its size is already set and has meaning)
654 // if it is floating, its size is not initialized (only floating_size is initialized)
655 // initializing hierarchy_pane.best_size is useful when switching to float pane and
656 // after switching to the docked pane, to retrieve the last docked pane width
657 if( hierarchy_pane.rect.width > 50 ) // 50 is a good margin
658 {
659 cfg->m_AuiPanels.hierarchy_panel_docked_width = hierarchy_pane.rect.width;
660 hierarchy_pane.best_size.x = hierarchy_pane.rect.width;
661 }
662 }
663}
664
665
667{
668 // Create the manager and dispatcher & route draw panel events to the dispatcher
670 m_toolManager->SetEnvironment( &Schematic(), GetCanvas()->GetView(),
671 GetCanvas()->GetViewControls(), config(), this );
672 m_actions = new SCH_ACTIONS();
674
675 // Register tools
676 m_toolManager->RegisterTool( new COMMON_CONTROL );
677 m_toolManager->RegisterTool( new COMMON_TOOLS );
678 m_toolManager->RegisterTool( new ZOOM_TOOL );
679 m_toolManager->RegisterTool( new SCH_SELECTION_TOOL );
680 m_toolManager->RegisterTool( new PICKER_TOOL );
681 m_toolManager->RegisterTool( new SCH_DRAWING_TOOLS );
682 m_toolManager->RegisterTool( new SCH_LINE_WIRE_BUS_TOOL );
683 m_toolManager->RegisterTool( new SCH_MOVE_TOOL );
684 m_toolManager->RegisterTool( new SCH_ALIGN_TOOL );
685 m_toolManager->RegisterTool( new SCH_EDIT_TOOL );
686 m_toolManager->RegisterTool( new SCH_EDIT_TABLE_TOOL );
687 m_toolManager->RegisterTool( new SCH_GROUP_TOOL );
688 m_toolManager->RegisterTool( new SCH_INSPECTION_TOOL );
689 m_toolManager->RegisterTool( new SCH_DESIGN_BLOCK_CONTROL );
690 m_toolManager->RegisterTool( new SCH_EDITOR_CONTROL );
691 m_toolManager->RegisterTool( new SCH_FIND_REPLACE_TOOL );
692 m_toolManager->RegisterTool( new SCH_POINT_EDITOR );
693 m_toolManager->RegisterTool( new SCH_NAVIGATE_TOOL );
694 m_toolManager->RegisterTool( new PROPERTIES_TOOL );
695 m_toolManager->RegisterTool( new EMBED_TOOL );
696 m_toolManager->InitTools();
697
698 // Run the selection tool, it is supposed to be always active
700
702}
703
704
706{
708
709 ACTION_MANAGER* mgr = m_toolManager->GetActionManager();
710 SCH_EDITOR_CONDITIONS cond( this );
711
712 wxASSERT( mgr );
713
714 auto hasElements =
715 [ this ] ( const SELECTION& aSel )
716 {
717 return GetScreen() &&
718 ( !GetScreen()->Items().empty() || !SELECTION_CONDITIONS::Idle( aSel ) );
719 };
720
721 auto searchPaneCond =
722 [this] ( const SELECTION& )
723 {
724 return m_auimgr.GetPane( SearchPaneName() ).IsShown();
725 };
726
727 auto propertiesCond =
728 [this] ( const SELECTION& )
729 {
730 return m_auimgr.GetPane( PropertiesPaneName() ).IsShown();
731 };
732
733 auto hierarchyNavigatorCond =
734 [ this ] ( const SELECTION& aSel )
735 {
736 return m_auimgr.GetPane( SchematicHierarchyPaneName() ).IsShown();
737 };
738
739 auto netNavigatorCond =
740 [ this ] (const SELECTION& aSel )
741 {
742 return m_auimgr.GetPane( NetNavigatorPaneName() ).IsShown();
743 };
744
745 auto designBlockCond =
746 [ this ] (const SELECTION& aSel )
747 {
748 return m_auimgr.GetPane( DesignBlocksPaneName() ).IsShown();
749 };
750
751 auto remoteSymbolCond =
752 [ this ] (const SELECTION& aSel )
753 {
754 return m_auimgr.GetPane( RemoteSymbolPaneName() ).IsShown();
755 };
756
757 auto undoCond =
758 [ this ] (const SELECTION& aSel )
759 {
761 return true;
762
763 return GetUndoCommandCount() > 0;
764 };
765
766 auto groupWithDesignBlockLink =
767 [] ( const SELECTION& aSel )
768 {
769 if( aSel.Size() != 1 )
770 return false;
771
772 if( aSel[0]->Type() != SCH_GROUP_T )
773 return false;
774
775 SCH_GROUP* group = static_cast<SCH_GROUP*>( aSel.GetItem( 0 ) );
776
777 return group->HasDesignBlockLink();
778 };
779
780#define ENABLE( x ) ACTION_CONDITIONS().Enable( x )
781#define CHECK( x ) ACTION_CONDITIONS().Check( x )
782
784 mgr->SetConditions( ACTIONS::undo, ENABLE( undoCond ) );
786
787 mgr->SetConditions( SCH_ACTIONS::showSearch, CHECK( searchPaneCond ) );
788 mgr->SetConditions( SCH_ACTIONS::showHierarchy, CHECK( hierarchyNavigatorCond ) );
789 mgr->SetConditions( SCH_ACTIONS::showNetNavigator, CHECK( netNavigatorCond ) );
790 mgr->SetConditions( ACTIONS::showProperties, CHECK( propertiesCond ) );
791 mgr->SetConditions( SCH_ACTIONS::showDesignBlockPanel, CHECK( designBlockCond ) );
792 mgr->SetConditions( SCH_ACTIONS::showRemoteSymbolPanel, CHECK( remoteSymbolCond ) );
795
796 mgr->SetConditions( ACTIONS::cut, ENABLE( hasElements ) );
797 mgr->SetConditions( ACTIONS::copy, ENABLE( hasElements ) );
798 mgr->SetConditions( ACTIONS::copyAsText, ENABLE( hasElements ) );
801 mgr->SetConditions( ACTIONS::doDelete, ENABLE( hasElements ) );
802 mgr->SetConditions( ACTIONS::duplicate, ENABLE( hasElements ) );
809 mgr->SetConditions( ACTIONS::selectAll, ENABLE( hasElements ) );
810 mgr->SetConditions( ACTIONS::unselectAll, ENABLE( hasElements ) );
811
812 mgr->SetConditions( SCH_ACTIONS::rotateCW, ENABLE( hasElements ) );
813 mgr->SetConditions( SCH_ACTIONS::rotateCCW, ENABLE( hasElements ) );
814 mgr->SetConditions( SCH_ACTIONS::mirrorH, ENABLE( hasElements ) );
815 mgr->SetConditions( SCH_ACTIONS::mirrorV, ENABLE( hasElements ) );
818
819 mgr->SetConditions( SCH_ACTIONS::placeLinkedDesignBlock, ENABLE( groupWithDesignBlockLink ) );
820 mgr->SetConditions( SCH_ACTIONS::saveToLinkedDesignBlock, ENABLE( groupWithDesignBlockLink ) );
821
824
825 auto showHiddenPinsCond =
826 [this]( const SELECTION& )
827 {
828 return GetShowAllPins();
829 };
830
831 auto showHiddenFieldsCond =
832 [this]( const SELECTION& )
833 {
835 return cfg && cfg->m_Appearance.show_hidden_fields;
836 };
837
838 auto showDirectiveLabelsCond =
839 [this]( const SELECTION& )
840 {
842 return cfg && cfg->m_Appearance.show_directive_labels;
843 };
844
845 auto showERCErrorsCond =
846 [this]( const SELECTION& )
847 {
849 return cfg && cfg->m_Appearance.show_erc_errors;
850 };
851
852 auto showERCWarningsCond =
853 [this]( const SELECTION& )
854 {
856 return cfg && cfg->m_Appearance.show_erc_warnings;
857 };
858
859 auto showERCExclusionsCond =
860 [this]( const SELECTION& )
861 {
863 return cfg && cfg->m_Appearance.show_erc_exclusions;
864 };
865
866 auto markSimExclusionsCond =
867 [this]( const SELECTION& )
868 {
870 return cfg && cfg->m_Appearance.mark_sim_exclusions;
871 };
872
873 auto showOPVoltagesCond =
874 [this]( const SELECTION& )
875 {
877 return cfg && cfg->m_Appearance.show_op_voltages;
878 };
879
880 auto showOPCurrentsCond =
881 [this]( const SELECTION& )
882 {
884 return cfg && cfg->m_Appearance.show_op_currents;
885 };
886
887 auto showPinAltModeIconsCond =
888 [this]( const SELECTION& )
889 {
891 return cfg && cfg->m_Appearance.show_pin_alt_icons;
892 };
893
894 auto showAnnotateAutomaticallyCond =
895 [this]( const SELECTION& )
896 {
898 };
899
900 auto remapSymbolsCondition =
901 [&]( const SELECTION& aSel )
902 {
903 SCH_SCREENS schematic( Schematic().Root() );
904
905 // The remapping can only be performed on legacy projects.
906 return schematic.HasNoFullyDefinedLibIds();
907 };
908
909 auto belowRootSheetCondition =
910 [this]( const SELECTION& aSel )
911 {
912 SCH_NAVIGATE_TOOL* navigateTool = m_toolManager->GetTool<SCH_NAVIGATE_TOOL>();
913 return navigateTool && navigateTool->CanGoUp();
914 };
915
916 mgr->SetConditions( SCH_ACTIONS::leaveSheet, ENABLE( belowRootSheetCondition ) );
917
918 /* Some of these are bound by default to arrow keys which will get a different action if we
919 * disable the buttons. So always leave them enabled so the action is consistent.
920 * https://gitlab.com/kicad/code/kicad/-/issues/14783
921 mgr->SetConditions( SCH_ACTIONS::navigateUp, ENABLE( belowRootSheetCondition ) );
922 mgr->SetConditions( SCH_ACTIONS::navigateForward, ENABLE( navHistoryHasForward ) );
923 mgr->SetConditions( SCH_ACTIONS::navigateBack, ENABLE( navHistoryHsBackward ) );
924 */
925
926 mgr->SetConditions( SCH_ACTIONS::remapSymbols, ENABLE( remapSymbolsCondition ) );
927 mgr->SetConditions( SCH_ACTIONS::toggleHiddenPins, CHECK( showHiddenPinsCond ) );
928 mgr->SetConditions( SCH_ACTIONS::toggleHiddenFields, CHECK( showHiddenFieldsCond ) );
929 mgr->SetConditions( SCH_ACTIONS::toggleDirectiveLabels, CHECK( showDirectiveLabelsCond ) );
930 mgr->SetConditions( SCH_ACTIONS::toggleERCErrors, CHECK( showERCErrorsCond ) );
931 mgr->SetConditions( SCH_ACTIONS::toggleERCWarnings, CHECK( showERCWarningsCond ) );
932 mgr->SetConditions( SCH_ACTIONS::toggleERCExclusions, CHECK( showERCExclusionsCond ) );
933 mgr->SetConditions( SCH_ACTIONS::markSimExclusions, CHECK( markSimExclusionsCond ) );
934 mgr->SetConditions( SCH_ACTIONS::toggleOPVoltages, CHECK( showOPVoltagesCond ) );
935 mgr->SetConditions( SCH_ACTIONS::toggleOPCurrents, CHECK( showOPCurrentsCond ) );
936 mgr->SetConditions( SCH_ACTIONS::togglePinAltIcons, CHECK( showPinAltModeIconsCond ) );
937 mgr->SetConditions( SCH_ACTIONS::toggleAnnotateAuto, CHECK( showAnnotateAutomaticallyCond ) );
939
942
943#define CURRENT_TOOL( action ) mgr->SetConditions( action, CHECK( cond.CurrentTool( action ) ) )
944
974
975#undef CURRENT_TOOL
976#undef CHECK
977#undef ENABLE
978}
979
980
982{
983 // we cannot store a pointer to an item in the display list here since
984 // that item may be deleted, such as part of a line concatenation or other.
985 // So simply always keep a copy of the object which is to be repeated.
986
987 if( aItem )
988 {
989 m_items_to_repeat.clear();
990
991 AddCopyForRepeatItem( aItem );
992 }
993}
994
995
997{
998 // we cannot store a pointer to an item in the display list here since
999 // that item may be deleted, such as part of a line concatenation or other.
1000 // So simply always keep a copy of the object which is to be repeated.
1001
1002 if( aItem )
1003 {
1004 std::unique_ptr<SCH_ITEM> repeatItem( static_cast<SCH_ITEM*>( aItem->Duplicate( IGNORE_PARENT_GROUP ) ) );
1005
1006 // Clone() preserves the flags & parent, we want 'em cleared.
1007 repeatItem->ClearFlags();
1008 repeatItem->SetParent( nullptr );
1009
1010 m_items_to_repeat.emplace_back( std::move( repeatItem ) );
1011 }
1012}
1013
1014
1015EDA_ITEM* SCH_EDIT_FRAME::ResolveItem( const KIID& aId, bool aAllowNullptrReturn ) const
1016{
1017 return Schematic().ResolveItem( aId, nullptr, aAllowNullptrReturn );
1018}
1019
1020
1025
1026
1031
1032
1034{
1035 return *m_schematic;
1036}
1037
1038
1040{
1041 return GetCurrentSheet().Last()->GetName();
1042}
1043
1044
1046{
1048}
1049
1050
1052{
1053 m_schematic->CreateDefaultScreens();
1054 SetScreen( Schematic().RootScreen() );
1055
1056 if( GetScreen() == nullptr )
1057 {
1058 SCH_SCREEN* screen = new SCH_SCREEN( m_schematic );
1059 SetScreen( screen );
1060 }
1061}
1062
1063
1065{
1066 return m_schematic->CurrentSheet();
1067}
1068
1069
1071{
1072 if( aSheet != GetCurrentSheet() )
1073 {
1074 ClearFocus();
1075
1076 wxLogTrace( traceSchCurrentSheet,
1077 "SCH_EDIT_FRAME::SetCurrentSheet: Changing from path='%s' (size=%zu) to path='%s' (size=%zu)",
1078 GetCurrentSheet().Path().AsString(),
1079 GetCurrentSheet().size(),
1080 aSheet.Path().AsString(),
1081 aSheet.size() );
1082
1083 Schematic().SetCurrentSheet( aSheet );
1084 GetCanvas()->DisplaySheet( aSheet.LastScreen() );
1085 }
1086}
1087
1088
1090{
1092
1093 for( SCH_ITEM* item : screen->Items() )
1094 item->ClearCaches();
1095
1096 for( const std::pair<const wxString, LIB_SYMBOL*>& libSymbol : screen->GetLibSymbols() )
1097 {
1098 wxCHECK2( libSymbol.second, continue );
1099 libSymbol.second->ClearCaches();
1100 }
1101
1102 if( Schematic().Settings().m_IntersheetRefsShow )
1104
1105 ClearFocus();
1106
1107 GetCanvas()->DisplaySheet( GetCurrentSheet().LastScreen() );
1108
1109 if( SCH_SELECTION_TOOL* selectionTool = m_toolManager->GetTool<SCH_SELECTION_TOOL>() )
1110 selectionTool->Reset( TOOL_BASE::REDRAW );
1111
1113}
1114
1115
1116bool SCH_EDIT_FRAME::canCloseWindow( wxCloseEvent& aEvent )
1117{
1118 // Exit interactive editing
1119 // Note this this will commit *some* pending changes. For instance, the SCH_POINT_EDITOR
1120 // will cancel any drag currently in progress, but commit all changes from previous drags.
1121 if( m_toolManager )
1123
1124 // Shutdown blocks must be determined and vetoed as early as possible
1125 if( KIPLATFORM::APP::SupportsShutdownBlockReason() && aEvent.GetId() == wxEVT_QUERY_END_SESSION
1126 && IsContentModified() )
1127 {
1128 return false;
1129 }
1130
1131 if( Kiface().IsSingle() )
1132 {
1133 auto* symbolEditor = (SYMBOL_EDIT_FRAME*) Kiway().Player( FRAME_SCH_SYMBOL_EDITOR, false );
1134
1135 if( symbolEditor && !symbolEditor->Close() ) // Can close symbol editor?
1136 return false;
1137
1138 auto* symbolViewer = (SYMBOL_VIEWER_FRAME*) Kiway().Player( FRAME_SCH_VIEWER, false );
1139
1140 if( symbolViewer && !symbolViewer->Close() ) // Can close symbol viewer?
1141 return false;
1142
1143 // SYMBOL_CHOOSER_FRAME is always modal so this shouldn't come up, but better safe than
1144 // sorry.
1145 auto* chooser = (SYMBOL_CHOOSER_FRAME*) Kiway().Player( FRAME_SYMBOL_CHOOSER, false );
1146
1147 if( chooser && !chooser->Close() ) // Can close symbol chooser?
1148 return false;
1149 }
1150 else
1151 {
1152 auto* symbolEditor = (SYMBOL_EDIT_FRAME*) Kiway().Player( FRAME_SCH_SYMBOL_EDITOR, false );
1153
1154 if( symbolEditor && symbolEditor->IsSymbolFromSchematic() )
1155 {
1156 if( !symbolEditor->CanCloseSymbolFromSchematic( true ) )
1157 return false;
1158 }
1159 }
1160
1161 if( !Kiway().PlayerClose( FRAME_SIMULATOR, false ) ) // Can close the simulator?
1162 return false;
1163
1165 && !m_symbolFieldsTableDialog->Close( false ) ) // Can close the symbol fields table?
1166 {
1167 return false;
1168 }
1169
1170 // We may have gotten multiple events; don't clean up twice
1171 if( !Schematic().IsValid() )
1172 return false;
1173
1174 if( IsContentModified() )
1175 {
1176 wxFileName fileName = Schematic().RootScreen()->GetFileName();
1177 wxString msg = _( "Save changes to '%s' before closing?" );
1178
1179 if( !HandleUnsavedChanges( this, wxString::Format( msg, fileName.GetFullName() ),
1180 [&]() -> bool
1181 {
1182 return SaveProject();
1183 } ) )
1184 {
1185 return false;
1186 }
1187
1188 // If user selected 'No' (discard), create duplicate commit of last saved state and
1189 // move Last_Save tag forward so history shows an explicit discard event.
1190 if( GetLastUnsavedChangesResponse() == wxID_NO )
1191 {
1192 wxString projPath = Prj().GetProjectPath();
1193
1194 if( !projPath.IsEmpty() && Kiway().LocalHistory().HistoryExists( projPath ) )
1195 {
1196 Kiway().LocalHistory().CommitDuplicateOfLastSave( projPath, wxS( "Schematic" ),
1197 wxS( "Discard unsaved schematic changes" ) );
1198 }
1199 }
1200 }
1201
1202 return true;
1203}
1204
1205
1207{
1208 // Unregister the autosave saver before any cleanup that might invalidate m_schematic
1209 if( m_schematic )
1211
1213
1214 SCH_SHEET_LIST sheetlist = Schematic().Hierarchy();
1215
1216#ifdef KICAD_IPC_API
1217 Pgm().GetApiServer().DeregisterHandler( m_apiHandler.get() );
1218 wxTheApp->Unbind( EDA_EVT_PLUGIN_AVAILABILITY_CHANGED, &SCH_EDIT_FRAME::onPluginAvailabilityChanged, this );
1219#endif
1220
1221 // Close modeless dialogs. They're trouble when they get destroyed after the frame.
1222 Unbind( EDA_EVT_CLOSE_DIALOG_BOOK_REPORTER, &SCH_EDIT_FRAME::onCloseSymbolDiffDialog, this );
1223 Unbind( EDA_EVT_CLOSE_ERC_DIALOG, &SCH_EDIT_FRAME::onCloseErcDialog, this );
1224 Unbind( EDA_EVT_CLOSE_DIALOG_SYMBOL_FIELDS_TABLE, &SCH_EDIT_FRAME::onCloseSymbolFieldsTableDialog, this );
1225 m_netNavigator->Unbind( wxEVT_TREE_SEL_CHANGING, &SCH_EDIT_FRAME::onNetNavigatorSelChanging, this );
1226 m_netNavigator->Unbind( wxEVT_TREE_SEL_CHANGED, &SCH_EDIT_FRAME::onNetNavigatorSelection, this );
1227
1228 if( m_diffSymbolDialog )
1229 {
1230 m_diffSymbolDialog->Destroy();
1231 m_diffSymbolDialog = nullptr;
1232 }
1233
1234 if( m_ercDialog )
1235 {
1236 m_ercDialog->Destroy();
1237 m_ercDialog = nullptr;
1238 }
1239
1241 {
1242 m_symbolFieldsTableDialog->Destroy();
1243 m_symbolFieldsTableDialog = nullptr;
1244 }
1245
1246 // Make sure local settings are persisted
1247 if( Prj().GetLocalSettings().ShouldAutoSave() )
1249
1250 delete m_toolManager;
1251 m_toolManager = nullptr;
1252
1253 wxAuiPaneInfo& hierarchy_pane = m_auimgr.GetPane( SchematicHierarchyPaneName() );
1254
1255 if( hierarchy_pane.IsShown() && hierarchy_pane.IsFloating() )
1256 {
1257 hierarchy_pane.Show( false );
1258 m_auimgr.Update();
1259 }
1260
1261 sheetlist.ClearModifyStatus();
1262
1263 wxString fileName = Prj().AbsolutePath( Schematic().RootScreen()->GetFileName() );
1264
1265 if( !Schematic().GetFileName().IsEmpty() && !Schematic().RootScreen()->IsEmpty() )
1266 UpdateFileHistory( fileName );
1267
1268 Schematic().RootScreen()->Clear( true );
1269
1270 // all sub sheets are deleted, only the main sheet is usable
1272
1273 // Clear view before destroying schematic as repaints depend on schematic being valid
1274 SetScreen( nullptr );
1275
1276 Schematic().Reset();
1277
1278 // Prevents any rogue events from continuing (i.e. search panel tries to redraw)
1279 Show( false );
1280
1281 Destroy();
1282}
1283
1284
1286{
1287 m_searchPane->FocusSearch();
1288}
1289
1290
1292{
1293 return Schematic().ErcSettings().GetSeverity( aErrorCode );
1294}
1295
1296
1298{
1300
1301 if( GetScreen() )
1302 {
1304 Kiway().LocalHistory().NoteFileChange( GetScreen()->GetFileName() );
1305 }
1306
1307 if( m_isClosing )
1308 return;
1309
1310 if( GetCanvas() )
1311 GetCanvas()->Refresh();
1312
1313 if( !GetTitle().StartsWith( wxS( "*" ) ) )
1314 updateTitle();
1315}
1316
1317
1319{
1320 if( Kiface().IsSingle() )
1321 {
1322 DisplayError( this, _( "Cannot update the PCB because the Schematic Editor is opened in stand-alone "
1323 "mode. In order to create/update PCBs from schematics, launch the main KiCad "
1324 "application and create a project." ) );
1325 return;
1326 }
1327
1328 KIWAY_PLAYER* frame = Kiway().Player( FRAME_PCB_EDITOR, false );
1329 wxEventBlocker blocker( this );
1330
1331 if( !frame )
1332 {
1333 wxFileName fn = Prj().GetProjectFullName();
1334 fn.SetExt( FILEEXT::PcbFileExtension );
1335
1336 frame = Kiway().Player( FRAME_PCB_EDITOR, true );
1337
1338 // If Kiway() cannot create the Pcbnew frame, it shows a error message, and
1339 // frame is null
1340 if( !frame )
1341 return;
1342
1343 frame->OpenProjectFiles( std::vector<wxString>( 1, fn.GetFullPath() ) );
1344 }
1345
1346 if( !frame->IsVisible() )
1347 frame->Show( true );
1348
1349 // On Windows, Raise() does not bring the window on screen, when iconized
1350 if( frame->IsIconized() )
1351 frame->Iconize( false );
1352
1353 frame->Raise();
1354
1355 std::string payload;
1357}
1358
1359
1360void SCH_EDIT_FRAME::UpdateHierarchyNavigator( bool aRefreshNetNavigator, bool aClear )
1361{
1362 m_toolManager->GetTool<SCH_NAVIGATE_TOOL>()->CleanHistory();
1363 m_hierarchy->UpdateHierarchyTree( aClear );
1364
1365 if( aRefreshNetNavigator )
1367}
1368
1369
1371{
1372 // Update only the hierarchy navigation tree labels.
1373 // The tree list is expected to be up to date
1374 m_hierarchy->UpdateLabelsHierarchyTree();
1375}
1376
1377
1379{
1380 m_hierarchy->UpdateHierarchySelection();
1381}
1382
1383
1384void SCH_EDIT_FRAME::OnLoadFile( wxCommandEvent& event )
1385{
1386 wxString filename = GetFileFromHistory( event.GetId(), _( "Schematic" ) );
1387
1388 if( !filename.IsEmpty() )
1389 OpenProjectFiles( std::vector<wxString>( 1, filename ) );
1390}
1391
1392
1393void SCH_EDIT_FRAME::OnClearFileHistory( wxCommandEvent& aEvent )
1394{
1396}
1397
1398
1400{
1401 // Only standalone mode can directly load a new document
1402 if( !Kiface().IsSingle() )
1403 return;
1404
1405 wxString pro_dir = m_mruPath;
1406
1407 wxFileDialog dlg( this, _( "New Schematic" ), pro_dir, wxEmptyString, FILEEXT::KiCadSchematicFileWildcard(),
1408 wxFD_SAVE );
1409
1411
1412 if( dlg.ShowModal() != wxID_CANCEL )
1413 {
1414 // Enforce the extension, wxFileDialog is inept.
1415 wxFileName create_me = EnsureFileExtension( dlg.GetPath(), FILEEXT::KiCadSchematicFileExtension );
1416
1417 if( create_me.FileExists() )
1418 {
1419 wxString msg;
1420 msg.Printf( _( "Schematic file '%s' already exists." ), create_me.GetFullName() );
1421 DisplayError( this, msg );
1422 return ;
1423 }
1424
1425 // OpenProjectFiles() requires absolute
1426 wxASSERT_MSG( create_me.IsAbsolute(), wxS( "wxFileDialog returned non-absolute path" ) );
1427
1428 OpenProjectFiles( std::vector<wxString>( 1, create_me.GetFullPath() ), KICTL_CREATE );
1429 m_mruPath = create_me.GetPath();
1430 }
1431}
1432
1433
1435{
1436 // Only standalone mode can directly load a new document
1437 if( !Kiface().IsSingle() )
1438 return;
1439
1440 wxString pro_dir = m_mruPath;
1441 wxString wildcards = FILEEXT::AllSchematicFilesWildcard()
1443 + wxS( "|" ) + FILEEXT::LegacySchematicFileWildcard();
1444
1445 wxFileDialog dlg( this, _( "Open Schematic" ), pro_dir, wxEmptyString, wildcards,
1446 wxFD_OPEN | wxFD_FILE_MUST_EXIST );
1447
1449
1450 if( dlg.ShowModal() != wxID_CANCEL )
1451 {
1452 OpenProjectFiles( std::vector<wxString>( 1, dlg.GetPath() ) );
1454 }
1455
1456 // Since we know we're single-top here: trigger library reload
1457 CallAfter(
1458 [&]()
1459 {
1460 KIFACE *schface = Kiway().KiFACE( KIWAY::FACE_SCH );
1461 schface->PreloadLibraries( &Kiway() );
1462
1464 } );
1465}
1466
1467
1469{
1471
1472 // Register schematic saver for autosave history
1474 [this]( const wxString& aProjectPath, std::vector<wxString>& aFiles )
1475 {
1476 m_schematic->SaveToHistory( aProjectPath, aFiles );
1477 } );
1478
1479 m_designBlocksPane->ProjectChanged();
1480}
1481
1482
1484{
1485 wxFileName kicad_board = Prj().AbsolutePath( Schematic().GetFileName() );
1486
1487 if( kicad_board.IsOk() && !Schematic().GetFileName().IsEmpty() )
1488 {
1489 kicad_board.SetExt( FILEEXT::PcbFileExtension );
1490 wxFileName legacy_board( kicad_board );
1491 legacy_board.SetExt( FILEEXT::LegacyPcbFileExtension );
1492 wxFileName& boardfn = legacy_board;
1493
1494 if( !legacy_board.FileExists() || kicad_board.FileExists() )
1495 boardfn = kicad_board;
1496
1497 if( Kiface().IsSingle() )
1498 {
1499 ExecuteFile( PCBNEW_EXE, boardfn.GetFullPath() );
1500 }
1501 else
1502 {
1503 wxEventBlocker blocker(this);
1504 KIWAY_PLAYER* frame = Kiway().Player( FRAME_PCB_EDITOR, false );
1505
1506 if( !frame )
1507 {
1508 frame = Kiway().Player( FRAME_PCB_EDITOR, true );
1509
1510 // frame can be null if Cvpcb cannot be run. No need to show a warning
1511 // Kiway() generates the error messages
1512 if( !frame )
1513 return;
1514
1515 frame->OpenProjectFiles( std::vector<wxString>( 1, boardfn.GetFullPath() ) );
1516 }
1517
1518 if( !frame->IsVisible() )
1519 frame->Show( true );
1520
1521 // On Windows, Raise() does not bring the window on screen, when iconized
1522 if( frame->IsIconized() )
1523 frame->Iconize( false );
1524
1525 frame->Raise();
1526 }
1527 }
1528 else
1529 {
1531 }
1532}
1533
1534
1536{
1537 wxFileName fn = Prj().AbsolutePath( Schematic().GetFileName() );
1538 fn.SetExt( FILEEXT::NetlistFileExtension );
1539
1540 if( !ReadyToNetlist( _( "Assigning footprints requires a fully annotated schematic." ) ) )
1541 return;
1542
1543 try
1544 {
1545 KIWAY_PLAYER* player = Kiway().Player( FRAME_CVPCB, false ); // test open already.
1546
1547 if( !player )
1548 {
1549 player = Kiway().Player( FRAME_CVPCB, true );
1550
1551 // player can be null if Cvpcb cannot be run. No need to show a warning
1552 // Kiway() generates the error messages
1553 if( !player )
1554 return;
1555
1556 player->Show( true );
1557 }
1558
1559 // Ensure the netlist (mainly info about symbols) is up to date
1562
1563 player->Raise();
1564 }
1565 catch( const IO_ERROR& )
1566 {
1567 DisplayError( this, _( "Could not open CvPcb" ) );
1568 }
1569}
1570
1571
1572void SCH_EDIT_FRAME::OnExit( wxCommandEvent& event )
1573{
1574 if( event.GetId() == wxID_EXIT )
1575 Kiway().OnKiCadExit();
1576
1577 if( event.GetId() == wxID_CLOSE || Kiface().IsSingle() )
1578 Close( false );
1579}
1580
1581
1583{
1584 SCHEMATIC_SETTINGS& settings = m_schematic->Settings();
1585 SIM_LIB_MGR simLibMgr( &Prj() );
1586 NULL_REPORTER devnull;
1587 SCH_SHEET_PATH& sheetPath = GetCurrentSheet();
1588 wxString variant = m_schematic->GetCurrentVariant();
1589
1590 // Patch for bug early in V7.99 dev
1591 if( settings.m_OPO_VRange.EndsWith( 'A' ) )
1592 settings.m_OPO_VRange[ settings.m_OPO_VRange.Length() - 1 ] = 'V';
1593
1594 // Update items which may have ${OP} text variables
1595 //
1597 [&]( KIGFX::VIEW_ITEM* aItem ) -> int
1598 {
1599 int flags = 0;
1600
1601 auto invalidateTextVars =
1602 [&flags]( EDA_TEXT* text )
1603 {
1604 if( text->HasTextVars() )
1605 {
1606 text->ClearRenderCache();
1607 text->ClearBoundingBoxCache();
1609 }
1610 };
1611
1612 if( SCH_ITEM* item = dynamic_cast<SCH_ITEM*>( aItem ) )
1613 {
1614 item->RunOnChildren(
1615 [&invalidateTextVars]( SCH_ITEM* aChild )
1616 {
1617 if( EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( aChild ) )
1618 invalidateTextVars( text );
1619 },
1621 }
1622
1623 if( EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( aItem ) )
1624 invalidateTextVars( text );
1625
1626 return flags;
1627 } );
1628
1629 // Update OP overlay items
1630 //
1631 for( SCH_ITEM* item : GetScreen()->Items() )
1632 {
1633 if( sheetPath.GetExcludedFromSim( variant ) )
1634 continue;
1635
1636 if( item->Type() == SCH_LINE_T )
1637 {
1638 SCH_LINE* line = static_cast<SCH_LINE*>( item );
1639
1640 if( !line->GetOperatingPoint().IsEmpty() )
1641 GetCanvas()->GetView()->Update( line );
1642
1643 line->SetOperatingPoint( wxEmptyString );
1644
1645 // update value from netlist, below
1646 }
1647 else if( item->Type() == SCH_SYMBOL_T )
1648 {
1649 SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( item );
1650 wxString ref = symbol->GetRef( &sheetPath );
1651 std::vector<SCH_PIN*> pins = symbol->GetPins( &sheetPath );
1652
1653 // Power symbols and other symbols which have the reference starting with "#" are
1654 // not included in simulation
1655 if( ref.StartsWith( '#' ) || symbol->ResolveExcludedFromSim( &sheetPath, variant ) )
1656 continue;
1657
1658 for( SCH_PIN* pin : pins )
1659 {
1660 if( !pin->GetOperatingPoint().IsEmpty() )
1661 GetCanvas()->GetView()->Update( pin );
1662
1663 pin->SetOperatingPoint( wxEmptyString );
1664 }
1665
1666 if( pins.size() == 2 )
1667 {
1668 wxString op = m_schematic->GetOperatingPoint( ref, settings.m_OPO_IPrecision, settings.m_OPO_IRange );
1669
1670 if( !op.IsEmpty() && op != wxS( "--" ) && op != wxS( "?" ) )
1671 {
1672 pins[0]->SetOperatingPoint( op );
1673 GetCanvas()->GetView()->Update( symbol );
1674 }
1675 }
1676 else
1677 {
1678 std::vector<EMBEDDED_FILES*> embeddedFilesStack;
1679 embeddedFilesStack.push_back( m_schematic->GetEmbeddedFiles() );
1680
1681 if( EMBEDDED_FILES* symbolEmbeddedFiles = symbol->GetEmbeddedFiles() )
1682 {
1683 embeddedFilesStack.push_back( symbolEmbeddedFiles );
1684 symbol->GetLibSymbolRef()->AppendParentEmbeddedFiles( embeddedFilesStack );
1685 }
1686
1687 simLibMgr.SetFilesStack( std::move( embeddedFilesStack ) );
1688
1689 SIM_MODEL& model = simLibMgr.CreateModel( &sheetPath, *symbol, true, 0, variant, devnull ).model;
1690
1691 SPICE_ITEM spiceItem;
1692 spiceItem.refName = ref;
1693 ref = model.SpiceGenerator().ItemName( spiceItem );
1694
1695 for( const auto& modelPin : model.GetPins() )
1696 {
1697 SCH_PIN* symbolPin = symbol->GetPin( modelPin.get().symbolPinNumber );
1698 wxString signalName = ref + wxS( ":" ) + modelPin.get().modelPinName;
1699 wxString op = m_schematic->GetOperatingPoint( signalName, settings.m_OPO_IPrecision,
1700 settings.m_OPO_IRange );
1701
1702 if( symbolPin && !op.IsEmpty() && op != wxS( "--" ) && op != wxS( "?" ) )
1703 {
1704 symbolPin->SetOperatingPoint( op );
1705 GetCanvas()->GetView()->Update( symbol );
1706 }
1707 }
1708 }
1709 }
1710 }
1711
1712 for( const auto& [ key, subgraphList ] : m_schematic->m_connectionGraph->GetNetMap() )
1713 {
1714 wxString op = m_schematic->GetOperatingPoint( key.Name, settings.m_OPO_VPrecision, settings.m_OPO_VRange );
1715
1716 if( !op.IsEmpty() && op != wxS( "--" ) && op != wxS( "?" ) )
1717 {
1718 for( CONNECTION_SUBGRAPH* subgraph : subgraphList )
1719 {
1720 SCH_LINE* longestWire = nullptr;
1721 double length = 0.0;
1722
1723 if( subgraph->GetSheet().GetExcludedFromSim( variant ) )
1724 continue;
1725
1726 for( SCH_ITEM* item : subgraph->GetItems() )
1727 {
1728 if( item->Type() == SCH_LINE_T )
1729 {
1730 SCH_LINE* line = static_cast<SCH_LINE*>( item );
1731
1732 if( line->IsWire() && line->GetLength() > length )
1733 {
1734 longestWire = line;
1735 length = line->GetLength();
1736 }
1737 }
1738 }
1739
1740 if( longestWire )
1741 {
1742 longestWire->SetOperatingPoint( op );
1743 GetCanvas()->GetView()->Update( longestWire );
1744 }
1745 }
1746 }
1747 }
1748}
1749
1750
1752{
1753 if( aItem->Type() == SCH_GLOBAL_LABEL_T || aItem->Type() == SCH_HIER_LABEL_T )
1754 {
1755 SCH_LABEL_BASE* label = static_cast<SCH_LABEL_BASE*>( aItem );
1756
1757 if( label->AutoRotateOnPlacement() )
1758 {
1759 SPIN_STYLE spin = aScreen->GetLabelOrientationForPoint( label->GetPosition(), label->GetSpinStyle(),
1760 &GetCurrentSheet() );
1761
1762 if( spin != label->GetSpinStyle() )
1763 {
1764 label->SetSpinStyle( spin );
1765
1766 for( SCH_ITEM* item : aScreen->Items().OfType( SCH_GLOBAL_LABEL_T ) )
1767 {
1768 SCH_LABEL_BASE* otherLabel = static_cast<SCH_LABEL_BASE*>( item );
1769
1770 if( otherLabel != label && otherLabel->GetText() == label->GetText() )
1771 otherLabel->AutoplaceFields( aScreen, AUTOPLACE_AUTO );
1772 }
1773 }
1774 }
1775 }
1776}
1777
1778
1780{
1781 SCH_SCREEN* screen = GetScreen();
1782
1783 wxCHECK( screen, /* void */ );
1784
1785 wxString title;
1786
1787 if( !screen->GetFileName().IsEmpty() )
1788 {
1789 wxFileName fn( Prj().AbsolutePath( screen->GetFileName() ) );
1790 bool readOnly = false;
1791 bool unsaved = false;
1792
1793 if( fn.IsOk() && screen->FileExists() )
1794 readOnly = screen->IsReadOnly();
1795 else
1796 unsaved = true;
1797
1798 if( IsContentModified() )
1799 title = wxT( "*" );
1800
1801 title += fn.GetName();
1802
1803 wxString sheetPath = GetCurrentSheet().PathHumanReadable( false, true );
1804
1805 if( sheetPath != title )
1806 title += wxString::Format( wxT( " [%s]" ), sheetPath );
1807
1808 if( readOnly )
1809 title += wxS( " " ) + _( "[Read Only]" );
1810
1811 if( unsaved )
1812 title += wxS( " " ) + _( "[Unsaved]" );
1813 }
1814 else
1815 {
1816 title = _( "[no schematic loaded]" );
1817 }
1818
1819 title += wxT( " \u2014 " ) + _( "Schematic Editor" );
1820
1821 SetTitle( title );
1822}
1823
1824
1826{
1828
1829 if( GetScreen() )
1830 GetScreen()->m_zoomInitialized = true;
1831}
1832
1833
1835 PROGRESS_REPORTER* aProgressReporter )
1836{
1837 wxString highlightedConn = GetHighlightedConnection();
1838 bool hasHighlightedConn = !highlightedConn.IsEmpty();
1839
1840 std::function<void( SCH_ITEM* )> changeHandler =
1841 [&]( SCH_ITEM* aChangedItem ) -> void
1842 {
1843 GetCanvas()->GetView()->Update( aChangedItem, KIGFX::REPAINT );
1844
1845 SCH_CONNECTION* connection = aChangedItem->Connection();
1846
1848 return;
1849
1850 if( !hasHighlightedConn )
1851 {
1852 // No highlighted connection, but connectivity has changed, so refresh
1853 // the list of all nets
1855 }
1856 else if( connection && ( connection->Name() == highlightedConn
1857 || connection->HasDriverChanged() ) )
1858 {
1860 }
1861 };
1862
1863 Schematic().RecalculateConnections( aCommit, aCleanupFlags,
1865 aProgressReporter,
1866 GetCanvas()->GetView(),
1867 &changeHandler,
1868 m_undoList.m_CommandsList.empty() ? nullptr
1869 : m_undoList.m_CommandsList.back() );
1870
1872 [&]( KIGFX::VIEW_ITEM* aItem ) -> int
1873 {
1874 int flags = 0;
1875 SCH_ITEM* item = dynamic_cast<SCH_ITEM*>( aItem );
1876 SCH_CONNECTION* connection = item ? item->Connection() : nullptr;
1877
1878 auto invalidateTextVars =
1879 [&flags]( EDA_TEXT* text )
1880 {
1881 if( text->HasTextVars() )
1882 {
1883 text->ClearRenderCache();
1884 text->ClearBoundingBoxCache();
1886 }
1887 };
1888
1889 if( connection && connection->HasDriverChanged() )
1890 {
1891 connection->ClearDriverChanged();
1892 flags |= KIGFX::REPAINT;
1893 }
1894
1895 if( item )
1896 {
1897 item->RunOnChildren(
1898 [&invalidateTextVars]( SCH_ITEM* aChild )
1899 {
1900 if( EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( aChild ) )
1901 invalidateTextVars( text );
1902 },
1904
1905 if( flags & KIGFX::GEOMETRY )
1906 GetScreen()->Update( item, false ); // Refresh RTree
1907 }
1908
1909 if( EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( aItem ) )
1910 invalidateTextVars( text );
1911
1912 return flags;
1913 } );
1914
1916 || !Schematic().ConnectionGraph()->FindFirstSubgraphByName( highlightedConn ) )
1917 {
1921 }
1922}
1923
1924
1929
1930
1932{
1933 GetCanvas()->GetView()->Update( aItem );
1934}
1935
1936
1943
1944
1945std::unique_ptr<GRID_HELPER> SCH_EDIT_FRAME::MakeGridHelper()
1946{
1947 return std::make_unique<EE_GRID_HELPER>( m_toolManager );
1948}
1949
1950
1952{
1954
1955 SCHEMATIC_SETTINGS& settings = Schematic().Settings();
1956
1959
1961
1962 if( EESCHEMA_SETTINGS* cfg = GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" ) )
1963 {
1964 GetGalDisplayOptions().ReadWindowSettings( cfg->m_Window );
1965 GetRenderSettings()->SetDefaultFont( cfg->m_Appearance.default_font );
1966
1967 KIGFX::VIEW* view = GetCanvas()->GetView();
1968 view->SetLayerVisible( LAYER_ERC_ERR, cfg->m_Appearance.show_erc_errors );
1969 view->SetLayerVisible( LAYER_ERC_WARN, cfg->m_Appearance.show_erc_warnings );
1970 view->SetLayerVisible( LAYER_ERC_EXCLUSION, cfg->m_Appearance.show_erc_exclusions );
1971 view->SetLayerVisible( LAYER_OP_VOLTAGES, cfg->m_Appearance.show_op_voltages );
1972 view->SetLayerVisible( LAYER_OP_CURRENTS, cfg->m_Appearance.show_op_currents );
1973
1974 GetRenderSettings()->m_ShowPinAltIcons = cfg->m_Appearance.show_pin_alt_icons;
1975
1977
1978 settings.m_TemplateFieldNames.DeleteAllFieldNameTemplates( true /* global */ );
1979
1980 if( !cfg->m_Drawing.field_names.IsEmpty() )
1981 settings.m_TemplateFieldNames.AddTemplateFieldNames( cfg->m_Drawing.field_names );
1982 }
1983
1985
1986 for( SCH_ITEM* item : screen->Items() )
1987 {
1988 item->ClearCaches();
1989
1990 if( item->Type() == SCH_LINE_T )
1991 {
1992 SCH_LINE* line = static_cast<SCH_LINE*>( item );
1993
1994 if( line->IsWire() )
1995 UpdateHopOveredWires( line );
1996 }
1997 }
1998
1999 for( const auto& [ libItemName, libSymbol ] : screen->GetLibSymbols() )
2000 libSymbol->ClearCaches();
2001
2003
2005 Layout();
2006 SendSizeEvent();
2007}
2008
2009
2011{
2012 // Store the current zoom level into the current screen before calling
2013 // DisplayCurrentSheet() that set the zoom to GetScreen()->m_LastZoomLevel
2015
2016 // Rebuild the sheet view (draw area and any other items):
2018}
2019
2020
2022{
2023 // call my base class
2025
2026 // tooltips in toolbars
2028
2029 // For some obscure reason, the AUI manager hides the first modified pane.
2030 // So force show panes
2031 wxAuiPaneInfo& design_blocks_pane_info = m_auimgr.GetPane( m_designBlocksPane );
2032 bool panel_shown = design_blocks_pane_info.IsShown();
2033 design_blocks_pane_info.Caption( _( "Design Blocks" ) );
2034 design_blocks_pane_info.Show( panel_shown );
2035
2036 m_auimgr.GetPane( m_hierarchy ).Caption( _( "Schematic Hierarchy" ) );
2037 m_auimgr.GetPane( m_selectionFilterPanel ).Caption( _( "Selection Filter" ) );
2038 m_auimgr.GetPane( m_propertiesPanel ).Caption( _( "Properties" ) );
2039 m_auimgr.GetPane( m_designBlocksPane ).Caption( _( "Design Blocks" ) );
2040 m_auimgr.GetPane( RemoteSymbolPaneName() ).Caption( _( "Remote Symbols" ) );
2041 m_auimgr.Update();
2042 m_hierarchy->UpdateHierarchyTree();
2043
2044 // status bar
2046
2047 updateTitle();
2048
2049 // This ugly hack is to fix an option(left) toolbar update bug that seems to only affect
2050 // windows. See https://bugs.launchpad.net/kicad/+bug/1816492. For some reason, calling
2051 // wxWindow::Refresh() does not resolve the issue. Only a resize event seems to force the
2052 // toolbar to update correctly.
2053#if defined( __WXMSW__ )
2054 PostSizeEvent();
2055#endif
2056}
2057
2058
2060{
2061 if( !GetHighlightedConnection().IsEmpty() )
2062 {
2063 SetStatusText( wxString::Format( _( "Highlighted net: %s" ),
2065 }
2066 else
2067 {
2068 SetStatusText( wxT( "" ) );
2069 }
2070}
2071
2072
2074{
2075 if( m_toolManager )
2077
2078 SCH_BASE_FRAME::SetScreen( aScreen );
2079 GetCanvas()->DisplaySheet( static_cast<SCH_SCREEN*>( aScreen ) );
2080
2081 if( m_toolManager )
2083}
2084
2085
2086const BOX2I SCH_EDIT_FRAME::GetDocumentExtents( bool aIncludeAllVisible ) const
2087{
2088 BOX2I bBoxDoc;
2089
2090 if( !GetScreen() )
2091 return bBoxDoc;
2092
2093 if( aIncludeAllVisible )
2094 {
2095 // Get the whole page size and return that
2096 int sizeX = GetScreen()->GetPageSettings().GetWidthIU( schIUScale.IU_PER_MILS );
2097 int sizeY = GetScreen()->GetPageSettings().GetHeightIU( schIUScale.IU_PER_MILS );
2098 bBoxDoc = BOX2I( VECTOR2I( 0, 0 ), VECTOR2I( sizeX, sizeY ) );
2099 }
2100 else
2101 {
2102 // Get current drawing-sheet in a form we can compare to an EDA_ITEM
2104 EDA_ITEM* dsAsItem = static_cast<EDA_ITEM*>( ds );
2105
2106 // Calc the bounding box of all items on screen except the page border
2107 for( EDA_ITEM* item : GetScreen()->Items() )
2108 {
2109 if( item != dsAsItem ) // Ignore the drawing-sheet itself
2110 bBoxDoc.Merge( item->GetBoundingBox() );
2111 }
2112 }
2113
2114 return bBoxDoc;
2115}
2116
2117
2119{
2120 if( !Schematic().HasHierarchy() )
2121 return false;
2122
2123 return Schematic().Hierarchy().IsModified();
2124}
2125
2126
2128{
2129 EESCHEMA_SETTINGS* cfg = eeconfig();
2130 return cfg && cfg->m_Appearance.show_hidden_pins;
2131}
2132
2133
2134void SCH_EDIT_FRAME::FocusOnItem( EDA_ITEM* aItem, bool aAllowScroll )
2135{
2136 // nullptr will clear the current focus
2137 if( aItem != nullptr && !aItem->IsSCH_ITEM() )
2138 return;
2139
2140 static KIID lastBrightenedItemID( niluuid );
2141
2142 SCH_ITEM* lastItem = Schematic().ResolveItem( lastBrightenedItemID, nullptr, true );
2143
2144 if( lastItem && lastItem != aItem )
2145 {
2146 lastItem->ClearBrightened();
2147
2148 UpdateItem( lastItem );
2149 lastBrightenedItemID = niluuid;
2150 }
2151
2152 if( aItem )
2153 {
2154 if( !aItem->IsBrightened() )
2155 {
2156 aItem->SetBrightened();
2157
2158 UpdateItem( aItem );
2159 lastBrightenedItemID = aItem->m_Uuid;
2160 }
2161
2162 FocusOnLocation( aItem->GetFocusPosition(), aAllowScroll );
2163 }
2164}
2165
2166
2168{
2169 return Schematic().GetFileName();
2170}
2171
2172
2174{
2175 return m_toolManager->GetTool<SCH_SELECTION_TOOL>()->GetSelection();
2176}
2177
2178void SCH_EDIT_FRAME::onSize( wxSizeEvent& aEvent )
2179{
2180 if( IsShown() )
2181 {
2182 // We only need this until the frame is done resizing and the final client size is
2183 // established.
2184 Unbind( wxEVT_SIZE, &SCH_EDIT_FRAME::onSize, this );
2186 }
2187
2188 // Skip() is called in the base class.
2189 EDA_DRAW_FRAME::OnSize( aEvent );
2190}
2191
2192
2194 const KIID& aSchematicSymbolUUID )
2195{
2196 SCH_SHEET_PATH principalPath;
2197 SCH_SHEET_LIST sheets = Schematic().Hierarchy();
2198 SCH_ITEM* item = sheets.ResolveItem( aSchematicSymbolUUID, &principalPath, true );
2199 SCH_SYMBOL* principalSymbol = dynamic_cast<SCH_SYMBOL*>( item );
2200 SCH_COMMIT commit( m_toolManager );
2201
2202 if( !principalSymbol )
2203 return;
2204
2205 wxString principalRef;
2206
2207 if( principalSymbol->IsAnnotated( &principalPath ) )
2208 principalRef = principalSymbol->GetRef( &principalPath, false );
2209
2210 std::vector< std::pair<SCH_SYMBOL*, SCH_SHEET_PATH> > allUnits;
2211
2212 for( const SCH_SHEET_PATH& path : sheets )
2213 {
2214 for( SCH_ITEM* candidate : path.LastScreen()->Items().OfType( SCH_SYMBOL_T ) )
2215 {
2216 SCH_SYMBOL* candidateSymbol = static_cast<SCH_SYMBOL*>( candidate );
2217
2218 if( candidateSymbol == principalSymbol
2219 || ( candidateSymbol->IsAnnotated( &path )
2220 && candidateSymbol->GetRef( &path, false ) == principalRef ) )
2221 {
2222 allUnits.emplace_back( candidateSymbol, path );
2223 }
2224 }
2225 }
2226
2227 for( auto& [ unit, path ] : allUnits )
2228 {
2229 // This needs to be done before the LIB_SYMBOL is changed to prevent stale
2230 // library symbols in the schematic file.
2231 path.LastScreen()->Remove( unit );
2232
2233 if( !unit->IsNew() )
2234 commit.Modify( unit, path.LastScreen() );
2235
2236 unit->SetLibSymbol( aSymbol.Flatten().release() );
2237 unit->UpdateFields( &GetCurrentSheet(),
2238 true, /* update style */
2239 true, /* update ref */
2240 true, /* update other fields */
2241 false, /* reset ref */
2242 false /* reset other fields */ );
2243
2244 path.LastScreen()->Append( unit );
2245 GetCanvas()->GetView()->Update( unit );
2246 }
2247
2248 // Clear any orphaned alternate pins.
2249 for( SCH_PIN* pin : principalSymbol->GetPins() )
2250 {
2251 wxString altName = pin->GetAlt();
2252
2253 if( altName.IsEmpty() )
2254 continue;
2255
2256 if( pin->GetAlternates().count( altName ) == 0 )
2257 pin->SetAlt( wxEmptyString );
2258 }
2259
2260 if( !commit.Empty() )
2261 commit.Push( _( "Save Symbol to Schematic" ) );
2262}
2263
2264
2265void SCH_EDIT_FRAME::UpdateItem( EDA_ITEM* aItem, bool isAddOrDelete, bool aUpdateRtree )
2266{
2267 SCH_BASE_FRAME::UpdateItem( aItem, isAddOrDelete, aUpdateRtree );
2268
2269 if( SCH_ITEM* sch_item = dynamic_cast<SCH_ITEM*>( aItem ) )
2270 sch_item->ClearCaches();
2271}
2272
2273
2275{
2276 wxCHECK( m_toolManager, /* void */ );
2277
2281
2282 wxCHECK( screen, /* void */ );
2283
2285
2286 SCH_BASE_FRAME::SetScreen( screen );
2287
2288 SetSheetNumberAndCount(); // will also update CurrentScreen()'s sheet number info
2289
2291
2292 // update the references, units, and intersheet-refs
2294
2295 // dangling state can also have changed if different units with different pin locations are
2296 // used
2299
2300 SCH_SELECTION_TOOL* selectionTool = m_toolManager->GetTool<SCH_SELECTION_TOOL>();
2301
2302 wxCHECK( selectionTool, /* void */ );
2303
2304 auto visit =
2305 [&]( EDA_ITEM* item )
2306 {
2308 && !m_findReplaceData->findString.IsEmpty()
2309 && item->Matches( *m_findReplaceData, &GetCurrentSheet() ) )
2310 {
2311 item->SetForceVisible( true );
2312 selectionTool->BrightenItem( item );
2313 }
2314 else if( item->IsBrightened() )
2315 {
2316 item->SetForceVisible( false );
2317 selectionTool->UnbrightenItem( item );
2318 }
2319 };
2320
2321 for( SCH_ITEM* item : screen->Items() )
2322 {
2323 visit( item );
2324
2325 item->RunOnChildren(
2326 [&]( SCH_ITEM* aChild )
2327 {
2328 visit( aChild );
2329 },
2331 }
2332
2333 if( !screen->m_zoomInitialized )
2334 {
2336 }
2337 else
2338 {
2339 // Set zoom to last used in this screen
2340 GetCanvas()->GetView()->SetScale( GetScreen()->m_LastZoomLevel );
2341 GetCanvas()->GetView()->SetCenter( GetScreen()->m_ScrollCenter );
2342 }
2343
2344 updateTitle();
2345
2346 HardRedraw(); // Ensure all items are redrawn (especially the drawing-sheet items)
2347
2348 // Allow tools to re-add their VIEW_ITEMs after the last call to Clear in HardRedraw
2350
2351 SCH_EDITOR_CONTROL* editTool = m_toolManager->GetTool<SCH_EDITOR_CONTROL>();
2352
2353 wxCHECK( editTool, /* void */ );
2354
2356 editTool->UpdateNetHighlighting( dummy );
2357
2358 m_hierarchy->UpdateHierarchySelection();
2359
2360 m_schematic->OnSchSheetChanged();
2361}
2362
2363
2365{
2366 if( !m_diffSymbolDialog )
2367 {
2369 _( "Compare Symbol with Library" ) );
2370
2371 m_diffSymbolDialog->m_sdbSizerApply->SetLabel( _( "Update Symbol from Library..." ) );
2372 m_diffSymbolDialog->m_sdbSizerApply->PostSizeEventToParent();
2373 m_diffSymbolDialog->m_sdbSizerApply->Show();
2374 }
2375
2376 return m_diffSymbolDialog;
2377}
2378
2379
2380void SCH_EDIT_FRAME::onCloseSymbolDiffDialog( wxCommandEvent& aEvent )
2381{
2382 if( m_diffSymbolDialog && aEvent.GetString() == DIFF_SYMBOLS_DIALOG_NAME )
2383 {
2384 if( aEvent.GetId() == wxID_APPLY )
2385 {
2386 KIID symbolUUID = m_diffSymbolDialog->GetUserItemID();
2387
2388 CallAfter(
2389 [this, symbolUUID]()
2390 {
2391 EDA_ITEM* item = ResolveItem( symbolUUID );
2392
2393 if( SCH_SYMBOL* symbol = dynamic_cast<SCH_SYMBOL*>( item ) )
2394 {
2395 m_toolManager->RunAction<EDA_ITEM*>( ACTIONS::selectItem, symbol );
2396
2398 dlg.ShowQuasiModal();
2399 }
2400 } );
2401 }
2402
2403 m_diffSymbolDialog->Destroy();
2404 m_diffSymbolDialog = nullptr;
2405 }
2406}
2407
2408
2410{
2411 if( !m_ercDialog )
2412 m_ercDialog = new DIALOG_ERC( this );
2413
2414 return m_ercDialog;
2415}
2416
2417
2418void SCH_EDIT_FRAME::onCloseErcDialog( wxCommandEvent& aEvent )
2419{
2420 if( m_ercDialog )
2421 {
2422 m_ercDialog->Destroy();
2423 m_ercDialog = nullptr;
2424 }
2425}
2426
2427
2435
2436
2438{
2439 return m_netNavigator;
2440}
2441
2442
2444{
2446 {
2447 m_symbolFieldsTableDialog->Destroy();
2448 m_symbolFieldsTableDialog = nullptr;
2449 }
2450}
2451
2452
2453void SCH_EDIT_FRAME::AddSchematicChangeListener( wxEvtHandler* aListener )
2454{
2455 auto it = std::find( m_schematicChangeListeners.begin(), m_schematicChangeListeners.end(), aListener );
2456
2457 // Don't add duplicate listeners.
2458 if( it == m_schematicChangeListeners.end() )
2459 m_schematicChangeListeners.push_back( aListener );
2460}
2461
2462
2464{
2465 auto it = std::find( m_schematicChangeListeners.begin(), m_schematicChangeListeners.end(), aListener );
2466
2467 // Don't add duplicate listeners.
2468 if( it != m_schematicChangeListeners.end() )
2469 m_schematicChangeListeners.erase( it );
2470}
2471
2472
2474{
2475 wxPanel* panel = new wxPanel( this );
2476
2477 wxBoxSizer* sizer = new wxBoxSizer( wxVERTICAL );
2478
2479 // Create horizontal sizer for search control and gear button
2480 wxBoxSizer* searchSizer = new wxBoxSizer( wxHORIZONTAL );
2481
2482 m_netNavigatorFilter = new wxSearchCtrl( panel, wxID_ANY );
2483 m_netNavigatorFilter->SetDescriptiveText( _( "Filter nets" ) );
2484 m_netNavigatorFilter->ShowCancelButton( false );
2485 searchSizer->Add( m_netNavigatorFilter, 1, wxEXPAND | wxRIGHT, FromDIP( 2 ) );
2486
2487 m_netNavigatorMenuButton = new BITMAP_BUTTON( panel, wxID_ANY );
2489 m_netNavigatorMenuButton->SetPadding( 2 );
2490 searchSizer->Add( m_netNavigatorMenuButton, 0, wxALIGN_CENTER_VERTICAL );
2491
2492 sizer->Add( searchSizer, 0, wxEXPAND | wxALL, FromDIP( 2 ) );
2493
2494 m_netNavigator = new wxGenericTreeCtrl( panel, wxID_ANY, wxPoint( 0, 0 ), FromDIP( wxSize( 160, 250 ) ),
2495 wxTR_DEFAULT_STYLE | wxNO_BORDER );
2496 sizer->Add( m_netNavigator, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, FromDIP( 2 ) );
2497
2498 panel->SetSizer( sizer );
2499
2500 m_netNavigatorFilter->Bind( wxEVT_COMMAND_TEXT_UPDATED, &SCH_EDIT_FRAME::onNetNavigatorFilterChanged, this );
2501 m_netNavigatorFilter->Bind( wxEVT_KEY_DOWN, &SCH_EDIT_FRAME::onNetNavigatorKey, this );
2502 m_netNavigator->Bind( wxEVT_KEY_DOWN, &SCH_EDIT_FRAME::onNetNavigatorKey, this );
2503 m_netNavigator->Bind( wxEVT_TREE_ITEM_MENU, &SCH_EDIT_FRAME::onNetNavigatorItemMenu, this );
2504 m_netNavigator->Bind( wxEVT_CONTEXT_MENU, &SCH_EDIT_FRAME::onNetNavigatorContextMenu, this );
2505
2506 m_netNavigatorMenuButton->Bind( wxEVT_LEFT_DOWN,
2507 [this]( wxMouseEvent& event )
2508 {
2509 wxMenu menu;
2510 wxMenuItem* wildcardItem = menu.AppendRadioItem( ID_NET_NAVIGATOR_SEARCH_WILDCARD,
2511 _( "Wildcard Search" ) );
2512 wxMenuItem* regexItem = menu.AppendRadioItem( ID_NET_NAVIGATOR_SEARCH_REGEX,
2513 _( "Regex Search" ) );
2514
2515 EESCHEMA_SETTINGS* cfg = eeconfig();
2516
2518 wildcardItem->Check();
2519 else
2520 regexItem->Check();
2521
2522 PopupMenu( &menu );
2523 } );
2524
2530
2531 return panel;
2532}
2533
2534
2535void SCH_EDIT_FRAME::SetHighlightedConnection( const wxString& aConnection,
2536 const NET_NAVIGATOR_ITEM_DATA* aSelection )
2537{
2538 bool refreshNetNavigator = aConnection != m_highlightedConn;
2539
2540 m_highlightedConn = aConnection;
2541
2542 if( refreshNetNavigator )
2543 RefreshNetNavigator( aSelection );
2544}
2545
2546
2548{
2550
2551 if( m_netNavigator )
2552 {
2553 NET_NAVIGATOR_ITEM_DATA itemData;
2554 wxTreeItemId selection = m_netNavigator->GetSelection();
2555 bool refreshSelection = selection.IsOk() && selection != m_netNavigator->GetRootItem();
2556
2557 if( refreshSelection )
2558 {
2560 dynamic_cast<NET_NAVIGATOR_ITEM_DATA*>( m_netNavigator->GetItemData( selection ) );
2561
2562 wxCHECK( tmp, /* void */ );
2563 itemData = *tmp;
2564 }
2565
2566 m_netNavigator->DeleteAllItems();
2567 RefreshNetNavigator( refreshSelection ? &itemData : nullptr );
2568 }
2569}
2570
2571
2573{
2574 if( !m_netNavigator )
2575 return;
2576
2577 wxString newFilter = m_netNavigatorFilter ? m_netNavigatorFilter->GetValue() : wxString();
2578
2579 if( newFilter == m_netNavigatorFilterValue )
2580 return;
2581
2582 m_netNavigatorFilterValue = newFilter;
2583
2584 NET_NAVIGATOR_ITEM_DATA selectionData;
2585 NET_NAVIGATOR_ITEM_DATA* selectionPtr = nullptr;
2586
2587 wxTreeItemId selection = m_netNavigator->GetSelection();
2588
2589 if( selection.IsOk() )
2590 {
2591 if( NET_NAVIGATOR_ITEM_DATA* tmp =
2592 dynamic_cast<NET_NAVIGATOR_ITEM_DATA*>( m_netNavigator->GetItemData( selection ) ) )
2593 {
2594 selectionData = *tmp;
2595 selectionPtr = &selectionData;
2596 }
2597 }
2598
2599 RefreshNetNavigator( selectionPtr );
2600
2601 aEvent.Skip();
2602}
2603
2604
2605void SCH_EDIT_FRAME::onNetNavigatorKey( wxKeyEvent& aEvent )
2606{
2607 if( aEvent.GetKeyCode() == WXK_ESCAPE )
2608 {
2609 // Clear the search string and refresh
2611 m_netNavigatorFilter->SetValue( wxEmptyString );
2612
2613 m_netNavigatorFilterValue = wxEmptyString;
2614
2616
2617 // Don't skip the event - we handled it
2618 return;
2619 }
2620
2621 aEvent.Skip();
2622}
2623
2624
2625
2627{
2628 showNetNavigatorMenu( aEvent.GetItem() );
2629}
2630
2631
2632void SCH_EDIT_FRAME::onNetNavigatorContextMenu( wxContextMenuEvent& aEvent )
2633{
2634 if( !m_netNavigator )
2635 return;
2636
2637 wxPoint screenPos = aEvent.GetPosition();
2638
2639 if( screenPos == wxDefaultPosition )
2640 screenPos = wxGetMousePosition();
2641
2642 wxPoint clientPos = m_netNavigator->ScreenToClient( screenPos );
2643 int flags = 0;
2644 wxTreeItemId item = m_netNavigator->HitTest( clientPos, flags );
2645
2646 showNetNavigatorMenu( item );
2647}
2648
2649
2650void SCH_EDIT_FRAME::showNetNavigatorMenu( const wxTreeItemId& aItem )
2651{
2652 if( !m_netNavigator )
2653 return;
2654
2655 wxMenu menu;
2656
2657 menu.Append( ID_NET_NAVIGATOR_EXPAND_ALL, _( "Expand All" ) );
2658 menu.Append( ID_NET_NAVIGATOR_COLLAPSE_ALL, _( "Collapse All" ) );
2659
2660 wxMenuItem* findInInspector = new wxMenuItem( &menu, ID_NET_NAVIGATOR_FIND_IN_INSPECTOR,
2661 _( "Find in Net Inspector" ) );
2662 menu.Append( findInInspector );
2663
2664 wxString netName;
2665
2666 if( aItem.IsOk() )
2667 {
2668 wxTreeItemId netItem = aItem;
2669
2670 if( m_netNavigator->GetItemParent( netItem ) != m_netNavigator->GetRootItem() )
2671 {
2672 wxTreeItemId parent = m_netNavigator->GetItemParent( netItem );
2673
2674 while( parent.IsOk() && parent != m_netNavigator->GetRootItem() )
2675 {
2676 netItem = parent;
2677 parent = m_netNavigator->GetItemParent( netItem );
2678 }
2679
2680 if( parent == m_netNavigator->GetRootItem() )
2681 {
2682 if( wxStringClientData* data =
2683 dynamic_cast<wxStringClientData*>( m_netNavigator->GetItemData( netItem ) ) )
2684 {
2685 netName = data->GetData();
2686 }
2687 }
2688 }
2689 else if( m_netNavigator->GetItemParent( netItem ) == m_netNavigator->GetRootItem() )
2690 {
2691 if( wxStringClientData* data =
2692 dynamic_cast<wxStringClientData*>( m_netNavigator->GetItemData( netItem ) ) )
2693 {
2694 netName = data->GetData();
2695 }
2696 }
2697 else if( !m_highlightedConn.IsEmpty() && netItem == m_netNavigator->GetRootItem() )
2698 {
2699 netName = m_highlightedConn;
2700 }
2701 }
2702 else if( !m_highlightedConn.IsEmpty() && m_netNavigator->GetRootItem().IsOk() )
2703 {
2704 netName = m_highlightedConn;
2705 }
2706
2707 if( netName.IsEmpty() )
2708 {
2709 findInInspector->Enable( false );
2711 }
2712 else
2713 {
2714 m_netNavigatorMenuNetName = netName;
2715 }
2716
2717 PopupMenu( &menu );
2718}
2719
2720
2721void SCH_EDIT_FRAME::onNetNavigatorMenuCommand( wxCommandEvent& aEvent )
2722{
2723 if( !m_netNavigator )
2724 return;
2725
2726 switch( aEvent.GetId() )
2727 {
2729 m_netNavigator->ExpandAll();
2730 break;
2731
2733 m_netNavigator->CollapseAll();
2734
2735 if( m_netNavigator->GetRootItem().IsOk() )
2736 m_netNavigator->Expand( m_netNavigator->GetRootItem() );
2737 break;
2738
2740 if( !m_netNavigatorMenuNetName.IsEmpty() )
2742 break;
2743
2746 if( EESCHEMA_SETTINGS* cfg = eeconfig() )
2747 {
2748 cfg->m_AuiPanels.net_nav_search_mode_wildcard = ( aEvent.GetId() == ID_NET_NAVIGATOR_SEARCH_WILDCARD );
2749
2750 // Refresh the navigator with current filter
2752 }
2753
2754 break;
2755
2756 default:
2757 aEvent.Skip();
2758 return;
2759 }
2760
2762
2763 aEvent.Skip( false );
2764}
2765
2766
2768{
2769 wxAuiPaneInfo& hierarchyPane = m_auimgr.GetPane( SchematicHierarchyPaneName() );
2770 wxAuiPaneInfo& netNavigatorPane = m_auimgr.GetPane( NetNavigatorPaneName() );
2771 wxAuiPaneInfo& propertiesPane = m_auimgr.GetPane( PropertiesPaneName() );
2772 wxAuiPaneInfo& selectionFilterPane = m_auimgr.GetPane( wxS( "SelectionFilter" ) );
2773
2774 // Don't give the selection filter its own visibility controls; instead show it if
2775 // anything else is visible
2776 bool showFilter = ( hierarchyPane.IsShown() && hierarchyPane.IsDocked() )
2777 || ( netNavigatorPane.IsShown() && netNavigatorPane.IsDocked() )
2778 || ( propertiesPane.IsShown() && propertiesPane.IsDocked() );
2779
2780 selectionFilterPane.Show( showFilter );
2781}
2782
2783
2784#ifdef KICAD_IPC_API
2785void SCH_EDIT_FRAME::onPluginAvailabilityChanged( wxCommandEvent& aEvt )
2786{
2787 wxLogTrace( traceApi, "SCH frame: EDA_EVT_PLUGIN_AVAILABILITY_CHANGED" );
2789 aEvt.Skip();
2790}
2791#endif
2792
2793
2795{
2796 EESCHEMA_SETTINGS* cfg = eeconfig();
2797
2798 // Ensure m_show_search is up to date (the pane can be closed outside the menu)
2799 m_show_search = m_auimgr.GetPane( SearchPaneName() ).IsShown();
2800
2802
2803 wxAuiPaneInfo& searchPaneInfo = m_auimgr.GetPane( SearchPaneName() );
2804 searchPaneInfo.Show( m_show_search );
2805
2806 if( m_show_search )
2807 {
2808 searchPaneInfo.Direction( cfg->m_AuiPanels.search_panel_dock_direction );
2809
2810 if( cfg->m_AuiPanels.search_panel_dock_direction == wxAUI_DOCK_TOP
2811 || cfg->m_AuiPanels.search_panel_dock_direction == wxAUI_DOCK_BOTTOM )
2812 {
2813 SetAuiPaneSize( m_auimgr, searchPaneInfo, -1, cfg->m_AuiPanels.search_panel_height );
2814 }
2815 else if( cfg->m_AuiPanels.search_panel_dock_direction == wxAUI_DOCK_LEFT
2816 || cfg->m_AuiPanels.search_panel_dock_direction == wxAUI_DOCK_RIGHT )
2817 {
2818 SetAuiPaneSize( m_auimgr, searchPaneInfo, cfg->m_AuiPanels.search_panel_width, -1 );
2819 }
2820
2821 m_searchPane->FocusSearch();
2822 m_searchPane->RefreshSearch();
2823 }
2824 else
2825 {
2826 cfg->m_AuiPanels.search_panel_height = m_searchPane->GetSize().y;
2827 cfg->m_AuiPanels.search_panel_width = m_searchPane->GetSize().x;
2828 cfg->m_AuiPanels.search_panel_dock_direction = searchPaneInfo.dock_direction;
2829 m_auimgr.Update();
2830 }
2831}
2832
2833
2835{
2836 if( !m_propertiesPanel )
2837 return;
2838
2839 bool show = !m_propertiesPanel->IsShownOnScreen();
2840
2841 wxAuiPaneInfo& propertiesPaneInfo = m_auimgr.GetPane( PropertiesPaneName() );
2842 propertiesPaneInfo.Show( show );
2843
2845
2846 EESCHEMA_SETTINGS* settings = eeconfig();
2847
2848 if( show )
2849 {
2850 SetAuiPaneSize( m_auimgr, propertiesPaneInfo, settings->m_AuiPanels.properties_panel_width, -1 );
2851 }
2852 else
2853 {
2854 settings->m_AuiPanels.properties_panel_width = m_propertiesPanel->GetSize().x;
2855 m_auimgr.Update();
2856 }
2857}
2858
2859
2861{
2862 EESCHEMA_SETTINGS* cfg = eeconfig();
2863
2864 wxCHECK( cfg, /* void */ );
2865
2866 wxAuiPaneInfo& hierarchy_pane = m_auimgr.GetPane( SchematicHierarchyPaneName() );
2867
2868 hierarchy_pane.Show( !hierarchy_pane.IsShown() );
2869
2871
2872 if( hierarchy_pane.IsShown() )
2873 {
2874 if( hierarchy_pane.IsFloating() )
2875 {
2876 hierarchy_pane.FloatingSize( cfg->m_AuiPanels.hierarchy_panel_float_width,
2878 m_auimgr.Update();
2879 }
2880 else if( cfg->m_AuiPanels.hierarchy_panel_docked_width > 0 )
2881 {
2882 // SetAuiPaneSize also updates m_auimgr
2884 }
2885 }
2886 else
2887 {
2888 if( hierarchy_pane.IsFloating() )
2889 {
2890 cfg->m_AuiPanels.hierarchy_panel_float_width = hierarchy_pane.floating_size.x;
2891 cfg->m_AuiPanels.hierarchy_panel_float_height = hierarchy_pane.floating_size.y;
2892 }
2893 else
2894 {
2896 }
2897
2898 m_auimgr.Update();
2899 }
2900}
2901
2902
2904{
2905 EESCHEMA_SETTINGS* cfg = eeconfig();
2906
2907 wxCHECK( cfg, /* void */ );
2908
2909 wxAuiPaneInfo& db_library_pane = m_auimgr.GetPane( DesignBlocksPaneName() );
2910
2911 db_library_pane.Show( !db_library_pane.IsShown() );
2912
2913 if( db_library_pane.IsShown() )
2914 {
2915 if( db_library_pane.IsFloating() )
2916 {
2917 db_library_pane.FloatingSize( cfg->m_AuiPanels.design_blocks_panel_float_width,
2919 m_auimgr.Update();
2920 }
2922 {
2923 // SetAuiPaneSize also updates m_auimgr
2924 SetAuiPaneSize( m_auimgr, db_library_pane,
2926 }
2927 }
2928 else
2929 {
2930 if( db_library_pane.IsFloating() )
2931 {
2932 cfg->m_AuiPanels.design_blocks_panel_float_width = db_library_pane.floating_size.x;
2933 cfg->m_AuiPanels.design_blocks_panel_float_height = db_library_pane.floating_size.y;
2934 }
2935 else
2936 {
2938 }
2939
2940 m_auimgr.Update();
2941 }
2942}
2943
2944
2946{
2947 EESCHEMA_SETTINGS* cfg = eeconfig();
2948
2949 wxCHECK( cfg, /* void */ );
2950
2951 wxAuiPaneInfo& remotePane = m_auimgr.GetPane( RemoteSymbolPaneName() );
2952
2953 remotePane.Show( !remotePane.IsShown() );
2954
2955 if( remotePane.IsShown() )
2956 {
2957 if( remotePane.IsFloating() )
2958 {
2959 remotePane.FloatingSize( cfg->m_AuiPanels.remote_symbol_panel_float_width,
2961 m_auimgr.Update();
2962 }
2964 {
2965 SetAuiPaneSize( m_auimgr, remotePane,
2967 }
2968 }
2969 else
2970 {
2971 if( remotePane.IsFloating() )
2972 {
2973 cfg->m_AuiPanels.remote_symbol_panel_float_width = remotePane.floating_size.x;
2974 cfg->m_AuiPanels.remote_symbol_panel_float_height = remotePane.floating_size.y;
2975 }
2976 else if( m_remoteSymbolPane )
2977 {
2979 }
2980
2981 m_auimgr.Update();
2982 }
2983}
2984
2985
2987{
2988 wxCHECK( aSchematic, /* void */ );
2989
2990 if( m_schematic )
2991 m_schematic->SetProject( nullptr );
2992
2993 aSchematic->SetProject( &Prj() );
2994 delete m_schematic;
2995
2996 m_schematic = aSchematic;
2997 m_schematic->SetSchematicHolder( this );
2998
2999 KIGFX::SCH_VIEW* view = GetCanvas()->GetView();
3000 static_cast<KIGFX::SCH_PAINTER*>( view->GetPainter() )->SetSchematic( m_schematic );
3001 m_toolManager->SetEnvironment( m_schematic, GetCanvas()->GetView(), GetCanvas()->GetViewControls(), config(),
3002 this );
3003}
3004
3005
3007{
3009 return;
3010
3011 m_currentVariantCtrl->SetSelection( m_currentVariantCtrl->GetCount() - 1 );
3012
3013 wxCommandEvent dummy( wxEVT_CHOICE, ID_TOOLBAR_SCH_SELECT_VARAIANT );
3015}
3016
3017
3019{
3021 return;
3022
3023 wxArrayString choices = Schematic().GetVariantNamesForUI();
3024
3025 // Default variant cannot be removed.
3026 choices.RemoveAt( 0 );
3027
3028 // wxSingleChoiceDialog will ellipsize the title bar if the contents aren't wide enough. The set
3029 // of spaces in the control label are to prevent this.
3030 wxSingleChoiceDialog dlg( this, _( "Select variant name to remove:" ) + wxS( " " ),
3031 _( "Remove Design Variant" ), choices );
3032 dlg.Layout();
3033
3034 if( dlg.ShowModal() == wxID_CANCEL )
3035 return;
3036
3037 wxString variantName = dlg.GetStringSelection();
3038
3039 if( variantName.IsEmpty() )
3040 return;
3041
3042 SCH_COMMIT commit( this );
3043 Schematic().DeleteVariant( variantName, &commit );
3044
3045 if( !commit.Empty() )
3046 {
3047 commit.Push( wxString::Format( wxS( "Delete variant '%s'" ), variantName ) );
3048 OnModify();
3049 }
3050
3051 int selected = m_currentVariantCtrl->GetSelection();
3052 wxString tmp;
3053
3054 if( selected != wxNOT_FOUND )
3055 tmp = m_currentVariantCtrl->GetString( selected );
3056
3057 m_currentVariantCtrl->Set( Schematic().GetVariantNamesForUI() );
3058
3059 if( selected != wxNOT_FOUND )
3060 {
3061 if( tmp != variantName )
3062 {
3063 selected = m_currentVariantCtrl->FindString( tmp );
3064 m_currentVariantCtrl->SetSelection( selected );
3065 }
3066 else
3067 {
3068 m_currentVariantCtrl->SetSelection( 0 );
3069 SetCurrentVariant( wxEmptyString );
3070 }
3071 }
3072
3073 GetCanvas()->Refresh();
3074}
3075
3076
3078{
3079 // Delegate to base auto-save behavior (commits pending local history) for now.
3081}
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 OnSelectGrid(wxCommandEvent &event)
Command event handler for selecting grid sizes.
void setupUnits(APP_SETTINGS_BASE *aCfg)
virtual void SwitchCanvas(EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType)
Change the current rendering backend.
virtual void OnSize(wxSizeEvent &event) override
Recalculate the size of toolbars and display panel when the frame size changes.
virtual void OnSelectZoom(wxCommandEvent &event)
Set the zoom factor when selected by the zoom list box in the main tool bar.
GAL_DISPLAY_OPTIONS_IMPL & GetGalDisplayOptions()
Return a reference to the gal rendering options used by GAL for rendering.
virtual void resolveCanvasType()
Determine the canvas type to load (with prompt if required) and initializes m_canvasType.
static const wxString PropertiesPaneName()
EDA_MSG_PANEL * m_messagePanel
virtual void SetScreen(BASE_SCREEN *aScreen)
static const wxString RemoteSymbolPaneName()
virtual void UpdateMsgPanel()
Redraw the message panel.
void FocusOnLocation(const VECTOR2I &aPos, bool aAllowScroll=true)
Useful to focus on a particular location, in find functions.
virtual void ClearFocus()
SEARCH_PANE * m_searchPane
void unitsChangeRefresh() override
Called when when the units setting has changed to allow for any derived classes to handle refreshing ...
static const wxString DesignBlocksPaneName()
std::unique_ptr< EDA_SEARCH_DATA > m_findReplaceData
PROPERTIES_PANEL * m_propertiesPanel
bool m_showBorderAndTitleBlock
GAL_TYPE GetBackend() const
Return the type of backend currently used by GAL canvas.
void ForceRefresh()
Force a redraw.
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
void SetEventDispatcher(TOOL_DISPATCHER *aEventDispatcher)
Set a dispatcher that processes events and forwards them to tools.
A base class for most all the KiCad significant classes used in schematics and boards.
Definition eda_item.h: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:284
const KIID m_Uuid
Definition eda_item.h:521
KICAD_T Type() const
Returns the type of object.
Definition eda_item.h:110
void ClearBrightened()
Definition eda_item.h:143
void SetBrightened()
Definition eda_item.h:140
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:597
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:1582
wxString AsString() const
Definition kiid.cpp:368
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:294
void OnKiCadExit()
Definition kiway.cpp:761
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:301
LOCAL_HISTORY & LocalHistory()
Return the LOCAL_HISTORY associated with this KIWAY.
Definition kiway.h:406
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 UnregisterSaver(const void *aSaverObject)
Unregister a previously registered saver callback.
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:881
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:162
virtual const wxString GetProjectPath() const
Return the full path of the project.
Definition project.cpp:168
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:392
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:192
void Reset()
Initialize this schematic to a blank one, unloading anything existing.
void DeleteVariant(const wxString &aVariantName, SCH_COMMIT *aCommit=nullptr)
Delete all information for aVariantName.
void RecomputeIntersheetRefs()
Update the schematic's page reference map for all global labels, and refresh the labels so that they ...
wxString GetFileName() const
Helper to retrieve the filename from the root sheet screen.
SCHEMATIC_SETTINGS & Settings() const
SCH_ITEM * ResolveItem(const KIID &aID, SCH_SHEET_PATH *aPathOut=nullptr, bool aAllowNullptrReturn=false) const
Definition schematic.h:126
SCH_SHEET_LIST Hierarchy() const
Return the full schematic flattened hierarchical sheet list.
void SetProject(PROJECT *aPrj)
SCH_SCREEN * RootScreen() const
Helper to retrieve the screen of the root sheet.
wxArrayString GetVariantNamesForUI() const
Return an array of variant names for using in wxWidgets UI controls.
void SetSheetNumberAndCount()
Set the m_ScreenNumber and m_NumberOfScreens members for screens.
void RecalculateConnections(SCH_COMMIT *aCommit, SCH_CLEANUP_FLAGS aCleanupFlags, TOOL_MANAGER *aToolManager, PROGRESS_REPORTER *aProgressReporter=nullptr, KIGFX::SCH_VIEW *aSchView=nullptr, std::function< void(SCH_ITEM *)> *aChangedItemHandler=nullptr, PICKED_ITEMS_LIST *aLastChangeList=nullptr)
Generate the connection data for the entire schematic hierarchy.
ERC_SETTINGS & ErcSettings() const
Gather all the actions that are shared by tools.
Definition sch_actions.h:40
static TOOL_ACTION rotateCCW
static TOOL_ACTION placeClassLabel
Definition sch_actions.h:79
static TOOL_ACTION placeSheetPin
Definition sch_actions.h:85
static TOOL_ACTION saveSheetAsDesignBlock
static TOOL_ACTION mirrorV
static TOOL_ACTION drawSheetFromFile
Definition sch_actions.h:83
static TOOL_ACTION toggleOPCurrents
static TOOL_ACTION saveToLinkedDesignBlock
Definition sch_actions.h:71
static TOOL_ACTION saveSelectionAsDesignBlock
static TOOL_ACTION placeGlobalLabel
Definition sch_actions.h:80
static TOOL_ACTION drawTextBox
Definition sch_actions.h:93
static TOOL_ACTION toggleAnnotateAuto
static TOOL_ACTION ddAddImage
static TOOL_ACTION drawArc
Definition sch_actions.h:97
static TOOL_ACTION drawSheet
Definition sch_actions.h:82
static TOOL_ACTION toggleERCWarnings
static TOOL_ACTION toggleDirectiveLabels
static TOOL_ACTION highlightNetTool
static TOOL_ACTION leaveSheet
static TOOL_ACTION ddImportGraphics
static TOOL_ACTION toggleHiddenFields
static TOOL_ACTION drawRectangle
Definition sch_actions.h:95
static TOOL_ACTION drawLines
Definition sch_actions.h:99
static TOOL_ACTION placeHierLabel
Definition sch_actions.h:81
static TOOL_ACTION alignTop
static TOOL_ACTION alignRight
static TOOL_ACTION placeLabel
Definition sch_actions.h:78
static TOOL_ACTION drawCircle
Definition sch_actions.h:96
static TOOL_ACTION placeBusWireEntry
Definition sch_actions.h:77
static TOOL_ACTION showRemoteSymbolPanel
static TOOL_ACTION drawBezier
Definition sch_actions.h:98
static TOOL_ACTION drawWire
Definition sch_actions.h:72
static TOOL_ACTION remapSymbols
static TOOL_ACTION rotateCW
static TOOL_ACTION alignBottom
static TOOL_ACTION showHierarchy
static TOOL_ACTION showNetNavigator
static TOOL_ACTION placeJunction
Definition sch_actions.h:76
static TOOL_ACTION markSimExclusions
static TOOL_ACTION drawRuleArea
static TOOL_ACTION placeSymbol
Definition sch_actions.h:66
static TOOL_ACTION placeImage
static TOOL_ACTION alignLeft
static TOOL_ACTION toggleERCErrors
static TOOL_ACTION alignCenterX
static TOOL_ACTION angleSnapModeChanged
static TOOL_ACTION placeLinkedDesignBlock
Definition sch_actions.h:70
static TOOL_ACTION drawSheetFromDesignBlock
Definition sch_actions.h:84
static TOOL_ACTION mirrorH
static TOOL_ACTION placeDesignBlock
Definition sch_actions.h:69
static TOOL_ACTION toggleOPVoltages
static TOOL_ACTION drawBus
Definition sch_actions.h:73
static TOOL_ACTION drawTable
Definition sch_actions.h:94
static TOOL_ACTION ddAppendFile
static TOOL_ACTION placeSchematicText
Definition sch_actions.h:92
static TOOL_ACTION showDesignBlockPanel
static TOOL_ACTION togglePinAltIcons
static TOOL_ACTION toggleERCExclusions
static TOOL_ACTION updateNetHighlighting
static TOOL_ACTION alignCenterY
static TOOL_ACTION placeNoConnect
Definition sch_actions.h:75
static TOOL_ACTION toggleHiddenPins
static TOOL_ACTION syncSheetPins
Definition sch_actions.h:89
static TOOL_ACTION placePower
Definition sch_actions.h:68
A shim class between EDA_DRAW_FRAME and several derived classes: SYMBOL_EDIT_FRAME,...
SCH_BASE_FRAME(KIWAY *aKiway, wxWindow *aParent, FRAME_T aWindowType, const wxString &aTitle, const wxPoint &aPosition, const wxSize &aSize, long aStyle, const wxString &aFrameName)
SCH_RENDER_SETTINGS * GetRenderSettings()
void doCloseWindow() override
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
DIALOG_SCH_FIND * m_findReplaceDialog
void CommonSettingsChanged(int aFlags) override
Notification event that some of the common (suite-wide) settings have changed.
EESCHEMA_SETTINGS * eeconfig() const
PANEL_SCH_SELECTION_FILTER * m_selectionFilterPanel
virtual void UpdateItem(EDA_ITEM *aItem, bool isAddOrDelete=false, bool aUpdateRtree=false)
Mark an item for refresh.
virtual void Push(const wxString &aMessage=wxT("A commit"), int aCommitFlags=0) override
Execute the changes.
Each graphical item can have a SCH_CONNECTION describing its logical connection (to a bus or net).
bool HasDriverChanged() const
wxString Name(bool aIgnoreSheet=false) const
Handle design block actions in the schematic editor.
Tool responsible for drawing/placing items (symbols, wires, buses, labels, etc.).
KIGFX::SCH_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
void DisplaySheet(SCH_SCREEN *aScreen)
Group generic conditions for PCB editor states.
int UpdateNetHighlighting(const TOOL_EVENT &aEvent)
Launch a tool to highlight nets.
Schematic editor (Eeschema) main window.
void DefaultExecFlags()
Reset the execution flags to defaults for external netlist and bom generators.
void OnCrossProbeFlashTimer(wxTimerEvent &aEvent)
void ToggleProperties() override
bool IsContentModified() const override
Get if the current schematic has been modified but not saved.
void RefreshOperatingPointDisplay()
Refresh the display of any operating points.
wxPageSetupDialogData m_pageSetupData
SELECTION & GetCurrentSelection() override
Get the current selection from the canvas area.
std::vector< std::unique_ptr< SCH_ITEM > > m_items_to_repeat
For the repeat-last-item cmd.
void FocusOnItem(EDA_ITEM *aItem, bool aAllowScroll=true) override
Focus on a particular canvas item.
void onResizeNetNavigator(wxSizeEvent &aEvent)
void updateSelectionFilterVisbility() override
Selection filter panel doesn't have a dedicated visibility control, so show it if any other AUI panel...
void onNetNavigatorSelChanging(wxTreeEvent &aEvent)
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag and update other data struc...
void showNetNavigatorMenu(const wxTreeItemId &aItem)
void ShowAllIntersheetRefs(bool aShow)
void SaveProjectLocalSettings() override
Save changes to the project settings to the project (.pro) file.
bool OpenProjectFiles(const std::vector< wxString > &aFileSet, int aCtl=0) override
Open a project or set of files given by aFileList.
void doCloseWindow() override
DIALOG_BOOK_REPORTER * m_diffSymbolDialog
void ToggleLibraryTree() override
void SetHighlightedConnection(const wxString &aConnection, const NET_NAVIGATOR_ITEM_DATA *aSelection=nullptr)
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
bool ReadyToNetlist(const wxString &aAnnotateMessage)
Check if we are ready to write a netlist file for the current schematic.
wxWindow * createHighlightedNetNavigator()
void onCloseErcDialog(wxCommandEvent &aEvent)
void UpdateHierarchySelection()
Update the hierarchy navigation tree selection (cross-probe from schematic to hierarchy pane).
bool m_syncingPcbToSchSelection
void SetScreen(BASE_SCREEN *aScreen) override
friend class SCH_EDITOR_CONTROL
bool doAutoSave() override
Save the schematic files that have been modified and not yet saved.
wxChoice * m_currentVariantCtrl
void SaveSymbolToSchematic(const LIB_SYMBOL &aSymbol, const KIID &aSchematicSymbolUUID)
Update a schematic symbol from a LIB_SYMBOL.
void SetCurrentVariant(const wxString &aVariantName)
void onSize(wxSizeEvent &aEvent)
void CommonSettingsChanged(int aFlags) override
Called after the preferences dialog is run.
void ShowChangedLanguage() override
Redraw the menus and what not in current language.
BITMAP_BUTTON * m_netNavigatorMenuButton
void onNetNavigatorKey(wxKeyEvent &aEvent)
void configureToolbars() override
std::vector< wxEvtHandler * > m_schematicChangeListeners
void HardRedraw() override
Rebuild the GAL and redraw the screen.
void OnClearFileHistory(wxCommandEvent &aEvent)
bool GetShowAllPins() const override
Allow edit frame to show/hide hidden pins.
PANEL_REMOTE_SYMBOL * m_remoteSymbolPane
SCHEMATIC * m_schematic
The currently loaded schematic.
void onNetNavigatorFilterChanged(wxCommandEvent &aEvent)
void onCloseSymbolFieldsTableDialog(wxCommandEvent &aEvent)
SCH_SHEET_PATH & GetCurrentSheet() const
void RecalculateConnections(SCH_COMMIT *aCommit, SCH_CLEANUP_FLAGS aCleanupFlags, PROGRESS_REPORTER *aProgressReporter=nullptr)
Generate the connection data for the entire schematic hierarchy.
wxString m_netNavigatorFilterValue
void ProjectChanged() override
Notification event that the project has changed.
void OnLoadFile(wxCommandEvent &event)
SCHEMATIC & Schematic() const
void updateTitle()
Set the main window title bar text.
void SetSchematic(SCHEMATIC *aSchematic)
void ToggleSearch()
Toggle the show/hide state of Search pane.
bool LoadProjectSettings()
Load the KiCad project file (*.pro) settings specific to Eeschema.
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
void RefreshNetNavigator(const NET_NAVIGATOR_ITEM_DATA *aSelection=nullptr)
wxSearchCtrl * m_netNavigatorFilter
wxString GetFullScreenDesc() const override
static const wxString SearchPaneName()
DIALOG_BOOK_REPORTER * GetSymbolDiffDialog()
bool canCloseWindow(wxCloseEvent &aCloseEvent) override
void onNetNavigatorContextMenu(wxContextMenuEvent &aEvent)
void RecomputeIntersheetRefs()
Update the schematic's page reference map for all global labels, and refresh the labels so that they ...
DIALOG_ERC * GetErcDialog()
void sendNetlistToCvpcb()
Send the KiCad netlist over to CVPCB.
SCH_DESIGN_BLOCK_PANE * m_designBlocksPane
void UpdateHierarchyNavigator(bool aRefreshNetNavigator=true, bool aClear=false)
Update the hierarchy navigation tree and history.
SCH_EDIT_FRAME(KIWAY *aKiway, wxWindow *aParent)
void ToggleSchematicHierarchy()
Toggle the show/hide state of the left side schematic navigation panel.
std::vector< KIID > m_crossProbeFlashItems
Items to flash.
void LoadDrawingSheet()
Load the drawing sheet file.
void onNetNavigatorMenuCommand(wxCommandEvent &aEvent)
void SetSheetNumberAndCount()
Set the m_ScreenNumber and m_NumberOfScreens members for screens.
std::vector< LIB_ID > m_designBlockHistoryList
void OnPageSettingsChange() override
Called when modifying the page settings.
void ClearRepeatItemsList()
Clear the list of items which are to be repeated with the insert key.
const BOX2I GetDocumentExtents(bool aIncludeAllVisible=true) const override
Return bounding box of document with option to not include some items.
wxGenericTreeCtrl * m_netNavigator
void CaptureHierarchyPaneSize()
void StartCrossProbeFlash(const std::vector< SCH_ITEM * > &aItems)
void initScreenZoom()
Initialize the zoom value of the current screen and mark the screen as zoom-initialized.
void UpdateLabelsHierarchyNavigator()
Update the hierarchy navigation tree labels.
void OnImportProject(wxCommandEvent &event)
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
void onVariantSelected(wxCommandEvent &aEvent)
const wxString & GetHighlightedConnection() const
DIALOG_ERC * m_ercDialog
void UpdateItem(EDA_ITEM *aItem, bool isAddOrDelete=false, bool aUpdateRtree=false) override
Mark an item for refresh.
void UpdateNetHighlightStatus()
wxString GetScreenDesc() const override
Return a human-readable description of the current screen.
void onNetNavigatorItemMenu(wxTreeEvent &aEvent)
void AddCopyForRepeatItem(const SCH_ITEM *aItem)
DIALOG_SYMBOL_FIELDS_TABLE * GetSymbolFieldsTableDialog()
void OnResizeHierarchyNavigator(wxSizeEvent &aEvent)
wxString GetCurrentFileName() const override
Get the full filename + path of the currently opened file in the frame.
wxString m_highlightedConn
The highlighted net or bus or empty string.
wxGenericTreeCtrl * GetNetNavigator()
static const wxString NetNavigatorPaneName()
void onCloseSymbolDiffDialog(wxCommandEvent &aEvent)
void IntersheetRefUpdate(SCH_GLOBALLABEL *aItem) override
Callback from schematic ref update.
void OnExit(wxCommandEvent &event)
void AutoRotateItem(SCH_SCREEN *aScreen, SCH_ITEM *aItem)
Automatically set the rotation of an item (if the item supports it).
wxTimer m_crossProbeFlashTimer
Timer to toggle selection visibility.
void AddSchematicChangeListener(wxEvtHandler *aListener)
Add aListener to post #EDA_EVT_SCHEMATIC_CHANGED command events to.
HIERARCHY_PANE * m_hierarchy
DIALOG_SYMBOL_FIELDS_TABLE * m_symbolFieldsTableDialog
std::unique_ptr< GRID_HELPER > MakeGridHelper() override
void UpdateHopOveredWires(SCH_ITEM *aItem)
SEVERITY GetSeverity(int aErrorCode) const override
void onNetNavigatorSelection(wxTreeEvent &aEvent)
void FindNetInInspector(const wxString &aNetName)
void SaveCopyForRepeatItem(const SCH_ITEM *aItem)
Clone aItem and owns that clone in this container.
Handle actions specific to the schematic editor.
A set of SCH_ITEMs (i.e., without duplicates).
Definition sch_group.h:52
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition sch_item.h: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:144
virtual void RunOnChildren(const std::function< void(SCH_ITEM *)> &aFunction, RECURSE_MODE aMode)
Definition sch_item.h:630
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:471
bool ResolveExcludedFromSim(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
Definition sch_item.cpp:282
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:991
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:747
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:140
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:496
double m_LastZoomLevel
last value for the zoom level, useful in Eeschema when changing the current displayed sheet to reuse ...
Definition sch_screen.h:674
EE_RTREE & Items()
Get the full RTree, usually for iterating.
Definition sch_screen.h:118
const wxString & GetFileName() const
Definition sch_screen.h:153
bool IsReadOnly() const
Definition sch_screen.h:156
void Update(SCH_ITEM *aItem, bool aUpdateLibSymbol=true)
Update aItem's bounding box in the tree.
bool m_zoomInitialized
Definition sch_screen.h:699
bool FileExists() const
Definition sch_screen.h:159
SPIN_STYLE GetLabelOrientationForPoint(const VECTOR2I &aPosition, SPIN_STYLE aDefaultOrientation, const SCH_SHEET_PATH *aSheet) const
int ClearSelection(const TOOL_EVENT &aEvent)
Select all visible items in sheet.
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
SCH_ITEM * ResolveItem(const KIID &aID, SCH_SHEET_PATH *aPathOut=nullptr, bool aAllowNullptrReturn=false) const
Fetch a SCH_ITEM by ID.
bool IsModified() const
Check the entire hierarchy for any modifications.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
KIID_PATH Path() const
Get the sheet path as an KIID_PATH.
void UpdateAllScreenReferences() const
Update all the symbol references for this sheet path.
SCH_SCREEN * LastScreen()
wxString PathHumanReadable(bool aUseShortRootName=true, bool aStripTrailingSeparator=false, bool aEscapeSheetNames=false) const
Return the sheet path in a human readable form made from the sheet names.
bool GetExcludedFromSim() const
SCH_SHEET * Last() const
Return a pointer to the last SCH_SHEET of the list.
void clear()
Forwarded method from std::vector.
size_t size() const
Forwarded method from std::vector.
wxString GetName() const
Definition sch_sheet.h:142
Schematic symbol object.
Definition sch_symbol.h:76
EMBEDDED_FILES * GetEmbeddedFiles() override
SCH_SYMBOLs don't currently support embedded files, but their LIB_SYMBOL counterparts do.
bool IsAnnotated(const SCH_SHEET_PATH *aSheet) const
Check if the symbol has a valid annotation (reference) for the given sheet path.
std::vector< const SCH_PIN * > GetPins(const SCH_SHEET_PATH *aSheet) const
Retrieve a list of the SCH_PINs for the given sheet path.
SCH_PIN * GetPin(const wxString &number) const
Find a symbol pin by number.
std::unique_ptr< LIB_SYMBOL > & GetLibSymbolRef()
Definition sch_symbol.h:184
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const override
VECTOR2I GetPosition() const override
Definition sch_text.h:147
static SELECTION_CONDITION HasType(KICAD_T aType)
Create a functor that tests if among the selected items there is at least one of a given type.
static bool NotEmpty(const SELECTION &aSelection)
Test if there are any items selected.
static SELECTION_CONDITION MoreThan(int aNumber)
Create a functor that tests if the number of selected items is greater than the value given as parame...
static bool Idle(const SELECTION &aSelection)
Test if there no items selected or being edited.
static bool ShowAlways(const SELECTION &aSelection)
The default condition function (always returns true).
void BrightenItem(EDA_ITEM *aItem)
int AddItemToSel(const TOOL_EVENT &aEvent)
void UnbrightenItem(EDA_ITEM *aItem)
bool UnloadProject(PROJECT *aProject, bool aSave=true)
Save, unload and unregister the given PROJECT.
SIM_MODEL & CreateModel(SIM_MODEL::TYPE aType, const std::vector< SCH_PIN * > &aPins, REPORTER &aReporter)
void SetFilesStack(std::vector< EMBEDDED_FILES * > aFilesStack)
Definition sim_lib_mgr.h:48
Symbol library viewer main window.
The symbol library editor main window.
Symbol library viewer main window.
void AddTemplateFieldNames(const wxString &aSerializedFieldNames)
Add a serialized list of template field names.
void DeleteAllFieldNameTemplates(bool aGlobal)
Delete the entire contents.
TOOL_MANAGER * m_toolManager
TOOL_DISPATCHER * m_toolDispatcher
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
ACTIONS * m_actions
@ REDRAW
Full drawing refresh.
Definition tool_base.h:83
@ MODEL_RELOAD
Model changes (the sheet for a schematic)
Definition tool_base.h:80
Generic, UI-independent tool event.
Definition tool_event.h:171
Master controller class:
bool RunAction(const std::string &aActionName, T aParam)
Run the specified action immediately, pausing the current action to run the new one.
wxString EnsureFileExtension(const wxString &aFilename, const wxString &aExtension)
It's annoying to throw up nag dialogs when the extension isn't right.
Definition common.cpp:629
bool HandleUnsavedChanges(wxWindow *aParent, const wxString &aMessage, const std::function< bool()> &aSaveFunction)
Display a dialog with Save, Cancel and Discard Changes buttons.
Definition confirm.cpp:131
int GetLastUnsavedChangesResponse()
Return the result code from the last call to HandleUnsavedChanges(): wxID_YES, wxID_NO or wxID_CANCEL...
Definition confirm.cpp:144
void DisplayError(wxWindow *aParent, const wxString &aText)
Display an error or warning message box with aMessage.
Definition confirm.cpp:177
This file is part of the common library.
#define CHECK(x)
#define ENABLE(x)
#define _(s)
wxDEFINE_EVENT(wxEVT_REFRESH_CUSTOM_COMMAND, wxEvent)
#define KICAD_DEFAULT_DRAWFRAME_STYLE
#define SCH_EDIT_FRAME_NAME
@ NO_RECURSE
Definition eda_item.h:52
#define IGNORE_PARENT_GROUP
Definition eda_item.h:55
@ ID_TOOLBAR_SCH_SELECT_VARAIANT
@ ID_IMPORT_NON_KICAD_SCH
Definition eeschema_id.h:62
const wxAuiPaneInfo & defaultSchSelectionFilterPaneInfo(wxWindow *aWindow)
const wxAuiPaneInfo & defaultPropertiesPaneInfo(wxWindow *aWindow)
const wxAuiPaneInfo & defaultNetNavigatorPaneInfo()
const wxAuiPaneInfo & defaultDesignBlocksPaneInfo(wxWindow *aWindow)
const wxAuiPaneInfo & defaultRemoteSymbolPaneInfo(wxWindow *aWindow)
EVT_MENU_RANGE(ID_GERBVIEW_DRILL_FILE1, ID_GERBVIEW_DRILL_FILEMAX, GERBVIEW_FRAME::OnDrlFileHistory) EVT_MENU_RANGE(ID_GERBVIEW_ZIP_FILE1
KiCad executable names.
const wxString PCBNEW_EXE
@ FRAME_PCB_EDITOR
Definition frame_type.h:42
@ FRAME_SCH_SYMBOL_EDITOR
Definition frame_type.h:35
@ FRAME_SCH_VIEWER
Definition frame_type.h:36
@ FRAME_SCH
Definition frame_type.h:34
@ FRAME_SIMULATOR
Definition frame_type.h:38
@ FRAME_CVPCB
Definition frame_type.h:52
@ FRAME_SYMBOL_CHOOSER
Definition frame_type.h:37
int ExecuteFile(const wxString &aEditorName, const wxString &aFileName, wxProcess *aCallback, bool aFileForKicad)
Call the executable file aEditorName with the parameter aFileName.
Definition gestfich.cpp:146
static const std::string NetlistFileExtension
static const std::string JpegFileExtension
static const std::string PngFileExtension
static const std::string LegacyPcbFileExtension
static const std::string KiCadSchematicFileExtension
static const std::string SVGFileExtension
static wxString LegacySchematicFileWildcard()
static wxString AllSchematicFilesWildcard()
static wxString KiCadSchematicFileWildcard()
const wxChar *const traceSchCurrentSheet
Flag to enable debug output of current sheet tracking in the schematic editor.
const wxChar *const traceCrossProbeFlash
Flag to enable debug output for cross-probe flash operations.
const wxChar *const traceApi
Flag to enable debug output related to the IPC API and its plugin system.
Definition api_utils.cpp:27
@ ID_ON_GRID_SELECT
Definition id.h:113
@ ID_FILE_LIST_CLEAR
Definition id.h:62
@ ID_EDA_SOCKET_EVENT
Definition id.h:133
@ ID_EDA_SOCKET_EVENT_SERV
Definition id.h:132
@ ID_ON_ZOOM_SELECT
Definition id.h:112
@ ID_FILEMAX
Definition id.h:60
@ ID_FILE1
Definition id.h:59
PROJECT & Prj()
Definition kicad.cpp:637
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
void AllowNetworkFileSystems(wxDialog *aDialog)
Configure a file dialog to show network and virtual file systems.
Definition wxgtk/ui.cpp:717
#define _HKI(x)
Definition page_info.cpp:44
PGM_BASE & Pgm()
The global program "get" accessor.
see class PGM_BASE
SEVERITY
#define DIFF_SYMBOLS_DIALOG_NAME
#define CURRENT_TOOL(action)
@ AUTOPLACE_AUTO
Definition sch_item.h: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.