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 <symbol_library.h>
31#include <confirm.h>
32#include <connection_graph.h>
33#include <dialogs/dialog_erc.h>
37#include <eeschema_id.h>
38#include <executable_names.h>
41#include <gestfich.h>
43#include <string_utils.h>
44#include <kiface_base.h>
45#include <kiplatform/app.h>
46#include <kiway.h>
47#include <symbol_edit_frame.h>
48#include <symbol_viewer_frame.h>
49#include <pgm_base.h>
50#include <core/profile.h>
53#include <python_scripting.h>
54#include <sch_edit_frame.h>
56#include <sch_painter.h>
57#include <sch_marker.h>
58#include <sch_sheet_pin.h>
59#include <sch_commit.h>
60#include <sch_rule_area.h>
62#include <advanced_config.h>
63#include <sim/simulator_frame.h>
64#include <tool/action_manager.h>
65#include <tool/action_toolbar.h>
66#include <tool/common_control.h>
67#include <tool/common_tools.h>
68#include <tool/embed_tool.h>
69#include <tool/picker_tool.h>
71#include <tool/selection.h>
73#include <tool/tool_manager.h>
74#include <tool/zoom_tool.h>
75#include <tools/sch_actions.h>
81#include <tools/sch_edit_tool.h>
87#include <tools/sch_move_tool.h>
90#include <unordered_set>
91#include <view/view_controls.h>
92#include <widgets/wx_infobar.h>
97#include <wx/cmdline.h>
98#include <wx/app.h>
99#include <wx/filedlg.h>
100#include <wx/socket.h>
101#include <wx/debug.h>
103#include <widgets/wx_aui_utils.h>
106#include <toolbars_sch_editor.h>
107
108#ifdef KICAD_IPC_API
110#include <api/api_utils.h>
111#endif
112
113
114#define DIFF_SYMBOLS_DIALOG_NAME wxT( "DiffSymbolsDialog" )
115
116
117BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, SCH_BASE_FRAME )
120
121 EVT_SIZE( SCH_EDIT_FRAME::OnSize )
122
125
127
128 EVT_MENU( wxID_EXIT, SCH_EDIT_FRAME::OnExit )
129 EVT_MENU( wxID_CLOSE, SCH_EDIT_FRAME::OnExit )
130
131 // Drop files event
132 EVT_DROP_FILES( SCH_EDIT_FRAME::OnDropFiles )
133END_EVENT_TABLE()
134
135
136wxDEFINE_EVENT( EDA_EVT_SCHEMATIC_CHANGING, wxCommandEvent );
137wxDEFINE_EVENT( EDA_EVT_SCHEMATIC_CHANGED, wxCommandEvent );
138
139
140SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
141 SCH_BASE_FRAME( aKiway, aParent, FRAME_SCH, wxT( "Eeschema" ), wxDefaultPosition,
143 m_ercDialog( nullptr ),
144 m_diffSymbolDialog( nullptr ),
145 m_symbolFieldsTableDialog( nullptr ),
146 m_netNavigator( nullptr ),
147 m_highlightedConnChanged( false ),
148 m_designBlocksPane( nullptr )
149{
150 m_maximizeByDefault = true;
151 m_schematic = new SCHEMATIC( nullptr );
152 m_schematic->SetSchematicHolder( this );
153
154 m_showBorderAndTitleBlock = true; // true to show sheet references
155 m_supportsAutoSave = true;
156 m_syncingPcbToSchSelection = false;
157 m_aboutTitle = _HKI( "KiCad Schematic Editor" );
158 m_show_search = false;
159
160 // Give an icon
161 wxIcon icon;
162 wxIconBundle icon_bundle;
163
164 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_eeschema, 48 ) );
165 icon_bundle.AddIcon( icon );
166 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_eeschema, 128 ) );
167 icon_bundle.AddIcon( icon );
168 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_eeschema, 256 ) );
169 icon_bundle.AddIcon( icon );
170 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_eeschema_32 ) );
171 icon_bundle.AddIcon( icon );
172 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_eeschema_16 ) );
173 icon_bundle.AddIcon( icon );
174
175 SetIcons( icon_bundle );
176
177 LoadSettings( eeconfig() );
178
179 // NB: also links the schematic to the loaded project
180 CreateScreens();
181
182 SCH_SHEET_PATH root;
183 root.push_back( &Schematic().Root() );
184 SetCurrentSheet( root );
185
186 setupTools();
187 setupUIConditions();
188 ReCreateMenuBar();
189
190 m_toolbarSettings = GetToolbarSettings<SCH_EDIT_TOOLBAR_SETTINGS>( "eeschema-toolbars" );
191 configureToolbars();
192 RecreateToolbars();
193
194#ifdef KICAD_IPC_API
195 wxTheApp->Bind( EDA_EVT_PLUGIN_AVAILABILITY_CHANGED, &SCH_EDIT_FRAME::onPluginAvailabilityChanged, this );
196#endif
197
198 m_hierarchy = new HIERARCHY_PANE( this );
199
200 // Initialize common print setup dialog settings.
201 m_pageSetupData.GetPrintData().SetPrintMode( wxPRINT_MODE_PRINTER );
202 m_pageSetupData.GetPrintData().SetQuality( wxPRINT_QUALITY_MEDIUM );
203 m_pageSetupData.GetPrintData().SetBin( wxPRINTBIN_AUTO );
204 m_pageSetupData.GetPrintData().SetNoCopies( 1 );
205
206 m_searchPane = new SCH_SEARCH_PANE( this );
207 m_propertiesPanel = new SCH_PROPERTIES_PANEL( this, this );
208
209 m_propertiesPanel->SetSplitterProportion( eeconfig()->m_AuiPanels.properties_splitter );
210
211 m_selectionFilterPanel = new PANEL_SCH_SELECTION_FILTER( this );
212 m_designBlocksPane = new SCH_DESIGN_BLOCK_PANE( this, nullptr, m_designBlockHistoryList );
213
214 m_auimgr.SetManagedWindow( this );
215
216 CreateInfoBar();
217
218 // Fetch a COPY of the config as a lot of these initializations are going to overwrite our
219 // data.
220 EESCHEMA_SETTINGS::AUI_PANELS aui_cfg = eeconfig()->m_AuiPanels;
221 EESCHEMA_SETTINGS::APPEARANCE appearance_cfg = eeconfig()->m_Appearance;
222
223 // Rows; layers 4 - 6
224 m_auimgr.AddPane( m_tbTopMain, EDA_PANE().HToolbar().Name( wxS( "TopMainToolbar" ) )
225 .Top().Layer( 6 ) );
226
227 m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( wxS( "MsgPanel" ) )
228 .Bottom().Layer( 6 ) );
229
230 // Columns; layers 1 - 3
231 m_auimgr.AddPane( m_hierarchy, EDA_PANE().Palette().Name( SchematicHierarchyPaneName() )
232 .Caption( _( "Schematic Hierarchy" ) )
233 .Left().Layer( 3 ).Position( 1 )
234 .TopDockable( false )
235 .BottomDockable( false )
236 .CloseButton( true )
237 .MinSize( FromDIP( wxSize( 120, 60 ) ) )
238 .BestSize( FromDIP( wxSize( 200, 200 ) ) )
239 .FloatingSize( FromDIP( wxSize( 200, 200 ) ) )
240 .FloatingPosition( FromDIP( wxPoint( 50, 50 ) ) )
241 .Show( false ) );
242
243 m_auimgr.AddPane( m_propertiesPanel, defaultPropertiesPaneInfo( this ) );
244 m_auimgr.AddPane( m_selectionFilterPanel, defaultSchSelectionFilterPaneInfo( this ) );
245
246 m_auimgr.AddPane( m_designBlocksPane, defaultDesignBlocksPaneInfo( this ) );
247
248 m_auimgr.AddPane( createHighlightedNetNavigator(), defaultNetNavigatorPaneInfo() );
249
250 m_auimgr.AddPane( m_tbLeft, EDA_PANE().VToolbar().Name( wxS( "LeftToolbar" ) )
251 .Left().Layer( 2 ) );
252
253 m_auimgr.AddPane( m_tbRight, EDA_PANE().VToolbar().Name( wxS( "RightToolbar" ) )
254 .Right().Layer( 2 ) );
255
256 // Center
257 m_auimgr.AddPane( GetCanvas(), EDA_PANE().Canvas().Name( wxS( "DrawFrame" ) )
258 .Center() );
259
260 m_auimgr.AddPane( m_searchPane, EDA_PANE()
261 .Name( SearchPaneName() )
262 .Bottom()
263 .Caption( _( "Search" ) )
264 .PaneBorder( false )
265 .MinSize( FromDIP( wxSize( 180, 60 ) ) )
266 .BestSize( FromDIP( wxSize( 180, 100 ) ) )
267 .FloatingSize( FromDIP( wxSize( 480, 200 ) ) )
268 .CloseButton( true )
269 .DestroyOnClose( false )
270 .Show( m_show_search ) );
271
272 FinishAUIInitialization();
273
274 wxAuiPaneInfo& hierarchy_pane = m_auimgr.GetPane( SchematicHierarchyPaneName() );
275 wxAuiPaneInfo& netNavigatorPane = m_auimgr.GetPane( NetNavigatorPaneName() );
276 wxAuiPaneInfo& propertiesPane = m_auimgr.GetPane( PropertiesPaneName() );
277 wxAuiPaneInfo& selectionFilterPane = m_auimgr.GetPane( wxS( "SelectionFilter" ) );
278 wxAuiPaneInfo& designBlocksPane = m_auimgr.GetPane( DesignBlocksPaneName() );
279
280 hierarchy_pane.Show( aui_cfg.show_schematic_hierarchy );
281 netNavigatorPane.Show( aui_cfg.show_net_nav_panel );
282 propertiesPane.Show( aui_cfg.show_properties );
283 designBlocksPane.Show( aui_cfg.design_blocks_show );
284 updateSelectionFilterVisbility();
285
286 // The selection filter doesn't need to grow in the vertical direction when docked
287 selectionFilterPane.dock_proportion = 0;
288
289 if( aui_cfg.hierarchy_panel_float_width > 0 && aui_cfg.hierarchy_panel_float_height > 0 )
290 {
291 // Show at end, after positioning
292 hierarchy_pane.FloatingSize( aui_cfg.hierarchy_panel_float_width,
294 }
295
296 if( aui_cfg.net_nav_panel_float_size.GetWidth() > 0
297 && aui_cfg.net_nav_panel_float_size.GetHeight() > 0 )
298 {
299 netNavigatorPane.FloatingSize( aui_cfg.net_nav_panel_float_size );
300 netNavigatorPane.FloatingPosition( aui_cfg.net_nav_panel_float_pos );
301 }
302
303 if( aui_cfg.properties_panel_width > 0 )
304 SetAuiPaneSize( m_auimgr, propertiesPane, aui_cfg.properties_panel_width, -1 );
305
306 if( aui_cfg.schematic_hierarchy_float )
307 hierarchy_pane.Float();
308
309 if( aui_cfg.search_panel_height > 0
310 && ( aui_cfg.search_panel_dock_direction == wxAUI_DOCK_TOP
311 || aui_cfg.search_panel_dock_direction == wxAUI_DOCK_BOTTOM ) )
312 {
313 wxAuiPaneInfo& searchPane = m_auimgr.GetPane( SearchPaneName() );
314 searchPane.Direction( aui_cfg.search_panel_dock_direction );
315 SetAuiPaneSize( m_auimgr, searchPane, -1, aui_cfg.search_panel_height );
316 }
317
318 else if( aui_cfg.search_panel_width > 0
319 && ( aui_cfg.search_panel_dock_direction == wxAUI_DOCK_LEFT
320 || aui_cfg.search_panel_dock_direction == wxAUI_DOCK_RIGHT ) )
321 {
322 wxAuiPaneInfo& searchPane = m_auimgr.GetPane( SearchPaneName() );
323 searchPane.Direction( aui_cfg.search_panel_dock_direction );
324 SetAuiPaneSize( m_auimgr, searchPane, aui_cfg.search_panel_width, -1 );
325 }
326
327 if( aui_cfg.float_net_nav_panel )
328 netNavigatorPane.Float();
329
330 if( aui_cfg.design_blocks_show )
331 SetAuiPaneSize( m_auimgr, designBlocksPane, aui_cfg.design_blocks_panel_docked_width, -1 );
332
333 if( aui_cfg.hierarchy_panel_docked_width > 0 )
334 {
335 // If the net navigator is not show, let the hierarchy navigator take all of the vertical
336 // space.
337 if( !aui_cfg.show_net_nav_panel )
338 {
339 SetAuiPaneSize( m_auimgr, hierarchy_pane, aui_cfg.hierarchy_panel_docked_width, -1 );
340 }
341 else
342 {
343 SetAuiPaneSize( m_auimgr, hierarchy_pane,
346
347 SetAuiPaneSize( m_auimgr, netNavigatorPane,
348 aui_cfg.net_nav_panel_docked_size.GetWidth(),
349 aui_cfg.net_nav_panel_docked_size.GetHeight() );
350 }
351
352 // wxAUI hack: force width by setting MinSize() and then Fixed()
353 // thanks to ZenJu https://github.com/wxWidgets/wxWidgets/issues/13180
354 hierarchy_pane.MinSize( aui_cfg.hierarchy_panel_docked_width, 60 );
355 hierarchy_pane.Fixed();
356 netNavigatorPane.MinSize( aui_cfg.net_nav_panel_docked_size.GetWidth(), 60 );
357 netNavigatorPane.Fixed();
358 m_auimgr.Update();
359
360 // now make it resizable again
361 hierarchy_pane.Resizable();
362 netNavigatorPane.Resizable();
363 m_auimgr.Update();
364
365 // Note: DO NOT call m_auimgr.Update() anywhere after this; it will nuke the size
366 // back to minimum.
367 hierarchy_pane.MinSize( FromDIP( wxSize( 120, 60 ) ) );
368 netNavigatorPane.MinSize( FromDIP( wxSize( 120, 60 ) ) );
369 }
370 else
371 {
372 m_auimgr.Update();
373 }
374
375 resolveCanvasType();
376 SwitchCanvas( m_canvasType );
377
378 GetCanvas()->GetGAL()->SetAxesEnabled( false );
379
380 KIGFX::SCH_VIEW* view = GetCanvas()->GetView();
381 static_cast<KIGFX::SCH_PAINTER*>( view->GetPainter() )->SetSchematic( m_schematic );
382
383 LoadProjectSettings();
384 LoadDrawingSheet();
385
386 view->SetLayerVisible( LAYER_ERC_ERR, appearance_cfg.show_erc_errors );
387 view->SetLayerVisible( LAYER_ERC_WARN, appearance_cfg.show_erc_warnings );
389 view->SetLayerVisible( LAYER_OP_VOLTAGES, appearance_cfg.show_op_voltages );
390 view->SetLayerVisible( LAYER_OP_CURRENTS, appearance_cfg.show_op_currents );
391
392 initScreenZoom();
393
394 m_hierarchy->Bind( wxEVT_SIZE, &SCH_EDIT_FRAME::OnResizeHierarchyNavigator, this );
395 m_netNavigator->Bind( wxEVT_TREE_SEL_CHANGING, &SCH_EDIT_FRAME::onNetNavigatorSelChanging, this );
396 m_netNavigator->Bind( wxEVT_TREE_SEL_CHANGED, &SCH_EDIT_FRAME::onNetNavigatorSelection, this );
397 m_netNavigator->Bind( wxEVT_SIZE, &SCH_EDIT_FRAME::onResizeNetNavigator, this );
398
399 // This is used temporarily to fix a client size issue on GTK that causes zoom to fit
400 // to calculate the wrong zoom size. See SCH_EDIT_FRAME::onSize().
401 Bind( wxEVT_SIZE, &SCH_EDIT_FRAME::onSize, this );
402
403 setupUnits( eeconfig() );
404
405 // Net list generator
406 DefaultExecFlags();
407
408 updateTitle();
409 m_toolManager->GetTool<SCH_NAVIGATE_TOOL>()->ResetHistory();
410
411#ifdef KICAD_IPC_API
412 m_apiHandler = std::make_unique<API_HANDLER_SCH>( this );
413 Pgm().GetApiServer().RegisterHandler( m_apiHandler.get() );
414#endif
415
416 // Default shutdown reason until a file is loaded
417 KIPLATFORM::APP::SetShutdownBlockReason( this, _( "New schematic file is unsaved" ) );
418
419 // Init for dropping files
421 DragAcceptFiles( true );
422
423 // Ensure the window is on top
424 Raise();
425
426 // Now that all sizes are fixed, set the initial hierarchy_pane floating position to the
427 // top-left corner of the canvas
428 wxPoint canvas_pos = GetCanvas()->GetScreenPosition();
429 hierarchy_pane.FloatingPosition( canvas_pos.x + 10, canvas_pos.y + 10 );
430
431 Bind( EDA_EVT_CLOSE_DIALOG_BOOK_REPORTER, &SCH_EDIT_FRAME::onCloseSymbolDiffDialog, this );
432 Bind( EDA_EVT_CLOSE_ERC_DIALOG, &SCH_EDIT_FRAME::onCloseErcDialog, this );
433 Bind( EDA_EVT_CLOSE_DIALOG_SYMBOL_FIELDS_TABLE, &SCH_EDIT_FRAME::onCloseSymbolFieldsTableDialog, this );
434}
435
436
438{
439 m_hierarchy->Unbind( wxEVT_SIZE, &SCH_EDIT_FRAME::OnResizeHierarchyNavigator, this );
440
441 // Ensure m_canvasType is up to date, to save it in config
443
444 SetScreen( nullptr );
445
446 if( m_schematic )
448
449 // Delete all items not in draw list before deleting schematic
450 // to avoid dangling pointers stored in these items
453
454 delete m_schematic;
455 m_schematic = nullptr;
456
457 // Close the project if we are standalone, so it gets cleaned up properly
458 if( Kiface().IsSingle() )
459 {
460 try
461 {
462 GetSettingsManager()->UnloadProject( &Prj(), false );
463 }
464 catch( const nlohmann::detail::type_error& e )
465 {
466 wxFAIL_MSG( wxString::Format( wxT( "Settings exception occurred: %s" ), e.what() ) );
467 }
468 }
469
470 // We passed ownership of these to wxAuiManager.
471 // delete m_hierarchy;
472 // delete m_selectionFilterPanel;
473}
474
475
477{
478 aEvent.Skip();
479
480 // 1st Call: Handle the size update during the first resize event.
482
483 // Defer the second size capture
484 CallAfter( [this]()
485 {
487 } );
488}
489
490
492{
493 // Called when resizing the Hierarchy Navigator panel
494 // Store the current pane size
495 // It allows to retrieve the last defined pane size when switching between
496 // docked and floating pane state
497 // Note: *DO NOT* call m_auimgr.Update() here: it crashes KiCad at least on Windows
498
499 EESCHEMA_SETTINGS* cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
500 wxAuiPaneInfo& hierarchy_pane = m_auimgr.GetPane( SchematicHierarchyPaneName() );
501
502 if( cfg && m_hierarchy->IsShownOnScreen() )
503 {
504 cfg->m_AuiPanels.hierarchy_panel_float_width = hierarchy_pane.floating_size.x;
505 cfg->m_AuiPanels.hierarchy_panel_float_height = hierarchy_pane.floating_size.y;
506
507 // initialize hierarchy_panel_docked_width and best size only if the hierarchy_pane
508 // width is > 0 (i.e. if its size is already set and has meaning)
509 // if it is floating, its size is not initialized (only floating_size is initialized)
510 // initializing hierarchy_pane.best_size is useful when switching to float pane and
511 // after switching to the docked pane, to retrieve the last docked pane width
512 if( hierarchy_pane.rect.width > 50 ) // 50 is a good margin
513 {
514 cfg->m_AuiPanels.hierarchy_panel_docked_width = hierarchy_pane.rect.width;
515 hierarchy_pane.best_size.x = hierarchy_pane.rect.width;
516 }
517 }
518}
519
520
522{
523 // Create the manager and dispatcher & route draw panel events to the dispatcher
526 GetCanvas()->GetViewControls(), config(), this );
527 m_actions = new SCH_ACTIONS();
529
530 // Register tools
551
552 // Run the selection tool, it is supposed to be always active
554
556}
557
558
560{
562
564 SCH_EDITOR_CONDITIONS cond( this );
565
566 wxASSERT( mgr );
567
568 auto hasElements =
569 [ this ] ( const SELECTION& aSel )
570 {
571 return GetScreen() &&
572 ( !GetScreen()->Items().empty() || !SELECTION_CONDITIONS::Idle( aSel ) );
573 };
574
575 auto searchPaneCond =
576 [this] ( const SELECTION& )
577 {
578 return m_auimgr.GetPane( SearchPaneName() ).IsShown();
579 };
580
581 auto propertiesCond =
582 [this] ( const SELECTION& )
583 {
584 return m_auimgr.GetPane( PropertiesPaneName() ).IsShown();
585 };
586
587 auto hierarchyNavigatorCond =
588 [ this ] ( const SELECTION& aSel )
589 {
590 return m_auimgr.GetPane( SchematicHierarchyPaneName() ).IsShown();
591 };
592
593 auto netNavigatorCond =
594 [ this ] (const SELECTION& aSel )
595 {
596 return m_auimgr.GetPane( NetNavigatorPaneName() ).IsShown();
597 };
598
599 auto designBlockCond =
600 [ this ] (const SELECTION& aSel )
601 {
602 return m_auimgr.GetPane( DesignBlocksPaneName() ).IsShown();
603 };
604
605 auto undoCond =
606 [ this ] (const SELECTION& aSel )
607 {
609 return true;
610
611 return GetUndoCommandCount() > 0;
612 };
613
614 auto groupWithDesignBlockLink =
615 [] ( const SELECTION& aSel )
616 {
617 if( aSel.Size() != 1 )
618 return false;
619
620 if( aSel[0]->Type() != SCH_GROUP_T )
621 return false;
622
623 SCH_GROUP* group = static_cast<SCH_GROUP*>( aSel.GetItem( 0 ) );
624
625 return group->HasDesignBlockLink();
626 };
627
628#define ENABLE( x ) ACTION_CONDITIONS().Enable( x )
629#define CHECK( x ) ACTION_CONDITIONS().Check( x )
630
632 mgr->SetConditions( ACTIONS::undo, ENABLE( undoCond ) );
634
635 mgr->SetConditions( SCH_ACTIONS::showSearch, CHECK( searchPaneCond ) );
636 mgr->SetConditions( SCH_ACTIONS::showHierarchy, CHECK( hierarchyNavigatorCond ) );
637 mgr->SetConditions( SCH_ACTIONS::showNetNavigator, CHECK( netNavigatorCond ) );
638 mgr->SetConditions( ACTIONS::showProperties, CHECK( propertiesCond ) );
639 mgr->SetConditions( SCH_ACTIONS::showDesignBlockPanel, CHECK( designBlockCond ) );
643 mgr->SetConditions( ACTIONS::millimetersUnits, CHECK( cond.Units( EDA_UNITS::MM ) ) );
644 mgr->SetConditions( ACTIONS::inchesUnits, CHECK( cond.Units( EDA_UNITS::INCH ) ) );
645 mgr->SetConditions( ACTIONS::milsUnits, CHECK( cond.Units( EDA_UNITS::MILS ) ) );
646
647 mgr->SetConditions( SCH_ACTIONS::lineModeFree, CHECK( cond.LineMode( LINE_MODE::LINE_MODE_FREE ) ) );
648 mgr->SetConditions( SCH_ACTIONS::lineMode90, CHECK( cond.LineMode( LINE_MODE::LINE_MODE_90 ) ) );
649 mgr->SetConditions( SCH_ACTIONS::lineMode45, CHECK( cond.LineMode( LINE_MODE::LINE_MODE_45 ) ) );
650
651 mgr->SetConditions( ACTIONS::cut, ENABLE( hasElements ) );
652 mgr->SetConditions( ACTIONS::copy, ENABLE( hasElements ) );
653 mgr->SetConditions( ACTIONS::copyAsText, ENABLE( hasElements ) );
656 mgr->SetConditions( ACTIONS::doDelete, ENABLE( hasElements ) );
657 mgr->SetConditions( ACTIONS::duplicate, ENABLE( hasElements ) );
658 mgr->SetConditions( ACTIONS::selectAll, ENABLE( hasElements ) );
659 mgr->SetConditions( ACTIONS::unselectAll, ENABLE( hasElements ) );
660
661 mgr->SetConditions( SCH_ACTIONS::rotateCW, ENABLE( hasElements ) );
662 mgr->SetConditions( SCH_ACTIONS::rotateCCW, ENABLE( hasElements ) );
663 mgr->SetConditions( SCH_ACTIONS::mirrorH, ENABLE( hasElements ) );
664 mgr->SetConditions( SCH_ACTIONS::mirrorV, ENABLE( hasElements ) );
667
668 mgr->SetConditions( SCH_ACTIONS::placeLinkedDesignBlock, ENABLE( groupWithDesignBlockLink ) );
669 mgr->SetConditions( SCH_ACTIONS::saveToLinkedDesignBlock, ENABLE( groupWithDesignBlockLink ) );
670
673
674 auto showHiddenPinsCond =
675 [this]( const SELECTION& )
676 {
677 return GetShowAllPins();
678 };
679
680 auto showHiddenFieldsCond =
681 [this]( const SELECTION& )
682 {
684 return cfg && cfg->m_Appearance.show_hidden_fields;
685 };
686
687 auto showDirectiveLabelsCond =
688 [this]( const SELECTION& )
689 {
691 return cfg && cfg->m_Appearance.show_directive_labels;
692 };
693
694 auto showERCErrorsCond =
695 [this]( const SELECTION& )
696 {
698 return cfg && cfg->m_Appearance.show_erc_errors;
699 };
700
701 auto showERCWarningsCond =
702 [this]( const SELECTION& )
703 {
705 return cfg && cfg->m_Appearance.show_erc_warnings;
706 };
707
708 auto showERCExclusionsCond =
709 [this]( const SELECTION& )
710 {
712 return cfg && cfg->m_Appearance.show_erc_exclusions;
713 };
714
715 auto markSimExclusionsCond =
716 [this]( const SELECTION& )
717 {
719 return cfg && cfg->m_Appearance.mark_sim_exclusions;
720 };
721
722 auto showOPVoltagesCond =
723 [this]( const SELECTION& )
724 {
726 return cfg && cfg->m_Appearance.show_op_voltages;
727 };
728
729 auto showOPCurrentsCond =
730 [this]( const SELECTION& )
731 {
733 return cfg && cfg->m_Appearance.show_op_currents;
734 };
735
736 auto showPinAltModeIconsCond =
737 [this]( const SELECTION& )
738 {
740 return cfg && cfg->m_Appearance.show_pin_alt_icons;
741 };
742
743 auto showAnnotateAutomaticallyCond =
744 [this]( const SELECTION& )
745 {
747 return cfg && cfg->m_AnnotatePanel.automatic;
748 };
749
750 auto remapSymbolsCondition =
751 [&]( const SELECTION& aSel )
752 {
753 SCH_SCREENS schematic( Schematic().Root() );
754
755 // The remapping can only be performed on legacy projects.
756 return schematic.HasNoFullyDefinedLibIds();
757 };
758
759 auto belowRootSheetCondition =
760 [this]( const SELECTION& aSel )
761 {
763 return navigateTool && navigateTool->CanGoUp();
764 };
765
766 mgr->SetConditions( SCH_ACTIONS::leaveSheet, ENABLE( belowRootSheetCondition ) );
767
768 /* Some of these are bound by default to arrow keys which will get a different action if we
769 * disable the buttons. So always leave them enabled so the action is consistent.
770 * https://gitlab.com/kicad/code/kicad/-/issues/14783
771 mgr->SetConditions( SCH_ACTIONS::navigateUp, ENABLE( belowRootSheetCondition ) );
772 mgr->SetConditions( SCH_ACTIONS::navigateForward, ENABLE( navHistoryHasForward ) );
773 mgr->SetConditions( SCH_ACTIONS::navigateBack, ENABLE( navHistoryHsBackward ) );
774 */
775
776 mgr->SetConditions( SCH_ACTIONS::remapSymbols, ENABLE( remapSymbolsCondition ) );
777 mgr->SetConditions( SCH_ACTIONS::toggleHiddenPins, CHECK( showHiddenPinsCond ) );
778 mgr->SetConditions( SCH_ACTIONS::toggleHiddenFields, CHECK( showHiddenFieldsCond ) );
779 mgr->SetConditions( SCH_ACTIONS::toggleDirectiveLabels, CHECK( showDirectiveLabelsCond ) );
780 mgr->SetConditions( SCH_ACTIONS::toggleERCErrors, CHECK( showERCErrorsCond ) );
781 mgr->SetConditions( SCH_ACTIONS::toggleERCWarnings, CHECK( showERCWarningsCond ) );
782 mgr->SetConditions( SCH_ACTIONS::toggleERCExclusions, CHECK( showERCExclusionsCond ) );
783 mgr->SetConditions( SCH_ACTIONS::markSimExclusions, CHECK( markSimExclusionsCond ) );
784 mgr->SetConditions( SCH_ACTIONS::toggleOPVoltages, CHECK( showOPVoltagesCond ) );
785 mgr->SetConditions( SCH_ACTIONS::toggleOPCurrents, CHECK( showOPCurrentsCond ) );
786 mgr->SetConditions( SCH_ACTIONS::togglePinAltIcons, CHECK( showPinAltModeIconsCond ) );
787 mgr->SetConditions( SCH_ACTIONS::toggleAnnotateAuto, CHECK( showAnnotateAutomaticallyCond ) );
789
792
793#define CURRENT_TOOL( action ) mgr->SetConditions( action, CHECK( cond.CurrentTool( action ) ) )
794
824
825#undef CURRENT_TOOL
826#undef CHECK
827#undef ENABLE
828}
829
830
832{
833 // we cannot store a pointer to an item in the display list here since
834 // that item may be deleted, such as part of a line concatenation or other.
835 // So simply always keep a copy of the object which is to be repeated.
836
837 if( aItem )
838 {
839 m_items_to_repeat.clear();
840
841 AddCopyForRepeatItem( aItem );
842 }
843}
844
845
847{
848 // we cannot store a pointer to an item in the display list here since
849 // that item may be deleted, such as part of a line concatenation or other.
850 // So simply always keep a copy of the object which is to be repeated.
851
852 if( aItem )
853 {
854 std::unique_ptr<SCH_ITEM> repeatItem( static_cast<SCH_ITEM*>( aItem->Duplicate( IGNORE_PARENT_GROUP ) ) );
855
856 // Clone() preserves the flags & parent, we want 'em cleared.
857 repeatItem->ClearFlags();
858 repeatItem->SetParent( nullptr );
859
860 m_items_to_repeat.emplace_back( std::move( repeatItem ) );
861 }
862}
863
864
865EDA_ITEM* SCH_EDIT_FRAME::ResolveItem( const KIID& aId, bool aAllowNullptrReturn ) const
866{
867 return Schematic().ResolveItem( aId, nullptr, aAllowNullptrReturn );
868}
869
870
872{
874}
875
876
878{
879 return GetCurrentSheet().LastScreen();
880}
881
882
884{
885 return *m_schematic;
886}
887
888
890{
891 return GetCurrentSheet().Last()->GetName();
892}
893
894
896{
898}
899
900
902{
905
906 SCH_SHEET* rootSheet = new SCH_SHEET( m_schematic );
907 m_schematic->SetRoot( rootSheet );
908
909 SCH_SCREEN* rootScreen = new SCH_SCREEN( m_schematic );
910 const_cast<KIID&>( rootSheet->m_Uuid ) = rootScreen->GetUuid();
911 m_schematic->Root().SetScreen( rootScreen );
912 SetScreen( Schematic().RootScreen() );
913
914
915 m_schematic->RootScreen()->SetFileName( wxEmptyString );
916
917 // Don't leave root page number empty
918 SCH_SHEET_PATH rootSheetPath;
919
920 rootSheetPath.push_back( rootSheet );
921 m_schematic->RootScreen()->SetPageNumber( wxT( "1" ) );
922 rootSheetPath.SetPageNumber( wxT( "1" ) );
923
924 // Rehash sheetpaths in hierarchy since we changed the uuid.
926
927 if( GetScreen() == nullptr )
928 {
929 SCH_SCREEN* screen = new SCH_SCREEN( m_schematic );
930 SetScreen( screen );
931 }
932}
933
934
936{
937 return m_schematic->CurrentSheet();
938}
939
940
942{
943 if( aSheet != GetCurrentSheet() )
944 {
945 ClearFocus();
946
947 Schematic().SetCurrentSheet( aSheet );
948 GetCanvas()->DisplaySheet( aSheet.LastScreen() );
949 }
950}
951
952
954{
956
957 for( SCH_ITEM* item : screen->Items() )
958 item->ClearCaches();
959
960 for( const std::pair<const wxString, LIB_SYMBOL*>& libSymbol : screen->GetLibSymbols() )
961 {
962 wxCHECK2( libSymbol.second, continue );
963 libSymbol.second->ClearCaches();
964 }
965
966 if( Schematic().Settings().m_IntersheetRefsShow )
968
969 ClearFocus();
970
971 GetCanvas()->DisplaySheet( GetCurrentSheet().LastScreen() );
972
974 selectionTool->Reset( TOOL_BASE::REDRAW );
975
977}
978
979
980bool SCH_EDIT_FRAME::canCloseWindow( wxCloseEvent& aEvent )
981{
982 // Exit interactive editing
983 // Note this this will commit *some* pending changes. For instance, the SCH_POINT_EDITOR
984 // will cancel any drag currently in progress, but commit all changes from previous drags.
985 if( m_toolManager )
987
988 // Shutdown blocks must be determined and vetoed as early as possible
989 if( KIPLATFORM::APP::SupportsShutdownBlockReason() && aEvent.GetId() == wxEVT_QUERY_END_SESSION
990 && IsContentModified() )
991 {
992 return false;
993 }
994
995 if( Kiface().IsSingle() )
996 {
997 auto* symbolEditor = (SYMBOL_EDIT_FRAME*) Kiway().Player( FRAME_SCH_SYMBOL_EDITOR, false );
998
999 if( symbolEditor && !symbolEditor->Close() ) // Can close symbol editor?
1000 return false;
1001
1002 auto* symbolViewer = (SYMBOL_VIEWER_FRAME*) Kiway().Player( FRAME_SCH_VIEWER, false );
1003
1004 if( symbolViewer && !symbolViewer->Close() ) // Can close symbol viewer?
1005 return false;
1006
1007 // SYMBOL_CHOOSER_FRAME is always modal so this shouldn't come up, but better safe than
1008 // sorry.
1009 auto* chooser = (SYMBOL_CHOOSER_FRAME*) Kiway().Player( FRAME_SYMBOL_CHOOSER, false );
1010
1011 if( chooser && !chooser->Close() ) // Can close symbol chooser?
1012 return false;
1013 }
1014 else
1015 {
1016 auto* symbolEditor = (SYMBOL_EDIT_FRAME*) Kiway().Player( FRAME_SCH_SYMBOL_EDITOR, false );
1017
1018 if( symbolEditor && symbolEditor->IsSymbolFromSchematic() )
1019 {
1020 if( !symbolEditor->CanCloseSymbolFromSchematic( true ) )
1021 return false;
1022 }
1023 }
1024
1025 if( !Kiway().PlayerClose( FRAME_SIMULATOR, false ) ) // Can close the simulator?
1026 return false;
1027
1029 && !m_symbolFieldsTableDialog->Close( false ) ) // Can close the symbol fields table?
1030 {
1031 return false;
1032 }
1033
1034 // We may have gotten multiple events; don't clean up twice
1035 if( !Schematic().IsValid() )
1036 return false;
1037
1038 if( IsContentModified() )
1039 {
1040 wxFileName fileName = Schematic().RootScreen()->GetFileName();
1041 wxString msg = _( "Save changes to '%s' before closing?" );
1042
1043 if( !HandleUnsavedChanges( this, wxString::Format( msg, fileName.GetFullName() ),
1044 [&]() -> bool
1045 {
1046 return SaveProject();
1047 } ) )
1048 {
1049 return false;
1050 }
1051 }
1052
1053 return true;
1054}
1055
1056
1058{
1060
1061 SCH_SHEET_LIST sheetlist = Schematic().Hierarchy();
1062
1063#ifdef KICAD_IPC_API
1064 Pgm().GetApiServer().DeregisterHandler( m_apiHandler.get() );
1065 wxTheApp->Unbind( EDA_EVT_PLUGIN_AVAILABILITY_CHANGED, &SCH_EDIT_FRAME::onPluginAvailabilityChanged, this );
1066#endif
1067
1068 // Close modeless dialogs. They're trouble when they get destroyed after the frame.
1069 Unbind( EDA_EVT_CLOSE_DIALOG_BOOK_REPORTER, &SCH_EDIT_FRAME::onCloseSymbolDiffDialog, this );
1070 Unbind( EDA_EVT_CLOSE_ERC_DIALOG, &SCH_EDIT_FRAME::onCloseErcDialog, this );
1071 Unbind( EDA_EVT_CLOSE_DIALOG_SYMBOL_FIELDS_TABLE, &SCH_EDIT_FRAME::onCloseSymbolFieldsTableDialog, this );
1072 m_netNavigator->Unbind( wxEVT_TREE_SEL_CHANGING, &SCH_EDIT_FRAME::onNetNavigatorSelChanging, this );
1073 m_netNavigator->Unbind( wxEVT_TREE_SEL_CHANGED, &SCH_EDIT_FRAME::onNetNavigatorSelection, this );
1074
1075 if( m_diffSymbolDialog )
1076 {
1077 m_diffSymbolDialog->Destroy();
1078 m_diffSymbolDialog = nullptr;
1079 }
1080
1081 if( m_ercDialog )
1082 {
1083 m_ercDialog->Destroy();
1084 m_ercDialog = nullptr;
1085 }
1086
1088 {
1089 m_symbolFieldsTableDialog->Destroy();
1090 m_symbolFieldsTableDialog = nullptr;
1091 }
1092
1093 // Make sure local settings are persisted
1094 if( Prj().GetLocalSettings().ShouldAutoSave() )
1096
1097 delete m_toolManager;
1098 m_toolManager = nullptr;
1099
1100 wxAuiPaneInfo& hierarchy_pane = m_auimgr.GetPane( SchematicHierarchyPaneName() );
1101
1102 if( hierarchy_pane.IsShown() && hierarchy_pane.IsFloating() )
1103 {
1104 hierarchy_pane.Show( false );
1105 m_auimgr.Update();
1106 }
1107
1108 SCH_SCREENS screens( Schematic().Root() );
1109 wxFileName fn;
1110
1111 for( SCH_SCREEN* screen = screens.GetFirst(); screen != nullptr; screen = screens.GetNext() )
1112 {
1113 fn = Prj().AbsolutePath( screen->GetFileName() );
1114
1115 // Auto save file name is the normal file name prepended with FILEEXT::AutoSaveFilePrefix.
1116 fn.SetName( FILEEXT::AutoSaveFilePrefix + fn.GetName() );
1117
1118 if( fn.IsFileWritable() )
1119 wxRemoveFile( fn.GetFullPath() );
1120 }
1121
1122 wxFileName tmpFn = Prj().GetProjectFullName();
1123 wxFileName autoSaveFileName( tmpFn.GetPath(), getAutoSaveFileName() );
1124
1125 if( autoSaveFileName.IsFileWritable() )
1126 wxRemoveFile( autoSaveFileName.GetFullPath() );
1127
1128 sheetlist.ClearModifyStatus();
1129
1130 wxString fileName = Prj().AbsolutePath( Schematic().RootScreen()->GetFileName() );
1131
1132 if( !Schematic().GetFileName().IsEmpty() && !Schematic().RootScreen()->IsEmpty() )
1133 UpdateFileHistory( fileName );
1134
1135 Schematic().RootScreen()->Clear( true );
1136
1137 // all sub sheets are deleted, only the main sheet is usable
1139
1140 // Clear view before destroying schematic as repaints depend on schematic being valid
1141 SetScreen( nullptr );
1142
1143 Schematic().Reset();
1144
1145 // Prevents any rogue events from continuing (i.e. search panel tries to redraw)
1146 Show( false );
1147
1148 Destroy();
1149}
1150
1151
1153{
1155}
1156
1157
1159{
1160 return Schematic().ErcSettings().GetSeverity( aErrorCode );
1161}
1162
1163
1165{
1167
1168 if( GetScreen() )
1170
1171 if( m_isClosing )
1172 return;
1173
1174 if( GetCanvas() )
1175 GetCanvas()->Refresh();
1176
1177 if( !GetTitle().StartsWith( wxS( "*" ) ) )
1178 updateTitle();
1179}
1180
1181
1183{
1184 if( Kiface().IsSingle() )
1185 {
1186 DisplayError( this, _( "Cannot update the PCB, because the Schematic Editor is opened"
1187 " in stand-alone mode. In order to create/update PCBs from"
1188 " schematics, launch the KiCad shell and create a project." ) );
1189 return;
1190 }
1191
1192 KIWAY_PLAYER* frame = Kiway().Player( FRAME_PCB_EDITOR, false );
1193 wxEventBlocker blocker( this );
1194
1195 if( !frame )
1196 {
1197 wxFileName fn = Prj().GetProjectFullName();
1198 fn.SetExt( FILEEXT::PcbFileExtension );
1199
1200 frame = Kiway().Player( FRAME_PCB_EDITOR, true );
1201
1202 // If Kiway() cannot create the Pcbnew frame, it shows a error message, and
1203 // frame is null
1204 if( !frame )
1205 return;
1206
1207 frame->OpenProjectFiles( std::vector<wxString>( 1, fn.GetFullPath() ) );
1208 }
1209
1210 if( !frame->IsVisible() )
1211 frame->Show( true );
1212
1213 // On Windows, Raise() does not bring the window on screen, when iconized
1214 if( frame->IsIconized() )
1215 frame->Iconize( false );
1216
1217 frame->Raise();
1218
1219 std::string payload;
1221}
1222
1223
1224void SCH_EDIT_FRAME::UpdateHierarchyNavigator( bool aRefreshNetNavigator, bool aClear )
1225{
1226 m_toolManager->GetTool<SCH_NAVIGATE_TOOL>()->CleanHistory();
1228
1229 if( aRefreshNetNavigator )
1231}
1232
1233
1235{
1236 // Update only the hierarchy navigation tree labels.
1237 // The tree list is expected to be up to date
1239}
1240
1241
1243{
1245}
1246
1247
1248void SCH_EDIT_FRAME::OnLoadFile( wxCommandEvent& event )
1249{
1250 wxString fn = GetFileFromHistory( event.GetId(), _( "Schematic" ) );
1251
1252 if( fn.size() )
1253 OpenProjectFiles( std::vector<wxString>( 1, fn ) );
1254}
1255
1256
1257void SCH_EDIT_FRAME::OnClearFileHistory( wxCommandEvent& aEvent )
1258{
1260}
1261
1262
1264{
1265 // Only standalone mode can directly load a new document
1266 if( !Kiface().IsSingle() )
1267 return;
1268
1269 wxString pro_dir = m_mruPath;
1270
1271 wxFileDialog dlg( this, _( "New Schematic" ), pro_dir, wxEmptyString,
1273
1274 if( dlg.ShowModal() != wxID_CANCEL )
1275 {
1276 // Enforce the extension, wxFileDialog is inept.
1277 wxFileName create_me =
1279
1280 if( create_me.FileExists() )
1281 {
1282 wxString msg;
1283 msg.Printf( _( "Schematic file '%s' already exists." ), create_me.GetFullName() );
1284 DisplayError( this, msg );
1285 return ;
1286 }
1287
1288 // OpenProjectFiles() requires absolute
1289 wxASSERT_MSG( create_me.IsAbsolute(), wxS( "wxFileDialog returned non-absolute path" ) );
1290
1291 OpenProjectFiles( std::vector<wxString>( 1, create_me.GetFullPath() ), KICTL_CREATE );
1292 m_mruPath = create_me.GetPath();
1293 }
1294}
1295
1296
1298{
1299 // Only standalone mode can directly load a new document
1300 if( !Kiface().IsSingle() )
1301 return;
1302
1303 wxString pro_dir = m_mruPath;
1304 wxString wildcards = FILEEXT::AllSchematicFilesWildcard()
1306 + wxS( "|" ) + FILEEXT::LegacySchematicFileWildcard();
1307
1308 wxFileDialog dlg( this, _( "Open Schematic" ), pro_dir, wxEmptyString,
1309 wildcards, wxFD_OPEN | wxFD_FILE_MUST_EXIST );
1310
1311 if( dlg.ShowModal() != wxID_CANCEL )
1312 {
1313 OpenProjectFiles( std::vector<wxString>( 1, dlg.GetPath() ) );
1315 }
1316}
1317
1318
1320{
1321 wxFileName kicad_board = Prj().AbsolutePath( Schematic().GetFileName() );
1322
1323 if( kicad_board.IsOk() && !Schematic().GetFileName().IsEmpty() )
1324 {
1325 kicad_board.SetExt( FILEEXT::PcbFileExtension );
1326 wxFileName legacy_board( kicad_board );
1327 legacy_board.SetExt( FILEEXT::LegacyPcbFileExtension );
1328 wxFileName& boardfn = legacy_board;
1329
1330 if( !legacy_board.FileExists() || kicad_board.FileExists() )
1331 boardfn = kicad_board;
1332
1333 if( Kiface().IsSingle() )
1334 {
1335 ExecuteFile( PCBNEW_EXE, boardfn.GetFullPath() );
1336 }
1337 else
1338 {
1339 wxEventBlocker blocker(this);
1340 KIWAY_PLAYER* frame = Kiway().Player( FRAME_PCB_EDITOR, false );
1341
1342 if( !frame )
1343 {
1344 frame = Kiway().Player( FRAME_PCB_EDITOR, true );
1345
1346 // frame can be null if Cvpcb cannot be run. No need to show a warning
1347 // Kiway() generates the error messages
1348 if( !frame )
1349 return;
1350
1351 frame->OpenProjectFiles( std::vector<wxString>( 1, boardfn.GetFullPath() ) );
1352 }
1353
1354 if( !frame->IsVisible() )
1355 frame->Show( true );
1356
1357 // On Windows, Raise() does not bring the window on screen, when iconized
1358 if( frame->IsIconized() )
1359 frame->Iconize( false );
1360
1361 frame->Raise();
1362 }
1363 }
1364 else
1365 {
1367 }
1368}
1369
1370
1372{
1373 wxFileName fn = Prj().AbsolutePath( Schematic().GetFileName() );
1374 fn.SetExt( FILEEXT::NetlistFileExtension );
1375
1376 if( !ReadyToNetlist( _( "Assigning footprints requires a fully annotated schematic." ) ) )
1377 return;
1378
1379 try
1380 {
1381 KIWAY_PLAYER* player = Kiway().Player( FRAME_CVPCB, false ); // test open already.
1382
1383 if( !player )
1384 {
1385 player = Kiway().Player( FRAME_CVPCB, true );
1386
1387 // player can be null if Cvpcb cannot be run. No need to show a warning
1388 // Kiway() generates the error messages
1389 if( !player )
1390 return;
1391
1392 player->Show( true );
1393 }
1394
1395 // Ensure the netlist (mainly info about symbols) is up to date
1398
1399 player->Raise();
1400 }
1401 catch( const IO_ERROR& )
1402 {
1403 DisplayError( this, _( "Could not open CvPcb" ) );
1404 }
1405}
1406
1407
1408void SCH_EDIT_FRAME::OnExit( wxCommandEvent& event )
1409{
1410 if( event.GetId() == wxID_EXIT )
1411 Kiway().OnKiCadExit();
1412
1413 if( event.GetId() == wxID_CLOSE || Kiface().IsSingle() )
1414 Close( false );
1415}
1416
1417
1419{
1421 SIM_LIB_MGR simLibMgr( &Prj() );
1422 NULL_REPORTER devnull;
1423
1424 // Patch for bug early in V7.99 dev
1425 if( settings.m_OPO_VRange.EndsWith( 'A' ) )
1426 settings.m_OPO_VRange[ settings.m_OPO_VRange.Length() - 1 ] = 'V';
1427
1428 // Update items which may have ${OP} text variables
1429 //
1431 [&]( KIGFX::VIEW_ITEM* aItem ) -> int
1432 {
1433 int flags = 0;
1434
1435 auto invalidateTextVars =
1436 [&flags]( EDA_TEXT* text )
1437 {
1438 if( text->HasTextVars() )
1439 {
1440 text->ClearRenderCache();
1441 text->ClearBoundingBoxCache();
1443 }
1444 };
1445
1446 if( SCH_ITEM* item = dynamic_cast<SCH_ITEM*>( aItem ) )
1447 {
1448 item->RunOnChildren(
1449 [&invalidateTextVars]( SCH_ITEM* aChild )
1450 {
1451 if( EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( aChild ) )
1452 invalidateTextVars( text );
1453 },
1454 RECURSE_MODE::NO_RECURSE );
1455 }
1456
1457 if( EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( aItem ) )
1458 invalidateTextVars( text );
1459
1460 return flags;
1461 } );
1462
1463 // Update OP overlay items
1464 //
1465 for( SCH_ITEM* item : GetScreen()->Items() )
1466 {
1468 continue;
1469
1470 if( item->Type() == SCH_LINE_T )
1471 {
1472 SCH_LINE* line = static_cast<SCH_LINE*>( item );
1473
1474 if( !line->GetOperatingPoint().IsEmpty() )
1475 GetCanvas()->GetView()->Update( line );
1476
1477 line->SetOperatingPoint( wxEmptyString );
1478
1479 // update value from netlist, below
1480 }
1481 else if( item->Type() == SCH_SYMBOL_T )
1482 {
1483 SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( item );
1484 wxString ref = symbol->GetRef( &GetCurrentSheet() );
1485 std::vector<SCH_PIN*> pins = symbol->GetPins( &GetCurrentSheet() );
1486
1487 // Power symbols and other symbols which have the reference starting with "#" are
1488 // not included in simulation
1489 if( ref.StartsWith( '#' ) || symbol->ResolveExcludedFromSim() )
1490 continue;
1491
1492 for( SCH_PIN* pin : pins )
1493 {
1494 if( !pin->GetOperatingPoint().IsEmpty() )
1495 GetCanvas()->GetView()->Update( pin );
1496
1497 pin->SetOperatingPoint( wxEmptyString );
1498 }
1499
1500 if( pins.size() == 2 )
1501 {
1502 wxString op = m_schematic->GetOperatingPoint( ref, settings.m_OPO_IPrecision,
1503 settings.m_OPO_IRange );
1504
1505 if( !op.IsEmpty() && op != wxS( "--" ) && op != wxS( "?" ) )
1506 {
1507 pins[0]->SetOperatingPoint( op );
1508 GetCanvas()->GetView()->Update( symbol );
1509 }
1510 }
1511 else
1512 {
1513 std::vector<EMBEDDED_FILES*> embeddedFilesStack;
1514 embeddedFilesStack.push_back( m_schematic->GetEmbeddedFiles() );
1515 embeddedFilesStack.push_back( symbol->GetEmbeddedFiles() );
1516
1517 simLibMgr.SetFilesStack( std::move( embeddedFilesStack ) );
1518
1519 SIM_MODEL& model = simLibMgr.CreateModel( &GetCurrentSheet(), *symbol, true, 0, devnull ).model;
1520
1521 SPICE_ITEM spiceItem;
1522 spiceItem.refName = ref;
1523 ref = model.SpiceGenerator().ItemName( spiceItem );
1524
1525 for( const auto& modelPin : model.GetPins() )
1526 {
1527 SCH_PIN* symbolPin = symbol->GetPin( modelPin.get().symbolPinNumber );
1528 wxString signalName = ref + wxS( ":" ) + modelPin.get().modelPinName;
1529 wxString op = m_schematic->GetOperatingPoint( signalName,
1530 settings.m_OPO_IPrecision,
1531 settings.m_OPO_IRange );
1532
1533 if( symbolPin && !op.IsEmpty() && op != wxS( "--" ) && op != wxS( "?" ) )
1534 {
1535 symbolPin->SetOperatingPoint( op );
1536 GetCanvas()->GetView()->Update( symbol );
1537 }
1538 }
1539 }
1540 }
1541 }
1542
1543 for( const auto& [ key, subgraphList ] : m_schematic->m_connectionGraph->GetNetMap() )
1544 {
1545 wxString op = m_schematic->GetOperatingPoint( key.Name, settings.m_OPO_VPrecision,
1546 settings.m_OPO_VRange );
1547
1548 if( !op.IsEmpty() && op != wxS( "--" ) && op != wxS( "?" ) )
1549 {
1550 for( CONNECTION_SUBGRAPH* subgraph : subgraphList )
1551 {
1552 SCH_LINE* longestWire = nullptr;
1553 double length = 0.0;
1554
1555 if( subgraph->GetSheet().GetExcludedFromSim() )
1556 continue;
1557
1558 for( SCH_ITEM* item : subgraph->GetItems() )
1559 {
1560 if( item->Type() == SCH_LINE_T )
1561 {
1562 SCH_LINE* line = static_cast<SCH_LINE*>( item );
1563
1564 if( line->IsWire() && line->GetLength() > length )
1565 {
1566 longestWire = line;
1567 length = line->GetLength();
1568 }
1569 }
1570 }
1571
1572 if( longestWire )
1573 {
1574 longestWire->SetOperatingPoint( op );
1575 GetCanvas()->GetView()->Update( longestWire );
1576 }
1577 }
1578 }
1579 }
1580}
1581
1582
1584{
1585 if( aItem->Type() == SCH_GLOBAL_LABEL_T || aItem->Type() == SCH_HIER_LABEL_T )
1586 {
1587 SCH_LABEL_BASE* label = static_cast<SCH_LABEL_BASE*>( aItem );
1588
1589 if( label->AutoRotateOnPlacement() )
1590 {
1591 SPIN_STYLE spin = aScreen->GetLabelOrientationForPoint( label->GetPosition(),
1592 label->GetSpinStyle(),
1593 &GetCurrentSheet() );
1594
1595 if( spin != label->GetSpinStyle() )
1596 {
1597 label->SetSpinStyle( spin );
1598
1599 for( SCH_ITEM* item : aScreen->Items().OfType( SCH_GLOBAL_LABEL_T ) )
1600 {
1601 SCH_LABEL_BASE* otherLabel = static_cast<SCH_LABEL_BASE*>( item );
1602
1603 if( otherLabel != label && otherLabel->GetText() == label->GetText() )
1604 otherLabel->AutoplaceFields( aScreen, AUTOPLACE_AUTO );
1605 }
1606 }
1607 }
1608 }
1609}
1610
1611
1613{
1614 SCH_SCREEN* screen = GetScreen();
1615
1616 wxCHECK( screen, /* void */ );
1617
1618 wxString title;
1619
1620 if( !screen->GetFileName().IsEmpty() )
1621 {
1622 wxFileName fn( Prj().AbsolutePath( screen->GetFileName() ) );
1623 bool readOnly = false;
1624 bool unsaved = false;
1625
1626 if( fn.IsOk() && screen->FileExists() )
1627 readOnly = screen->IsReadOnly();
1628 else
1629 unsaved = true;
1630
1631 if( IsContentModified() )
1632 title = wxT( "*" );
1633
1634 title += fn.GetName();
1635
1636 wxString sheetPath = GetCurrentSheet().PathHumanReadable( false, true );
1637
1638 if( sheetPath != title )
1639 title += wxString::Format( wxT( " [%s]" ), sheetPath );
1640
1641 if( readOnly )
1642 title += wxS( " " ) + _( "[Read Only]" );
1643
1644 if( unsaved )
1645 title += wxS( " " ) + _( "[Unsaved]" );
1646 }
1647 else
1648 {
1649 title = _( "[no schematic loaded]" );
1650 }
1651
1652 title += wxT( " \u2014 " ) + _( "Schematic Editor" );
1653
1654 SetTitle( title );
1655}
1656
1657
1659{
1661 GetScreen()->m_zoomInitialized = true;
1662}
1663
1664
1666 PROGRESS_REPORTER* aProgressReporter )
1667{
1668 wxString highlightedConn = GetHighlightedConnection();
1669 bool hasHighlightedConn = !highlightedConn.IsEmpty();
1670
1671 std::function<void( SCH_ITEM* )> changeHandler =
1672 [&]( SCH_ITEM* aChangedItem ) -> void
1673 {
1674 GetCanvas()->GetView()->Update( aChangedItem, KIGFX::REPAINT );
1675
1676 SCH_CONNECTION* connection = aChangedItem->Connection();
1677
1679 return;
1680
1681 if( !hasHighlightedConn )
1682 {
1683 // No highlighted connection, but connectivity has changed, so refresh
1684 // the list of all nets
1686 }
1687 else if( connection
1688 && ( connection->Name() == highlightedConn
1689 || connection->HasDriverChanged() ) )
1690 {
1692 }
1693 };
1694
1695 Schematic().RecalculateConnections( aCommit, aCleanupFlags,
1697 aProgressReporter,
1698 GetCanvas()->GetView(),
1699 &changeHandler,
1700 m_undoList.m_CommandsList.empty() ? nullptr
1701 : m_undoList.m_CommandsList.back() );
1702
1704 [&]( KIGFX::VIEW_ITEM* aItem ) -> int
1705 {
1706 int flags = 0;
1707 SCH_ITEM* item = dynamic_cast<SCH_ITEM*>( aItem );
1708 SCH_CONNECTION* connection = item ? item->Connection() : nullptr;
1709
1710 auto invalidateTextVars =
1711 [&flags]( EDA_TEXT* text )
1712 {
1713 if( text->HasTextVars() )
1714 {
1715 text->ClearRenderCache();
1716 text->ClearBoundingBoxCache();
1718 }
1719 };
1720
1721 if( connection && connection->HasDriverChanged() )
1722 {
1723 connection->ClearDriverChanged();
1724 flags |= KIGFX::REPAINT;
1725 }
1726
1727 if( item )
1728 {
1729 item->RunOnChildren(
1730 [&invalidateTextVars]( SCH_ITEM* aChild )
1731 {
1732 if( EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( aChild ) )
1733 invalidateTextVars( text );
1734 },
1735 RECURSE_MODE::NO_RECURSE );
1736
1737 if( flags & KIGFX::GEOMETRY )
1738 GetScreen()->Update( item, false ); // Refresh RTree
1739 }
1740
1741 if( EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( aItem ) )
1742 invalidateTextVars( text );
1743
1744 return flags;
1745 } );
1746
1748 || !Schematic().ConnectionGraph()->FindFirstSubgraphByName( highlightedConn ) )
1749 {
1753 }
1754}
1755
1756
1758{
1760}
1761
1762
1764{
1765 GetCanvas()->GetView()->Update( aItem );
1766}
1767
1768
1770{
1772
1774}
1775
1776
1777std::unique_ptr<GRID_HELPER> SCH_EDIT_FRAME::MakeGridHelper()
1778{
1779 return std::make_unique<EE_GRID_HELPER>( m_toolManager );
1780}
1781
1782
1784{
1786
1787 SCHEMATIC_SETTINGS& settings = Schematic().Settings();
1788
1791
1793
1794 if( EESCHEMA_SETTINGS* cfg = GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" ) )
1795 {
1796 GetGalDisplayOptions().ReadWindowSettings( cfg->m_Window );
1797 GetRenderSettings()->SetDefaultFont( cfg->m_Appearance.default_font );
1798
1799 KIGFX::VIEW* view = GetCanvas()->GetView();
1800 view->SetLayerVisible( LAYER_ERC_ERR, cfg->m_Appearance.show_erc_errors );
1801 view->SetLayerVisible( LAYER_ERC_WARN, cfg->m_Appearance.show_erc_warnings );
1802 view->SetLayerVisible( LAYER_ERC_EXCLUSION, cfg->m_Appearance.show_erc_exclusions );
1803 view->SetLayerVisible( LAYER_OP_VOLTAGES, cfg->m_Appearance.show_op_voltages );
1804 view->SetLayerVisible( LAYER_OP_CURRENTS, cfg->m_Appearance.show_op_currents );
1805
1806 GetRenderSettings()->m_ShowPinAltIcons = cfg->m_Appearance.show_pin_alt_icons;
1807
1809
1810 settings.m_TemplateFieldNames.DeleteAllFieldNameTemplates( true /* global */ );
1811
1812 if( !cfg->m_Drawing.field_names.IsEmpty() )
1813 settings.m_TemplateFieldNames.AddTemplateFieldNames( cfg->m_Drawing.field_names );
1814 }
1815
1817
1818 for( SCH_ITEM* item : screen->Items() )
1819 {
1820 item->ClearCaches();
1821
1822 if( item->Type() == SCH_LINE_T )
1823 {
1824 SCH_LINE* line = static_cast<SCH_LINE*>( item );
1825
1826 if( line->IsWire() )
1827 UpdateHopOveredWires( line );
1828 }
1829 }
1830
1831 for( const auto& [ libItemName, libSymbol ] : screen->GetLibSymbols() )
1832 libSymbol->ClearCaches();
1833
1835
1837 Layout();
1838 SendSizeEvent();
1839}
1840
1841
1843{
1844 // Store the current zoom level into the current screen before calling
1845 // DisplayCurrentSheet() that set the zoom to GetScreen()->m_LastZoomLevel
1847
1848 // Rebuild the sheet view (draw area and any other items):
1850}
1851
1852
1854{
1855 // call my base class
1857
1858 // tooltips in toolbars
1860
1861 // For some obscure reason, the AUI manager hides the first modified pane.
1862 // So force show panes
1863 wxAuiPaneInfo& design_blocks_pane_info = m_auimgr.GetPane( m_designBlocksPane );
1864 bool panel_shown = design_blocks_pane_info.IsShown();
1865 design_blocks_pane_info.Caption( _( "Design Blocks" ) );
1866 design_blocks_pane_info.Show( panel_shown );
1867
1868 m_auimgr.GetPane( m_hierarchy ).Caption( _( "Schematic Hierarchy" ) );
1869 m_auimgr.GetPane( m_selectionFilterPanel ).Caption( _( "Selection Filter" ) );
1870 m_auimgr.GetPane( m_propertiesPanel ).Caption( _( "Properties" ) );
1871 m_auimgr.GetPane( m_designBlocksPane ).Caption( _( "Design Blocks" ) );
1872 m_auimgr.Update();
1874
1875 // status bar
1877
1878 updateTitle();
1879
1880 // This ugly hack is to fix an option(left) toolbar update bug that seems to only affect
1881 // windows. See https://bugs.launchpad.net/kicad/+bug/1816492. For some reason, calling
1882 // wxWindow::Refresh() does not resolve the issue. Only a resize event seems to force the
1883 // toolbar to update correctly.
1884#if defined( __WXMSW__ )
1885 PostSizeEvent();
1886#endif
1887}
1888
1889
1891{
1892 if( !GetHighlightedConnection().IsEmpty() )
1893 {
1894 SetStatusText( wxString::Format( _( "Highlighted net: %s" ),
1896 }
1897 else
1898 {
1899 SetStatusText( wxT( "" ) );
1900 }
1901}
1902
1903
1905{
1906 if( m_toolManager )
1908
1909 SCH_BASE_FRAME::SetScreen( aScreen );
1910 GetCanvas()->DisplaySheet( static_cast<SCH_SCREEN*>( aScreen ) );
1911
1912 if( m_toolManager )
1914}
1915
1916
1917const BOX2I SCH_EDIT_FRAME::GetDocumentExtents( bool aIncludeAllVisible ) const
1918{
1919 BOX2I bBoxDoc;
1920
1921 if( aIncludeAllVisible )
1922 {
1923 // Get the whole page size and return that
1926 bBoxDoc = BOX2I( VECTOR2I( 0, 0 ), VECTOR2I( sizeX, sizeY ) );
1927 }
1928 else
1929 {
1930 // Get current drawing-sheet in a form we can compare to an EDA_ITEM
1932 EDA_ITEM* dsAsItem = static_cast<EDA_ITEM*>( ds );
1933
1934 // Calc the bounding box of all items on screen except the page border
1935 for( EDA_ITEM* item : GetScreen()->Items() )
1936 {
1937 if( item != dsAsItem ) // Ignore the drawing-sheet itself
1938 bBoxDoc.Merge( item->GetBoundingBox() );
1939 }
1940 }
1941
1942 return bBoxDoc;
1943}
1944
1945
1947{
1948 return Schematic().Hierarchy().IsModified();
1949}
1950
1951
1953{
1954 EESCHEMA_SETTINGS* cfg = eeconfig();
1955 return cfg && cfg->m_Appearance.show_hidden_pins;
1956}
1957
1958
1960{
1961 // nullptr will clear the current focus
1962 if( aItem != nullptr && !aItem->IsSCH_ITEM() )
1963 return;
1964
1965 static KIID lastBrightenedItemID( niluuid );
1966
1967 SCH_ITEM* lastItem = Schematic().ResolveItem( lastBrightenedItemID, nullptr, true );
1968
1969 if( lastItem && lastItem != aItem )
1970 {
1971 lastItem->ClearBrightened();
1972
1973 UpdateItem( lastItem );
1974 lastBrightenedItemID = niluuid;
1975 }
1976
1977 if( aItem )
1978 {
1979 if( !aItem->IsBrightened() )
1980 {
1981 aItem->SetBrightened();
1982
1983 UpdateItem( aItem );
1984 lastBrightenedItemID = aItem->m_Uuid;
1985 }
1986
1988 }
1989}
1990
1991
1993{
1994 return Schematic().GetFileName();
1995}
1996
1997
1999{
2000 return m_toolManager->GetTool<SCH_SELECTION_TOOL>()->GetSelection();
2001}
2002
2003
2004void SCH_EDIT_FRAME::onSize( wxSizeEvent& aEvent )
2005{
2006 if( IsShown() )
2007 {
2008 // We only need this until the frame is done resizing and the final client size is
2009 // established.
2010 Unbind( wxEVT_SIZE, &SCH_EDIT_FRAME::onSize, this );
2012 }
2013
2014 // Skip() is called in the base class.
2015 EDA_DRAW_FRAME::OnSize( aEvent );
2016}
2017
2018
2020 const KIID& aSchematicSymbolUUID )
2021{
2022 SCH_SHEET_PATH principalPath;
2023 SCH_SHEET_LIST sheets = Schematic().Hierarchy();
2024 SCH_ITEM* item = sheets.ResolveItem( aSchematicSymbolUUID, &principalPath, true );
2025 SCH_SYMBOL* principalSymbol = dynamic_cast<SCH_SYMBOL*>( item );
2026 SCH_COMMIT commit( m_toolManager );
2027
2028 if( !principalSymbol )
2029 return;
2030
2031 wxString principalRef;
2032
2033 if( principalSymbol->IsAnnotated( &principalPath ) )
2034 principalRef = principalSymbol->GetRef( &principalPath, false );
2035
2036 std::vector< std::pair<SCH_SYMBOL*, SCH_SHEET_PATH> > allUnits;
2037
2038 for( const SCH_SHEET_PATH& path : sheets )
2039 {
2040 for( SCH_ITEM* candidate : path.LastScreen()->Items().OfType( SCH_SYMBOL_T ) )
2041 {
2042 SCH_SYMBOL* candidateSymbol = static_cast<SCH_SYMBOL*>( candidate );
2043
2044 if( candidateSymbol == principalSymbol
2045 || ( candidateSymbol->IsAnnotated( &path )
2046 && candidateSymbol->GetRef( &path, false ) == principalRef ) )
2047 {
2048 allUnits.emplace_back( candidateSymbol, path );
2049 }
2050 }
2051 }
2052
2053 for( auto& [ unit, path ] : allUnits )
2054 {
2055 // This needs to be done before the LIB_SYMBOL is changed to prevent stale
2056 // library symbols in the schematic file.
2057 path.LastScreen()->Remove( unit );
2058
2059 if( !unit->IsNew() )
2060 commit.Modify( unit, path.LastScreen() );
2061
2062 unit->SetLibSymbol( aSymbol.Flatten().release() );
2063 unit->UpdateFields( &GetCurrentSheet(),
2064 true, /* update style */
2065 true, /* update ref */
2066 true, /* update other fields */
2067 false, /* reset ref */
2068 false /* reset other fields */ );
2069
2070 path.LastScreen()->Append( unit );
2071 GetCanvas()->GetView()->Update( unit );
2072 }
2073
2074 // Clear any orphaned alternate pins.
2075 for( SCH_PIN* pin : principalSymbol->GetPins() )
2076 {
2077 wxString altName = pin->GetAlt();
2078
2079 if( altName.IsEmpty() )
2080 continue;
2081
2082 if( pin->GetAlternates().count( altName ) == 0 )
2083 pin->SetAlt( wxEmptyString );
2084 }
2085
2086 if( !commit.Empty() )
2087 commit.Push( _( "Save Symbol to Schematic" ) );
2088}
2089
2090
2091void SCH_EDIT_FRAME::UpdateItem( EDA_ITEM* aItem, bool isAddOrDelete, bool aUpdateRtree )
2092{
2093 SCH_BASE_FRAME::UpdateItem( aItem, isAddOrDelete, aUpdateRtree );
2094
2095 if( SCH_ITEM* sch_item = dynamic_cast<SCH_ITEM*>( aItem ) )
2096 sch_item->ClearCaches();
2097}
2098
2099
2101{
2102 wxCHECK( m_toolManager, /* void */ );
2103
2107
2108 wxCHECK( screen, /* void */ );
2109
2111
2112 SCH_BASE_FRAME::SetScreen( screen );
2113
2114 SetSheetNumberAndCount(); // will also update CurrentScreen()'s sheet number info
2115
2117
2118 // update the references, units, and intersheet-refs
2120
2121 // dangling state can also have changed if different units with different pin locations are
2122 // used
2125
2127
2128 wxCHECK( selectionTool, /* void */ );
2129
2130 auto visit =
2131 [&]( EDA_ITEM* item )
2132 {
2134 && !m_findReplaceData->findString.IsEmpty()
2135 && item->Matches( *m_findReplaceData, &GetCurrentSheet() ) )
2136 {
2137 item->SetForceVisible( true );
2138 selectionTool->BrightenItem( item );
2139 }
2140 else if( item->IsBrightened() )
2141 {
2142 item->SetForceVisible( false );
2143 selectionTool->UnbrightenItem( item );
2144 }
2145 };
2146
2147 for( SCH_ITEM* item : screen->Items() )
2148 {
2149 visit( item );
2150
2151 item->RunOnChildren(
2152 [&]( SCH_ITEM* aChild )
2153 {
2154 visit( aChild );
2155 },
2156 RECURSE_MODE::NO_RECURSE );
2157 }
2158
2159 if( !screen->m_zoomInitialized )
2160 {
2162 }
2163 else
2164 {
2165 // Set zoom to last used in this screen
2166 GetCanvas()->GetView()->SetScale( GetScreen()->m_LastZoomLevel );
2167 GetCanvas()->GetView()->SetCenter( GetScreen()->m_ScrollCenter );
2168 }
2169
2170 updateTitle();
2171
2172 HardRedraw(); // Ensure all items are redrawn (especially the drawing-sheet items)
2173
2174 // Allow tools to re-add their VIEW_ITEMs after the last call to Clear in HardRedraw
2176
2178
2179 wxCHECK( editTool, /* void */ );
2180
2182 editTool->UpdateNetHighlighting( dummy );
2183
2185
2187}
2188
2189
2191{
2192 if( !m_diffSymbolDialog )
2193 {
2195 _( "Compare Symbol with Library" ) );
2196 }
2197
2198 return m_diffSymbolDialog;
2199}
2200
2201
2202void SCH_EDIT_FRAME::onCloseSymbolDiffDialog( wxCommandEvent& aEvent )
2203{
2204 if( m_diffSymbolDialog && aEvent.GetString() == DIFF_SYMBOLS_DIALOG_NAME )
2205 {
2206 m_diffSymbolDialog->Destroy();
2207 m_diffSymbolDialog = nullptr;
2208 }
2209}
2210
2211
2213{
2214 if( !m_ercDialog )
2215 m_ercDialog = new DIALOG_ERC( this );
2216
2217 return m_ercDialog;
2218}
2219
2220
2221void SCH_EDIT_FRAME::onCloseErcDialog( wxCommandEvent& aEvent )
2222{
2223 if( m_ercDialog )
2224 {
2225 m_ercDialog->Destroy();
2226 m_ercDialog = nullptr;
2227 }
2228}
2229
2230
2232{
2235
2237}
2238
2239
2241{
2243 {
2244 m_symbolFieldsTableDialog->Destroy();
2245 m_symbolFieldsTableDialog = nullptr;
2246 }
2247}
2248
2249
2250void SCH_EDIT_FRAME::AddSchematicChangeListener( wxEvtHandler* aListener )
2251{
2252 auto it = std::find( m_schematicChangeListeners.begin(), m_schematicChangeListeners.end(), aListener );
2253
2254 // Don't add duplicate listeners.
2255 if( it == m_schematicChangeListeners.end() )
2256 m_schematicChangeListeners.push_back( aListener );
2257}
2258
2259
2261{
2262 auto it = std::find( m_schematicChangeListeners.begin(), m_schematicChangeListeners.end(), aListener );
2263
2264 // Don't add duplicate listeners.
2265 if( it != m_schematicChangeListeners.end() )
2266 m_schematicChangeListeners.erase( it );
2267}
2268
2269
2271{
2272 m_netNavigator = new wxTreeCtrl( this, wxID_ANY, wxPoint( 0, 0 ), FromDIP( wxSize( 160, 250 ) ),
2273 wxTR_DEFAULT_STYLE | wxNO_BORDER );
2274
2275 return m_netNavigator;
2276}
2277
2278
2279void SCH_EDIT_FRAME::SetHighlightedConnection( const wxString& aConnection,
2280 const NET_NAVIGATOR_ITEM_DATA* aSelection )
2281{
2282 bool refreshNetNavigator = aConnection != m_highlightedConn;
2283
2284 m_highlightedConn = aConnection;
2285
2286 if( refreshNetNavigator )
2287 RefreshNetNavigator( aSelection );
2288}
2289
2290
2292{
2293 if( m_netNavigator )
2294 {
2295 NET_NAVIGATOR_ITEM_DATA itemData;
2296 wxTreeItemId selection = m_netNavigator->GetSelection();
2297 bool refreshSelection = selection.IsOk() && ( selection != m_netNavigator->GetRootItem() );
2298
2299 if( refreshSelection )
2300 {
2302 dynamic_cast<NET_NAVIGATOR_ITEM_DATA*>( m_netNavigator->GetItemData( selection ) );
2303
2304 wxCHECK( tmp, /* void */ );
2305 itemData = *tmp;
2306 }
2307
2308 m_netNavigator->DeleteAllItems();
2309 RefreshNetNavigator( refreshSelection ? &itemData : nullptr );
2310 }
2311
2313}
2314
2315
2317{
2318 wxAuiPaneInfo& hierarchyPane = m_auimgr.GetPane( SchematicHierarchyPaneName() );
2319 wxAuiPaneInfo& netNavigatorPane = m_auimgr.GetPane( NetNavigatorPaneName() );
2320 wxAuiPaneInfo& propertiesPane = m_auimgr.GetPane( PropertiesPaneName() );
2321 wxAuiPaneInfo& selectionFilterPane = m_auimgr.GetPane( wxS( "SelectionFilter" ) );
2322
2323 // Don't give the selection filter its own visibility controls; instead show it if
2324 // anything else is visible
2325 bool showFilter = ( hierarchyPane.IsShown() && hierarchyPane.IsDocked() )
2326 || ( netNavigatorPane.IsShown() && netNavigatorPane.IsDocked() )
2327 || ( propertiesPane.IsShown() && propertiesPane.IsDocked() );
2328
2329 selectionFilterPane.Show( showFilter );
2330}
2331
2332
2333#ifdef KICAD_IPC_API
2334void SCH_EDIT_FRAME::onPluginAvailabilityChanged( wxCommandEvent& aEvt )
2335{
2336 wxLogTrace( traceApi, "SCH frame: EDA_EVT_PLUGIN_AVAILABILITY_CHANGED" );
2338 aEvt.Skip();
2339}
2340#endif
2341
2342
2344{
2345 EESCHEMA_SETTINGS* cfg = eeconfig();
2346
2347 // Ensure m_show_search is up to date (the pane can be closed outside the menu)
2348 m_show_search = m_auimgr.GetPane( SearchPaneName() ).IsShown();
2349
2351
2352 wxAuiPaneInfo& searchPaneInfo = m_auimgr.GetPane( SearchPaneName() );
2353 searchPaneInfo.Show( m_show_search );
2354
2355 if( m_show_search )
2356 {
2357 searchPaneInfo.Direction( cfg->m_AuiPanels.search_panel_dock_direction );
2358
2359 if( cfg->m_AuiPanels.search_panel_dock_direction == wxAUI_DOCK_TOP
2360 || cfg->m_AuiPanels.search_panel_dock_direction == wxAUI_DOCK_BOTTOM )
2361 {
2362 SetAuiPaneSize( m_auimgr, searchPaneInfo, -1, cfg->m_AuiPanels.search_panel_height );
2363 }
2364 else if( cfg->m_AuiPanels.search_panel_dock_direction == wxAUI_DOCK_LEFT
2365 || cfg->m_AuiPanels.search_panel_dock_direction == wxAUI_DOCK_RIGHT )
2366 {
2367 SetAuiPaneSize( m_auimgr, searchPaneInfo, cfg->m_AuiPanels.search_panel_width, -1 );
2368 }
2369
2372 }
2373 else
2374 {
2375 cfg->m_AuiPanels.search_panel_height = m_searchPane->GetSize().y;
2376 cfg->m_AuiPanels.search_panel_width = m_searchPane->GetSize().x;
2377 cfg->m_AuiPanels.search_panel_dock_direction = searchPaneInfo.dock_direction;
2378 m_auimgr.Update();
2379 }
2380}
2381
2382
2384{
2385 if( !m_propertiesPanel )
2386 return;
2387
2388 bool show = !m_propertiesPanel->IsShownOnScreen();
2389
2390 wxAuiPaneInfo& propertiesPaneInfo = m_auimgr.GetPane( PropertiesPaneName() );
2391 propertiesPaneInfo.Show( show );
2392
2394
2395 EESCHEMA_SETTINGS* settings = eeconfig();
2396
2397 if( show )
2398 {
2399 SetAuiPaneSize( m_auimgr, propertiesPaneInfo,
2400 settings->m_AuiPanels.properties_panel_width, -1 );
2401 }
2402 else
2403 {
2404 settings->m_AuiPanels.properties_panel_width = m_propertiesPanel->GetSize().x;
2405 m_auimgr.Update();
2406 }
2407}
2408
2409
2411{
2412 EESCHEMA_SETTINGS* cfg = eeconfig();
2413
2414 wxCHECK( cfg, /* void */ );
2415
2416 wxAuiPaneInfo& hierarchy_pane = m_auimgr.GetPane( SchematicHierarchyPaneName() );
2417
2418 hierarchy_pane.Show( !hierarchy_pane.IsShown() );
2419
2421
2422 if( hierarchy_pane.IsShown() )
2423 {
2424 if( hierarchy_pane.IsFloating() )
2425 {
2426 hierarchy_pane.FloatingSize( cfg->m_AuiPanels.hierarchy_panel_float_width,
2428 m_auimgr.Update();
2429 }
2430 else if( cfg->m_AuiPanels.hierarchy_panel_docked_width > 0 )
2431 {
2432 // SetAuiPaneSize also updates m_auimgr
2433 SetAuiPaneSize( m_auimgr, hierarchy_pane,
2435 }
2436 }
2437 else
2438 {
2439 if( hierarchy_pane.IsFloating() )
2440 {
2441 cfg->m_AuiPanels.hierarchy_panel_float_width = hierarchy_pane.floating_size.x;
2442 cfg->m_AuiPanels.hierarchy_panel_float_height = hierarchy_pane.floating_size.y;
2443 }
2444 else
2445 {
2447 }
2448
2449 m_auimgr.Update();
2450 }
2451}
2452
2453
2455{
2456 EESCHEMA_SETTINGS* cfg = eeconfig();
2457
2458 wxCHECK( cfg, /* void */ );
2459
2460 wxAuiPaneInfo& db_library_pane = m_auimgr.GetPane( DesignBlocksPaneName() );
2461
2462 db_library_pane.Show( !db_library_pane.IsShown() );
2463
2464 if( db_library_pane.IsShown() )
2465 {
2466 if( db_library_pane.IsFloating() )
2467 {
2468 db_library_pane.FloatingSize( cfg->m_AuiPanels.design_blocks_panel_float_width,
2470 m_auimgr.Update();
2471 }
2473 {
2474 // SetAuiPaneSize also updates m_auimgr
2475 SetAuiPaneSize( m_auimgr, db_library_pane,
2477 }
2478 }
2479 else
2480 {
2481 if( db_library_pane.IsFloating() )
2482 {
2483 cfg->m_AuiPanels.design_blocks_panel_float_width = db_library_pane.floating_size.x;
2484 cfg->m_AuiPanels.design_blocks_panel_float_height = db_library_pane.floating_size.y;
2485 }
2486 else
2487 {
2489 }
2490
2491 m_auimgr.Update();
2492 }
2493}
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
@ icon_eeschema
@ icon_eeschema_16
@ icon_eeschema_32
BOX2< VECTOR2I > BOX2I
Definition: box2.h:922
static TOOL_ACTION toggleGrid
Definition: actions.h:195
static TOOL_ACTION paste
Definition: actions.h:80
static TOOL_ACTION cancelInteractive
Definition: actions.h:72
static TOOL_ACTION millimetersUnits
Definition: actions.h:203
static TOOL_ACTION unselectAll
Definition: actions.h:83
static TOOL_ACTION copy
Definition: actions.h:78
static TOOL_ACTION group
Definition: actions.h:236
static TOOL_ACTION pasteSpecial
Definition: actions.h:81
static TOOL_ACTION milsUnits
Definition: actions.h:202
static TOOL_ACTION ungroup
Definition: actions.h:237
static TOOL_ACTION toggleBoundingBoxes
Definition: actions.h:154
static TOOL_ACTION showSearch
Definition: actions.h:115
static TOOL_ACTION undo
Definition: actions.h:75
static TOOL_ACTION selectionActivate
Activation of the selection tool.
Definition: actions.h:211
static TOOL_ACTION duplicate
Definition: actions.h:84
static TOOL_ACTION inchesUnits
Definition: actions.h:201
static TOOL_ACTION toggleCursorStyle
Definition: actions.h:151
static TOOL_ACTION doDelete
Definition: actions.h:85
static TOOL_ACTION selectionTool
Definition: actions.h:248
static TOOL_ACTION save
Definition: actions.h:58
static TOOL_ACTION zoomFitScreen
Definition: actions.h:141
static TOOL_ACTION redo
Definition: actions.h:76
static TOOL_ACTION deleteTool
Definition: actions.h:86
static TOOL_ACTION zoomTool
Definition: actions.h:145
static TOOL_ACTION selectionClear
Clear the current selection.
Definition: actions.h:221
static TOOL_ACTION showProperties
Definition: actions.h:263
static TOOL_ACTION cut
Definition: actions.h:77
static TOOL_ACTION copyAsText
Definition: actions.h:79
static TOOL_ACTION toggleGridOverrides
Definition: actions.h:196
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 SetPageNumber(const wxString &aPageNumber)
Definition: base_screen.h:79
void SetContentModified(bool aModified=true)
Definition: base_screen.h:59
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:152
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:107
Handle actions that are shared between different applications.
Handles action that are shared between different applications.
Definition: common_tools.h:38
const NET_MAP & GetNetMap() const
CONNECTION_SUBGRAPH * FindFirstSubgraphByName(const wxString &aNetName)
Retrieve a subgraph for the given net name, if one exists.
A subgraph is a set of items that are electrically connected on a single sheet.
virtual APP_SETTINGS_BASE * config() const
Return the settings object used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME.
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...
void UpdateFileHistory(const wxString &FullFileName, FILE_HISTORY *aFileHistory=nullptr)
Update the list of recently opened files.
wxAuiManager m_auimgr
virtual void RecreateToolbars()
void ClearFileHistory(FILE_HISTORY *aFileHistory=nullptr)
Remove all files from the file history.
virtual void OnSize(wxSizeEvent &aEvent)
virtual void OnDropFiles(wxDropFilesEvent &aEvent)
Handle event fired when a file is dropped to the window.
wxString GetFileFromHistory(int cmdId, const wxString &type, FILE_HISTORY *aFileHistory=nullptr)
Fetch the file name from the file history list.
virtual int GetUndoCommandCount() const
bool m_isClosing
Set by the close window event handler after frames are asked if they can close.
wxString m_mruPath
EDA_DRAW_PANEL_GAL::GAL_TYPE m_canvasType
The current canvas type.
virtual void OnSize(wxSizeEvent &event) override
Recalculate the size of toolbars and display panel when the frame size changes.
GAL_DISPLAY_OPTIONS_IMPL & GetGalDisplayOptions()
Return a reference to the gal rendering options used by GAL for rendering.
static const wxString PropertiesPaneName()
void FocusOnLocation(const VECTOR2I &aPos)
Useful to focus on a particular location, in find functions.
virtual void SetScreen(BASE_SCREEN *aScreen)
virtual void UpdateMsgPanel()
Redraw the message panel.
virtual void ClearFocus()
SEARCH_PANE * m_searchPane
static const wxString DesignBlocksPaneName()
std::unique_ptr< EDA_SEARCH_DATA > m_findReplaceData
PROPERTIES_PANEL * m_propertiesPanel
GAL_TYPE GetBackend() const
Return the type of backend currently used by GAL canvas.
void ForceRefresh()
Force a redraw.
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
void SetEventDispatcher(TOOL_DISPATCHER *aEventDispatcher)
Set a dispatcher that processes events and forwards them to tools.
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:98
virtual const VECTOR2I GetFocusPosition() const
Similar to GetPosition() but allows items to return their visual center rather than their anchor.
Definition: eda_item.h:279
const KIID m_Uuid
Definition: eda_item.h:516
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:110
void ClearBrightened()
Definition: eda_item.h:138
void SetBrightened()
Definition: eda_item.h:135
bool IsBrightened() const
Definition: eda_item.h:129
Specialization of the wxAuiPaneInfo class for KiCad panels.
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
Definition: eda_text.h:79
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:97
SELECTION_CONDITION NoActiveTool()
Create a functor testing if there are no tools active in the frame.
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 Units(EDA_UNITS aUnit)
Create a functor that tests if the frame has the specified units.
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.
SELECTION_CONDITION FullscreenCursor()
Create a functor testing if the cursor is full screen 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.
void UpdateHierarchyTree(bool aClear=false)
Update the hierarchical tree of the schematic.
void UpdateLabelsHierarchyTree()
Update the labels of the hierarchical tree of the schematic.
void UpdateHierarchySelection()
Updates the tree's selection to match current page.
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
Definition: ki_exception.h:77
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 Update(const KIGFX::VIEW_ITEM *aItem, int aUpdateFlags) const override
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
Definition: sch_view.cpp:60
DS_PROXY_VIEW_ITEM * GetDrawingSheet() const
Definition: sch_view.h:120
void SetScale(double aScale, VECTOR2D aAnchor={ 0, 0 }) override
Set the scaling factor, zooming around a given anchor point.
Definition: sch_view.cpp:102
An abstract base class for deriving all objects that can be added to a VIEW.
Definition: view_item.h:86
bool IsSCH_ITEM() const
Definition: view_item.h:101
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:66
double GetScale() const
Definition: view.h:276
void SetLayerVisible(int aLayer, bool aVisible=true)
Control the visibility of a particular layer.
Definition: view.h:400
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
Definition: view.h:220
void SetCenter(const VECTOR2D &aCenter)
Set the center point of the VIEW (i.e.
Definition: view.cpp:596
void UpdateAllItemsConditionally(int aUpdateFlags, std::function< bool(VIEW_ITEM *)> aCondition)
Update items in the view according to the given flags and condition.
Definition: view.cpp:1571
Definition: kiid.h:49
A wxFrame capable of the OpenProjectFiles function, meaning it can load a portion of a KiCad project.
Definition: kiway_player.h:65
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.
Definition: kiway_player.h:113
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:286
void OnKiCadExit()
Definition: kiway.cpp:694
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
Definition: kiway.cpp:395
virtual bool PlayerClose(FRAME_T aFrameType, bool doForce)
Call the KIWAY_PLAYER::Close( bool force ) function on the window and if not vetoed,...
Definition: kiway.cpp:451
virtual void ExpressMail(FRAME_T aDestination, MAIL_T aCommand, std::string &aPayload, wxWindow *aSource=nullptr)
Send aPayload to aDestination from aSource.
Definition: kiway.cpp:499
Define a library symbol object.
Definition: lib_symbol.h:85
std::unique_ptr< LIB_SYMBOL > Flatten() const
Return a flattened symbol inheritance to the caller.
Definition: lib_symbol.cpp:344
Tree view item data for the net navigator.
A singleton reporter that reports to nowhere.
Definition: reporter.h:217
int GetHeightIU(double aIUScale) const
Gets the page height in IU.
Definition: page_info.h:162
int GetWidthIU(double aIUScale) const
Gets the page width in IU.
Definition: page_info.h:153
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:143
virtual const wxString GetProjectPath() const
Return the full path of the project.
Definition: project.cpp:149
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:373
Action handler for the Properties panel.
These are loaded from Eeschema settings but then overwritten by the project settings.
TEMPLATES m_TemplateFieldNames
Holds all the data relating to one schematic.
Definition: schematic.h:88
void SetCurrentSheet(const SCH_SHEET_PATH &aPath)
Definition: schematic.h:176
void Reset()
Initialize this schematic to a blank one, unloading anything existing.
Definition: schematic.cpp:144
CONNECTION_GRAPH * m_connectionGraph
Hold and calculate connectivity information of this schematic.
Definition: schematic.h:482
void RecomputeIntersheetRefs()
Update the schematic's page reference map for all global labels, and refresh the labels so that they ...
Definition: schematic.cpp:735
void OnSchSheetChanged()
Notify the schematic and its listeners that the current sheet has been changed.
Definition: schematic.cpp:853
wxString GetFileName() const
Helper to retrieve the filename from the root sheet screen.
Definition: schematic.cpp:350
wxString GetOperatingPoint(const wxString &aNetName, int aPrecision, const wxString &aRange)
Definition: schematic.cpp:787
SCHEMATIC_SETTINGS & Settings() const
Definition: schematic.cpp:356
SCH_ITEM * ResolveItem(const KIID &aID, SCH_SHEET_PATH *aPathOut=nullptr, bool aAllowNullptrReturn=false) const
Definition: schematic.h:134
SCH_SHEET_LIST Hierarchy() const
Return the full schematic flattened hierarchical sheet list.
Definition: schematic.cpp:258
void SetRoot(SCH_SHEET *aRootSheet)
Initialize the schematic with a new root sheet.
Definition: schematic.cpp:238
void SetProject(PROJECT *aPrj)
Definition: schematic.cpp:170
EMBEDDED_FILES * GetEmbeddedFiles() override
Definition: schematic.cpp:927
CONNECTION_GRAPH * ConnectionGraph() const
Definition: schematic.h:183
SCH_SCREEN * RootScreen() const
Helper to retrieve the screen of the root sheet.
Definition: schematic.cpp:252
bool IsValid() const
A simple test if the schematic is loaded, not a complete one.
Definition: schematic.h:156
void RemoveAllListeners()
Remove all listeners.
Definition: schematic.cpp:878
SCH_SHEET & Root() const
Definition: schematic.h:140
void SetSheetNumberAndCount()
Set the m_ScreenNumber and m_NumberOfScreens members for screens.
Definition: schematic.cpp:706
SCH_SHEET_PATH & CurrentSheet() const
Definition: schematic.h:171
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.
Definition: schematic.cpp:1308
ERC_SETTINGS & ErcSettings() const
Definition: schematic.cpp:363
void RefreshHierarchy()
Definition: schematic.cpp:266
Gather all the actions that are shared by tools.
Definition: sch_actions.h:40
static TOOL_ACTION rotateCCW
Definition: sch_actions.h:121
static TOOL_ACTION placeClassLabel
Definition: sch_actions.h:79
static TOOL_ACTION placeSheetPin
Definition: sch_actions.h:85
static TOOL_ACTION saveSheetAsDesignBlock
Definition: sch_actions.h:191
static TOOL_ACTION mirrorV
Definition: sch_actions.h:122
static TOOL_ACTION drawSheetFromFile
Definition: sch_actions.h:83
static TOOL_ACTION toggleOPCurrents
Definition: sch_actions.h:243
static TOOL_ACTION saveToLinkedDesignBlock
Definition: sch_actions.h:71
static TOOL_ACTION saveSelectionAsDesignBlock
Definition: sch_actions.h:192
static TOOL_ACTION placeGlobalLabel
Definition: sch_actions.h:80
static TOOL_ACTION drawTextBox
Definition: sch_actions.h:93
static TOOL_ACTION toggleAnnotateAuto
Definition: sch_actions.h:270
static TOOL_ACTION drawArc
Definition: sch_actions.h:97
static TOOL_ACTION drawSheet
Definition: sch_actions.h:82
static TOOL_ACTION toggleERCWarnings
Definition: sch_actions.h:238
static TOOL_ACTION toggleDirectiveLabels
Definition: sch_actions.h:237
static TOOL_ACTION highlightNetTool
Definition: sch_actions.h:299
static TOOL_ACTION leaveSheet
Definition: sch_actions.h:219
static TOOL_ACTION toggleHiddenFields
Definition: sch_actions.h:234
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 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 drawBezier
Definition: sch_actions.h:98
static TOOL_ACTION drawWire
Definition: sch_actions.h:72
static TOOL_ACTION remapSymbols
Definition: sch_actions.h:166
static TOOL_ACTION lineMode45
Definition: sch_actions.h:266
static TOOL_ACTION rotateCW
Definition: sch_actions.h:120
static TOOL_ACTION showHierarchy
Definition: sch_actions.h:225
static TOOL_ACTION showNetNavigator
Definition: sch_actions.h:300
static TOOL_ACTION placeJunction
Definition: sch_actions.h:76
static TOOL_ACTION markSimExclusions
Definition: sch_actions.h:241
static TOOL_ACTION drawRuleArea
Definition: sch_actions.h:103
static TOOL_ACTION placeSymbol
Definition: sch_actions.h:66
static TOOL_ACTION placeImage
Definition: sch_actions.h:100
static TOOL_ACTION toggleERCErrors
Definition: sch_actions.h:239
static TOOL_ACTION placeLinkedDesignBlock
Definition: sch_actions.h:70
static TOOL_ACTION drawSheetFromDesignBlock
Definition: sch_actions.h:84
static TOOL_ACTION mirrorH
Definition: sch_actions.h:123
static TOOL_ACTION placeDesignBlock
Definition: sch_actions.h:69
static TOOL_ACTION toggleOPVoltages
Definition: sch_actions.h:242
static TOOL_ACTION drawBus
Definition: sch_actions.h:73
static TOOL_ACTION drawTable
Definition: sch_actions.h:94
static TOOL_ACTION lineMode90
Definition: sch_actions.h:265
static TOOL_ACTION ddAppendFile
Definition: sch_actions.h:303
static TOOL_ACTION placeSchematicText
Definition: sch_actions.h:92
static TOOL_ACTION lineModeFree
Definition: sch_actions.h:264
static TOOL_ACTION showDesignBlockPanel
Definition: sch_actions.h:190
static TOOL_ACTION togglePinAltIcons
Definition: sch_actions.h:244
static TOOL_ACTION toggleERCExclusions
Definition: sch_actions.h:240
static TOOL_ACTION updateNetHighlighting
Definition: sch_actions.h:298
static TOOL_ACTION placeNoConnect
Definition: sch_actions.h:75
static TOOL_ACTION toggleHiddenPins
Definition: sch_actions.h:233
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_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.
Definition: sch_commit.cpp:489
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.
SELECTION_CONDITION LineMode(LINE_MODE aMode)
Create a functor that tests if the frame is in the specified line drawing mode.
Handle actions specific to the schematic editor.
int UpdateNetHighlighting(const TOOL_EVENT &aEvent)
Launch a tool to highlight nets.
Schematic editor (Eeschema) main window.
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.
SELECTION & GetCurrentSelection() override
Get the current selection from the canvas area.
const wxString & getAutoSaveFileName() const
wxTreeCtrl * m_netNavigator
std::vector< std::unique_ptr< SCH_ITEM > > m_items_to_repeat
For the repeat-last-item cmd.
void onResizeNetNavigator(wxSizeEvent &aEvent)
void updateSelectionFilterVisbility() override
Selection filter panel doesn't have a dedicated visibility control, so show it if any other AUI panel...
bool m_highlightedConnChanged
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 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.
void onCloseErcDialog(wxCommandEvent &aEvent)
void UpdateHierarchySelection()
Update the hierarchy navigation tree selection (cross-probe from schematic to hierarchy pane).
void SetScreen(BASE_SCREEN *aScreen) override
void SaveSymbolToSchematic(const LIB_SYMBOL &aSymbol, const KIID &aSchematicSymbolUUID)
Update a schematic symbol from a LIB_SYMBOL.
void onSize(wxSizeEvent &aEvent)
void CommonSettingsChanged(int aFlags) override
Called after the preferences dialog is run.
void ShowChangedLanguage() 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.
SCHEMATIC * m_schematic
The currently loaded schematic.
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.
void OnLoadFile(wxCommandEvent &event)
SCHEMATIC & Schematic() const
void updateTitle()
Set the main window title bar text.
void ToggleSearch()
Toggle the show/hide state of Search pane.
void RefreshNetNavigator(const NET_NAVIGATOR_ITEM_DATA *aSelection=nullptr)
wxString GetFullScreenDesc() const override
static const wxString SearchPaneName()
DIALOG_BOOK_REPORTER * GetSymbolDiffDialog()
bool canCloseWindow(wxCloseEvent &aCloseEvent) override
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.
void ToggleSchematicHierarchy()
Toggle the show/hide state of the left side schematic navigation panel.
void SetSheetNumberAndCount()
Set the m_ScreenNumber and m_NumberOfScreens members for screens.
void OnPageSettingsChange() override
Called when modifying the page settings.
void ClearRepeatItemsList()
Clear the list of items which are to be repeated with the insert key.
const BOX2I GetDocumentExtents(bool aIncludeAllVisible=true) const override
Return bounding box of document with option to not include some items.
void CaptureHierarchyPaneSize()
void 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.
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)
int GetSchematicJunctionSize()
void DisplayCurrentSheet()
Draw the current sheet on the display.
~SCH_EDIT_FRAME() override
const wxString & GetHighlightedConnection() const
DIALOG_ERC * m_ercDialog
void UpdateItem(EDA_ITEM *aItem, bool isAddOrDelete=false, bool aUpdateRtree=false) override
Mark an item for refresh.
void UpdateNetHighlightStatus()
wxString GetScreenDesc() const override
Return a human-readable description of the current screen.
void AddCopyForRepeatItem(const SCH_ITEM *aItem)
DIALOG_SYMBOL_FIELDS_TABLE * GetSymbolFieldsTableDialog()
void OnResizeHierarchyNavigator(wxSizeEvent &aEvent)
wxString GetCurrentFileName() const override
Get the full filename + path of the currently opened file in the frame.
wxString m_highlightedConn
The highlighted net or bus or empty string.
static const wxString NetNavigatorPaneName()
void onCloseSymbolDiffDialog(wxCommandEvent &aEvent)
wxTreeCtrl * createHighlightedNetNavigator()
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).
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 FocusOnItem(EDA_ITEM *aItem) override
Focus on a particular canvas item.
void onNetNavigatorSelection(wxTreeEvent &aEvent)
void SaveCopyForRepeatItem(const SCH_ITEM *aItem)
Clone aItem and owns that clone in this container.
Handle actions specific to the schematic editor.
A set of SCH_ITEMs (i.e., without duplicates).
Definition: sch_group.h:52
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:168
SCH_ITEM * Duplicate(bool addToParentGroup, SCH_COMMIT *aCommit=nullptr, bool doClone=false) const
Routine to create a new copy of given item.
Definition: sch_item.cpp:137
virtual void RunOnChildren(const std::function< void(SCH_ITEM *)> &aFunction, RECURSE_MODE aMode)
Definition: sch_item.h:602
SCH_CONNECTION * Connection(const SCH_SHEET_PATH *aSheet=nullptr) const
Retrieve the connection associated with this object in the given sheet.
Definition: sch_item.cpp:352
bool ResolveExcludedFromSim() const
Definition: sch_item.cpp:276
bool AutoRotateOnPlacement() const
autoRotateOnPlacement
Definition: sch_label.cpp:1472
SPIN_STYLE GetSpinStyle() const
Definition: sch_label.cpp:351
void AutoplaceFields(SCH_SCREEN *aScreen, AUTOPLACE_ALGO aAlgo) override
Definition: sch_label.cpp:580
virtual void SetSpinStyle(SPIN_STYLE aSpinStyle)
Definition: sch_label.cpp:316
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:338
bool IsWire() const
Return true if the line is a wire.
Definition: sch_line.cpp:949
double GetLength() const
Definition: sch_line.cpp:243
const wxString & GetOperatingPoint() const
Definition: sch_line.h:337
Handle actions specific to the schematic editor.
void SetOperatingPoint(const wxString &aText)
Definition: sch_pin.h:311
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:758
SCH_SCREEN * GetNext()
SCH_SCREEN * GetFirst()
bool HasNoFullyDefinedLibIds()
Test all of the schematic symbols to see if all LIB_ID objects library nickname is not set.
const PAGE_INFO & GetPageSettings() const
Definition: sch_screen.h:139
void Clear(bool aFree=true)
Delete all draw items and clears the project settings.
Definition: sch_screen.cpp:285
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:488
double m_LastZoomLevel
last value for the zoom level, useful in Eeschema when changing the current displayed sheet to reuse ...
Definition: sch_screen.h:682
EE_RTREE & Items()
Get the full RTree, usually for iterating.
Definition: sch_screen.h:117
const wxString & GetFileName() const
Definition: sch_screen.h:152
const KIID & GetUuid() const
Definition: sch_screen.h:539
bool IsReadOnly() const
Definition: sch_screen.h:155
void SetFileName(const wxString &aFileName)
Set the file name for this screen to aFileName.
Definition: sch_screen.cpp:123
void Update(SCH_ITEM *aItem, bool aUpdateLibSymbol=true)
Update aItem's bounding box in the tree.
Definition: sch_screen.cpp:323
bool m_zoomInitialized
Definition: sch_screen.h:707
bool FileExists() const
Definition: sch_screen.h:158
SPIN_STYLE GetLabelOrientationForPoint(const VECTOR2I &aPosition, SPIN_STYLE aDefaultOrientation, const SCH_SHEET_PATH *aSheet) const
Definition: sch_screen.cpp:510
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
SCH_ITEM * ResolveItem(const KIID &aID, SCH_SHEET_PATH *aPathOut=nullptr, bool aAllowNullptrReturn=false) const
Fetch a SCH_ITEM by ID.
bool IsModified() const
Check the entire hierarchy for any modifications.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
wxString PathHumanReadable(bool aUseShortRootName=true, bool aStripTrailingSeparator=false) const
Return the sheet path in a human readable form made from the sheet names.
void UpdateAllScreenReferences() const
Update all the symbol references for this sheet path.
SCH_SCREEN * LastScreen()
bool GetExcludedFromSim() const
void SetPageNumber(const wxString &aPageNumber)
Set the sheet instance user definable page number.
SCH_SHEET * Last() const
Return a pointer to the last SCH_SHEET of the list.
void push_back(SCH_SHEET *aSheet)
Forwarded method from std::vector.
void clear()
Forwarded method from std::vector.
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:47
wxString GetName() const
Definition: sch_sheet.h:113
void SetScreen(SCH_SCREEN *aScreen)
Set the SCH_SCREEN associated with this sheet to aScreen.
Definition: sch_sheet.cpp:137
Schematic symbol object.
Definition: sch_symbol.h:75
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.
Definition: sch_symbol.cpp:636
std::vector< SCH_PIN * > GetPins(const SCH_SHEET_PATH *aSheet) const
Retrieve a list of the SCH_PINs for the given sheet path.
SCH_PIN * GetPin(const wxString &number) const
Find a symbol pin by number.
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const override
Definition: sch_symbol.cpp:558
VECTOR2I GetPosition() const override
Definition: sch_text.h:141
void RefreshSearch()
void FocusSearch()
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 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)
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
const SPICE_GENERATOR & SpiceGenerator() const
Definition: sim_model.h:431
std::vector< std::reference_wrapper< const SIM_MODEL_PIN > > GetPins() const
Definition: sim_model.cpp:686
virtual std::string ItemName(const SPICE_ITEM &aItem) const
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
Definition: tools_holder.h:171
TOOL_DISPATCHER * m_toolDispatcher
Definition: tools_holder.h:173
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
Definition: tools_holder.h:55
ACTIONS * m_actions
Definition: tools_holder.h:172
@ 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:168
Master controller class:
Definition: tool_manager.h:62
bool RunAction(const std::string &aActionName, T aParam)
Run the specified action immediately, pausing the current action to run the new one.
Definition: tool_manager.h:150
ACTION_MANAGER * GetActionManager() const
Definition: tool_manager.h:306
bool PostAction(const std::string &aActionName, T aParam)
Run the specified action after the current action (coroutine) ends.
Definition: tool_manager.h:235
void ResetTools(TOOL_BASE::RESET_REASON aReason)
Reset all tools (i.e.
void RegisterTool(TOOL_BASE *aTool)
Add a tool to the manager set and sets it up.
void SetEnvironment(EDA_ITEM *aModel, KIGFX::VIEW *aView, KIGFX::VIEW_CONTROLS *aViewControls, APP_SETTINGS_BASE *aSettings, TOOLS_HOLDER *aFrame)
Set the work environment (model, view, view controls and the parent window).
void InitTools()
Initialize all registered tools.
std::vector< PICKED_ITEMS_LIST * > m_CommandsList
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:429
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:129
void DisplayError(wxWindow *aParent, const wxString &aText)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:169
This file is part of the common library.
#define CHECK(x)
#define ENABLE(x)
#define _HKI(x)
#define _(s)
#define KICAD_DEFAULT_DRAWFRAME_STYLE
#define SCH_EDIT_FRAME_NAME
#define IGNORE_PARENT_GROUP
Definition: eda_item.h:55
@ ID_IMPORT_NON_KICAD_SCH
Definition: eeschema_id.h:57
const wxAuiPaneInfo & defaultSchSelectionFilterPaneInfo(wxWindow *aWindow)
const wxAuiPaneInfo & defaultPropertiesPaneInfo(wxWindow *aWindow)
const wxAuiPaneInfo & defaultNetNavigatorPaneInfo()
const wxAuiPaneInfo & defaultDesignBlocksPaneInfo(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:143
static const std::string NetlistFileExtension
static const std::string LegacyPcbFileExtension
static const std::string KiCadSchematicFileExtension
static const std::string AutoSaveFilePrefix
static wxString LegacySchematicFileWildcard()
static wxString AllSchematicFilesWildcard()
static wxString KiCadSchematicFileWildcard()
const wxChar *const traceApi
Flag to enable debug output related to the IPC API and its plugin system.
Definition: api_utils.cpp:27
@ ID_FILE_LIST_CLEAR
Definition: id.h:62
@ ID_EDA_SOCKET_EVENT
Definition: id.h:132
@ ID_EDA_SOCKET_EVENT_SERV
Definition: id.h:131
@ ID_FILEMAX
Definition: id.h:60
@ ID_FILE1
Definition: id.h:59
PROJECT & Prj()
Definition: kicad.cpp:608
KIID niluuid(0)
#define KICTL_CREATE
caller thinks requested project files may not exist.
Definition: kiway_player.h:76
@ LAYER_ERC_WARN
Definition: layer_ids.h:469
@ LAYER_ERC_EXCLUSION
Definition: layer_ids.h:471
@ LAYER_ERC_ERR
Definition: layer_ids.h:470
@ LAYER_OP_CURRENTS
Definition: layer_ids.h:491
@ LAYER_INTERSHEET_REFS
Definition: layer_ids.h:453
@ LAYER_OP_VOLTAGES
Definition: layer_ids.h:490
@ 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
PGM_BASE & Pgm()
The global program "get" accessor.
Definition: pgm_base.cpp:902
see class PGM_BASE
SEVERITY
#define DIFF_SYMBOLS_DIALOG_NAME
wxDEFINE_EVENT(EDA_EVT_SCHEMATIC_CHANGING, wxCommandEvent)
#define CURRENT_TOOL(action)
@ AUTOPLACE_AUTO
Definition: sch_item.h:71
SCH_CLEANUP_FLAGS
Definition: schematic.h:74
@ GLOBAL_CLEANUP
Definition: schematic.h:77
KIWAY Kiway(KFCTL_STANDALONE)
std::vector< FAB_LAYER_COLOR > dummy
wxString UnescapeString(const wxString &aSource)
const double IU_PER_MILS
Definition: base_units.h:77
std::string refName
Definition for symbol library class.
@ SCH_GROUP_T
Definition: typeinfo.h:174
@ SCH_LINE_T
Definition: typeinfo.h:164
@ SCH_SYMBOL_T
Definition: typeinfo.h:173
@ SCH_HIER_LABEL_T
Definition: typeinfo.h:170
@ SCH_GLOBAL_LABEL_T
Definition: typeinfo.h:169
VECTOR2< int32_t > VECTOR2I
Definition: vector2d.h: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.