KiCad PCB EDA Suite
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 (C) 1992-2023 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 <base_units.h>
26#include <bitmaps.h>
27#include <symbol_library.h>
28#include <confirm.h>
29#include <connection_graph.h>
31#include <eeschema_id.h>
32#include <executable_names.h>
33#include <gestfich.h>
35#include <ignore.h>
36#include <invoke_sch_dialog.h>
37#include <string_utils.h>
38#include <kiface_base.h>
39#include <kiplatform/app.h>
40#include <kiway.h>
41#include <symbol_edit_frame.h>
42#include <symbol_viewer_frame.h>
43#include <pgm_base.h>
44#include <profile.h>
45#include <project.h>
48#include <dialog_erc.h>
49#include <python_scripting.h>
50#include <sch_edit_frame.h>
51#include <sch_painter.h>
52#include <sch_sheet.h>
53#include <sch_marker.h>
54#include <schematic.h>
56#include <advanced_config.h>
57#include <sim/simulator_frame.h>
58#include <tool/action_manager.h>
59#include <tool/action_toolbar.h>
60#include <tool/common_control.h>
61#include <tool/common_tools.h>
62#include <tool/picker_tool.h>
63#include <tool/selection.h>
65#include <tool/tool_manager.h>
66#include <tool/zoom_tool.h>
67#include <tools/ee_actions.h>
72#include <tools/sch_edit_tool.h>
76#include <tools/sch_move_tool.h>
79#include <view/view_controls.h>
80#include <widgets/wx_infobar.h>
83#include <wx/cmdline.h>
84#include <wx/app.h>
85#include <wx/filedlg.h>
86#include <wx/socket.h>
88
91
92
93BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, SCH_BASE_FRAME )
96
97 EVT_SIZE( SCH_EDIT_FRAME::OnSize )
98
101
104
105 EVT_MENU( wxID_EXIT, SCH_EDIT_FRAME::OnExit )
106 EVT_MENU( wxID_CLOSE, SCH_EDIT_FRAME::OnExit )
107
109
110 // Drop files event
111 EVT_DROP_FILES( SCH_EDIT_FRAME::OnDropFiles )
112END_EVENT_TABLE()
113
114
115SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
116 SCH_BASE_FRAME( aKiway, aParent, FRAME_SCH, wxT( "Eeschema" ), wxDefaultPosition,
118 m_highlightedConn( nullptr )
119{
120 m_maximizeByDefault = true;
121 m_schematic = new SCHEMATIC( nullptr );
122
123 m_showBorderAndTitleBlock = true; // true to show sheet references
124 m_supportsAutoSave = true;
125 m_syncingPcbToSchSelection = false;
126 m_aboutTitle = _HKI( "KiCad Schematic Editor" );
127
128 m_findReplaceDialog = nullptr;
129
130 m_findReplaceData = std::make_unique<SCH_SEARCH_DATA>();
131
132 // Give an icon
133 wxIcon icon;
134 wxIconBundle icon_bundle;
135
136 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_eeschema ) );
137 icon_bundle.AddIcon( icon );
138 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_eeschema_32 ) );
139 icon_bundle.AddIcon( icon );
140 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_eeschema_16 ) );
141 icon_bundle.AddIcon( icon );
142
143 SetIcons( icon_bundle );
144
145 LoadSettings( eeconfig() );
146
147 // NB: also links the schematic to the loaded project
148 CreateScreens();
149 SetCurrentSheet( Schematic().GetSheets()[0] );
150
151 setupTools();
152 setupUIConditions();
153 ReCreateMenuBar();
154 ReCreateHToolbar();
155 ReCreateVToolbar();
156 ReCreateOptToolbar();
157
158 m_hierarchy = new HIERARCHY_PANE( this );
159
160 // Initialize common print setup dialog settings.
161 m_pageSetupData.GetPrintData().SetPrintMode( wxPRINT_MODE_PRINTER );
162 m_pageSetupData.GetPrintData().SetQuality( wxPRINT_QUALITY_MEDIUM );
163 m_pageSetupData.GetPrintData().SetBin( wxPRINTBIN_AUTO );
164 m_pageSetupData.GetPrintData().SetNoCopies( 1 );
165
166 m_auimgr.SetManagedWindow( this );
167
168 CreateInfoBar();
169
170 // Rows; layers 4 - 6
171 m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( wxS( "MainToolbar" ) )
172 .Top().Layer( 6 ) );
173
174 m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( wxS( "MsgPanel" ) )
175 .Bottom().Layer( 6 ) );
176
177 // Columns; layers 1 - 3
178 m_auimgr.AddPane( m_hierarchy, EDA_PANE().Palette().Name( SchematicHierarchyPaneName() )
179 .Caption( _( "Schematic Hierarchy" ) )
180 .Left().Layer( 3 )
181 .TopDockable( false )
182 .BottomDockable( false )
183 .CloseButton( true )
184 .MinSize( 120, 60 )
185 .BestSize( 200, 200 )
186 .FloatingSize( 200, 200 )
187 .Show( false ) );
188 m_auimgr.AddPane( m_optionsToolBar, EDA_PANE().VToolbar().Name( wxS( "OptToolbar" ) )
189 .Left().Layer( 2 ) );
190
191 m_auimgr.AddPane( m_drawToolBar, EDA_PANE().VToolbar().Name( wxS( "ToolsToolbar" ) )
192 .Right().Layer( 2 ) );
193
194 // Center
195 m_auimgr.AddPane( GetCanvas(), EDA_PANE().Canvas().Name( wxS( "DrawFrame" ) )
196 .Center() );
197
198 FinishAUIInitialization();
199
200 resolveCanvasType();
201 SwitchCanvas( m_canvasType );
202
203 GetCanvas()->GetGAL()->SetAxesEnabled( false );
204
205 KIGFX::SCH_VIEW* view = GetCanvas()->GetView();
206 static_cast<KIGFX::SCH_PAINTER*>( view->GetPainter() )->SetSchematic( m_schematic );
207
208 wxAuiPaneInfo& hierarchy_pane = m_auimgr.GetPane( SchematicHierarchyPaneName() );
210
211 hierarchy_pane.Show( cfg->m_AuiPanels.show_schematic_hierarchy );
212
215 {
216 // Show at end, after positioning
217 hierarchy_pane.FloatingSize( cfg->m_AuiPanels.hierarchy_panel_float_width,
219 }
220
222 hierarchy_pane.Float();
223
225 {
226 SetAuiPaneSize( m_auimgr, hierarchy_pane,
228
229 // wxAUI hack: force width by setting MinSize() and then Fixed()
230 // thanks to ZenJu http://trac.wxwidgets.org/ticket/13180
231 hierarchy_pane.MinSize( cfg->m_AuiPanels.hierarchy_panel_docked_width, -1 );
232 hierarchy_pane.Fixed();
233 m_auimgr.Update();
234
235 // now make it resizable again
236 hierarchy_pane.Resizable();
237 m_auimgr.Update();
238
239 // Note: DO NOT call m_auimgr.Update() anywhere after this; it will nuke the size
240 // back to minimum.
241 hierarchy_pane.MinSize( 120, 60 );
242 }
243 else
244 {
245 m_auimgr.Update();
246 }
247
248 LoadProjectSettings();
249
255
256 initScreenZoom();
257
258 m_hierarchy->Connect( wxEVT_SIZE,
259 wxSizeEventHandler( SCH_EDIT_FRAME::OnResizeHierarchyNavigator ),
260 NULL, this );
261
262
263 // This is used temporarily to fix a client size issue on GTK that causes zoom to fit
264 // to calculate the wrong zoom size. See SCH_EDIT_FRAME::onSize().
265 Bind( wxEVT_SIZE, &SCH_EDIT_FRAME::onSize, this );
266
267 setupUnits( eeconfig() );
268
269 // Net list generator
270 DefaultExecFlags();
271
272 updateTitle();
273 m_toolManager->GetTool<SCH_NAVIGATE_TOOL>()->ResetHistory();
274
275 // Default shutdown reason until a file is loaded
276 KIPLATFORM::APP::SetShutdownBlockReason( this, _( "New schematic file is unsaved" ) );
277
278 // Init for dropping files
279 m_acceptedExts.emplace( KiCadSchematicFileExtension, &EE_ACTIONS::ddAppendFile );
280 DragAcceptFiles( true );
281
282 // Ensure the window is on top
283 Raise();
284
285 // Now that all sizes are fixed, set the initial hierarchy_pane floating position to the
286 // top-left corner of the canvas
287 wxPoint canvas_pos = GetCanvas()->GetScreenPosition();
288 hierarchy_pane.FloatingPosition( canvas_pos.x + 10, canvas_pos.y + 10 );
289}
290
291
293{
294 m_hierarchy->Disconnect( wxEVT_SIZE,
295 wxSizeEventHandler( SCH_EDIT_FRAME::OnResizeHierarchyNavigator ),
296 NULL, this );
297 // Ensure m_canvasType is up to date, to save it in config
299
300 // Close modeless dialogs
301 wxWindow* open_dlg = wxWindow::FindWindowByName( DIALOG_ERC_WINDOW_NAME );
302
303 if( open_dlg )
304 open_dlg->Close( true );
305
306 // Shutdown all running tools
307 if( m_toolManager )
308 {
310 delete m_toolManager;
311 m_toolManager = nullptr;
312 }
313
314 SetScreen( nullptr );
315
316 delete m_schematic;
317 m_schematic = nullptr;
318
319 // Close the project if we are standalone, so it gets cleaned up properly
320 if( Kiface().IsSingle() )
321 {
322 try
323 {
324 GetSettingsManager()->UnloadProject( &Prj(), false );
325 }
326 catch( const nlohmann::detail::type_error& exc )
327 {
328 // This may be overkill and could be an assertion but we are more likely to
329 // find any settings manager errors this way.
330 wxLogError( wxT( "Settings exception '%s' occurred." ), exc.what() );
331 }
332 }
333
334 delete m_hierarchy;
335}
336
337
339{
340 aEvent.Skip();
341
342 // Called when resizing the Hierarchy Navigator panel
343 // Store the current pane size
344 // It allows to retrieve the last defined pane size when switching between
345 // docked and floating pane state
346 // Note: *DO NOT* call m_auimgr.Update() here: it crashes Kicad at least on Windows
347
348 EESCHEMA_SETTINGS* cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
349 wxAuiPaneInfo& hierarchy_pane = m_auimgr.GetPane( SchematicHierarchyPaneName() );
350
351 if( cfg && m_hierarchy->IsShown() )
352 {
353 cfg->m_AuiPanels.hierarchy_panel_float_width = hierarchy_pane.floating_size.x;
354 cfg->m_AuiPanels.hierarchy_panel_float_height = hierarchy_pane.floating_size.y;
355
356 // initialize hierarchy_panel_docked_width and best size only if the hierarchy_pane
357 // width is > 0 (i.e. if its size is already set and has meaning)
358 // if it is floating, its size is not initialized (only floating_size is initialized)
359 // initializing hierarchy_pane.best_size is useful when switching to float pane and
360 // after switching to the docked pane, to retrieve the last docked pane width
361 if( hierarchy_pane.rect.width > 50 ) // 50 is a good margin
362 {
363 cfg->m_AuiPanels.hierarchy_panel_docked_width = hierarchy_pane.rect.width;
364 hierarchy_pane.best_size.x = hierarchy_pane.rect.width;
365 }
366 }
367}
368
369
371{
372 // Create the manager and dispatcher & route draw panel events to the dispatcher
375 GetCanvas()->GetViewControls(), config(), this );
376 m_actions = new EE_ACTIONS();
378
379 // Register tools
395
396 // Run the selection tool, it is supposed to be always active
398
400}
401
402
404{
406
408 SCH_EDITOR_CONDITIONS cond( this );
409
410 wxASSERT( mgr );
411
412 auto hasElements =
413 [ this ] ( const SELECTION& aSel )
414 {
415 return GetScreen() &&
416 ( !GetScreen()->Items().empty() || !SELECTION_CONDITIONS::Idle( aSel ) );
417 };
418
419 auto hierarchyNavigatorCond =
420 [ this ] ( const SELECTION& aSel )
421 {
422 return m_auimgr.GetPane( SchematicHierarchyPaneName() ).IsShown();
423 };
424
425
426#define ENABLE( x ) ACTION_CONDITIONS().Enable( x )
427#define CHECK( x ) ACTION_CONDITIONS().Check( x )
428
432
433 mgr->SetConditions( EE_ACTIONS::showHierarchy, CHECK( hierarchyNavigatorCond ) );
434
441
445
446 mgr->SetConditions( ACTIONS::cut, ENABLE( hasElements ) );
447 mgr->SetConditions( ACTIONS::copy, ENABLE( hasElements ) );
450 mgr->SetConditions( ACTIONS::doDelete, ENABLE( hasElements ) );
451 mgr->SetConditions( ACTIONS::duplicate, ENABLE( hasElements ) );
452 mgr->SetConditions( ACTIONS::selectAll, ENABLE( hasElements ) );
453
454 mgr->SetConditions( EE_ACTIONS::rotateCW, ENABLE( hasElements ) );
455 mgr->SetConditions( EE_ACTIONS::rotateCCW, ENABLE( hasElements ) );
456 mgr->SetConditions( EE_ACTIONS::mirrorH, ENABLE( hasElements ) );
457 mgr->SetConditions( EE_ACTIONS::mirrorV, ENABLE( hasElements ) );
458
463
464 if( SCRIPTING::IsWxAvailable() )
465 {
467 CHECK( cond.ScriptingConsoleVisible() ) );
468 }
469
470 auto showHiddenPinsCond =
471 [this]( const SELECTION& )
472 {
473 return GetShowAllPins();
474 };
475
476 auto showHiddenFieldsCond =
477 [this]( const SELECTION& )
478 {
480 return cfg && cfg->m_Appearance.show_hidden_fields;
481 };
482
483 auto showERCErrorsCond =
484 [this]( const SELECTION& )
485 {
487 return cfg && cfg->m_Appearance.show_erc_errors;
488 };
489
490 auto showERCWarningsCond =
491 [this]( const SELECTION& )
492 {
494 return cfg && cfg->m_Appearance.show_erc_warnings;
495 };
496
497 auto showERCExclusionsCond =
498 [this]( const SELECTION& )
499 {
501 return cfg && cfg->m_Appearance.show_erc_exclusions;
502 };
503
504 auto showOPVoltagesCond =
505 [this]( const SELECTION& )
506 {
508 return cfg && cfg->m_Appearance.show_op_voltages;
509 };
510
511 auto showOPCurrentsCond =
512 [this]( const SELECTION& )
513 {
515 return cfg && cfg->m_Appearance.show_op_currents;
516 };
517
518 auto showAnnotateAutomaticallyCond =
519 [this]( const SELECTION& )
520 {
522 return cfg && cfg->m_AnnotatePanel.automatic;
523 };
524
525 auto remapSymbolsCondition =
526 [&]( const SELECTION& aSel )
527 {
528 SCH_SCREENS schematic( Schematic().Root() );
529
530 // The remapping can only be performed on legacy projects.
531 return schematic.HasNoFullyDefinedLibIds();
532 };
533
534 auto belowRootSheetCondition =
535 [this]( const SELECTION& aSel )
536 {
537 return m_toolManager->GetTool<SCH_NAVIGATE_TOOL>()->CanGoUp();
538 };
539
540 auto navHistoryHasForward =
541 [this]( const SELECTION& aSel )
542 {
543 return m_toolManager->GetTool<SCH_NAVIGATE_TOOL>()->CanGoForward();
544 };
545
546 auto navHistoryHasBackward =
547 [this]( const SELECTION& aSel )
548 {
549 return m_toolManager->GetTool<SCH_NAVIGATE_TOOL>()->CanGoBack();
550 };
551
552 auto navSchematicHasPreviousSheet =
553 [this]( const SELECTION& aSel )
554 {
555 return m_toolManager->GetTool<SCH_NAVIGATE_TOOL>()->CanGoPrevious();
556 };
557
558 auto navSchematicHasNextSheet =
559 [this]( const SELECTION& aSel )
560 {
561 return m_toolManager->GetTool<SCH_NAVIGATE_TOOL>()->CanGoNext();
562 };
563
564 mgr->SetConditions( EE_ACTIONS::leaveSheet, ENABLE( belowRootSheetCondition ) );
565 mgr->SetConditions( EE_ACTIONS::navigateUp, ENABLE( belowRootSheetCondition ) );
566 mgr->SetConditions( EE_ACTIONS::navigateForward, ENABLE( navHistoryHasForward ) );
567 mgr->SetConditions( EE_ACTIONS::navigateBack, ENABLE( navHistoryHasBackward ) );
568 mgr->SetConditions( EE_ACTIONS::navigatePrevious, ENABLE( navSchematicHasPreviousSheet ) );
569 mgr->SetConditions( EE_ACTIONS::navigateNext, ENABLE( navSchematicHasNextSheet ) );
570 mgr->SetConditions( EE_ACTIONS::remapSymbols, ENABLE( remapSymbolsCondition ) );
571 mgr->SetConditions( EE_ACTIONS::toggleHiddenPins, CHECK( showHiddenPinsCond ) );
572 mgr->SetConditions( EE_ACTIONS::toggleHiddenFields, CHECK( showHiddenFieldsCond ) );
573 mgr->SetConditions( EE_ACTIONS::toggleERCErrors, CHECK( showERCErrorsCond ) );
574 mgr->SetConditions( EE_ACTIONS::toggleERCWarnings, CHECK( showERCWarningsCond ) );
575 mgr->SetConditions( EE_ACTIONS::toggleERCExclusions, CHECK( showERCExclusionsCond ) );
576 mgr->SetConditions( EE_ACTIONS::toggleOPVoltages, CHECK( showOPVoltagesCond ) );
577 mgr->SetConditions( EE_ACTIONS::toggleOPCurrents, CHECK( showOPCurrentsCond ) );
578 mgr->SetConditions( EE_ACTIONS::toggleAnnotateAuto, CHECK( showAnnotateAutomaticallyCond ) );
580
581
582#define CURRENT_TOOL( action ) mgr->SetConditions( action, CHECK( cond.CurrentTool( action ) ) )
583
606
607#undef CURRENT_TOOL
608#undef CHECK
609#undef ENABLE
610}
611
612
614{
615 // we cannot store a pointer to an item in the display list here since
616 // that item may be deleted, such as part of a line concatenation or other.
617 // So simply always keep a copy of the object which is to be repeated.
618
619 if( aItem )
620 {
621 m_items_to_repeat.clear();
622
623 AddCopyForRepeatItem( aItem );
624 }
625}
626
627
629{
630 // we cannot store a pointer to an item in the display list here since
631 // that item may be deleted, such as part of a line concatenation or other.
632 // So simply always keep a copy of the object which is to be repeated.
633
634 if( aItem )
635 {
636 std::unique_ptr<SCH_ITEM> repeatItem( static_cast<SCH_ITEM*>( aItem->Clone() ) );
637
638 // Clone() preserves the flags, we want 'em cleared.
639 repeatItem->ClearFlags();
640
641 m_items_to_repeat.emplace_back( std::move( repeatItem ) );
642 }
643}
644
645
647{
648 return Schematic().GetSheets().GetItem( aId );
649}
650
651
653{
655}
656
657
659{
660 return GetCurrentSheet().LastScreen();
661}
662
663
665{
666 return *m_schematic;
667}
668
669
671{
672 wxString s = GetCurrentSheet().PathHumanReadable();
673
674 return s;
675}
676
677
679{
682
683 SCH_SHEET* rootSheet = new SCH_SHEET( m_schematic );
684 m_schematic->SetRoot( rootSheet );
685
686 SCH_SCREEN* rootScreen = new SCH_SCREEN( m_schematic );
687 const_cast<KIID&>( rootSheet->m_Uuid ) = rootScreen->GetUuid();
688 m_schematic->Root().SetScreen( rootScreen );
689 SetScreen( Schematic().RootScreen() );
690
691
692 m_schematic->RootScreen()->SetFileName( wxEmptyString );
693
694 // Don't leave root page number empty
695 SCH_SHEET_PATH rootSheetPath;
696
697 rootSheetPath.push_back( rootSheet );
698 m_schematic->RootScreen()->SetPageNumber( wxT( "1" ) );
699 rootSheetPath.SetPageNumber( wxT( "1" ) );
700
701 if( GetScreen() == nullptr )
702 {
703 SCH_SCREEN* screen = new SCH_SCREEN( m_schematic );
704 SetScreen( screen );
705 }
706}
707
708
710{
711 return m_schematic->CurrentSheet();
712}
713
714
716{
717 if( aSheet != GetCurrentSheet() )
718 {
719 FocusOnItem( nullptr );
720
721 Schematic().SetCurrentSheet( aSheet );
722 GetCanvas()->DisplaySheet( aSheet.LastScreen() );
723 }
724}
725
726
728{
730
731 for( SCH_ITEM* item : screen->Items() )
732 item->ClearCaches();
733
734 for( std::pair<const wxString, LIB_SYMBOL*>& libSymbol : screen->GetLibSymbols() )
735 {
736 wxCHECK2( libSymbol.second, continue );
737 libSymbol.second->ClearCaches();
738 }
739
740 if( Schematic().Settings().m_IntersheetRefsShow )
742
743 FocusOnItem( nullptr );
744
745 GetCanvas()->DisplaySheet( GetCurrentSheet().LastScreen() );
747}
748
749
750bool SCH_EDIT_FRAME::canCloseWindow( wxCloseEvent& aEvent )
751{
752 // Exit interactive editing
753 // Note this this will commit *some* pending changes. For instance, the EE_POINT_EDITOR
754 // will cancel any drag currently in progress, but commit all changes from previous drags.
755 if( m_toolManager )
757
758 // Shutdown blocks must be determined and vetoed as early as possible
759 if( KIPLATFORM::APP::SupportsShutdownBlockReason() && aEvent.GetId() == wxEVT_QUERY_END_SESSION
760 && Schematic().GetSheets().IsModified() )
761 {
762 return false;
763 }
764
765 if( Kiface().IsSingle() )
766 {
767 auto* symbolEditor = (SYMBOL_EDIT_FRAME*) Kiway().Player( FRAME_SCH_SYMBOL_EDITOR, false );
768
769 if( symbolEditor && !symbolEditor->Close() ) // Can close symbol editor?
770 return false;
771
772 auto* symbolViewer = (SYMBOL_VIEWER_FRAME*) Kiway().Player( FRAME_SCH_VIEWER, false );
773
774 if( symbolViewer && !symbolViewer->Close() ) // Can close symbol viewer?
775 return false;
776
777 symbolViewer = (SYMBOL_VIEWER_FRAME*) Kiway().Player( FRAME_SCH_VIEWER_MODAL, false );
778
779 if( symbolViewer && !symbolViewer->Close() ) // Can close modal symbol viewer?
780 return false;
781 }
782 else
783 {
784 auto* symbolEditor = (SYMBOL_EDIT_FRAME*) Kiway().Player( FRAME_SCH_SYMBOL_EDITOR, false );
785
786 if( symbolEditor && symbolEditor->IsSymbolFromSchematic() )
787 {
788 if( !symbolEditor->CanCloseSymbolFromSchematic( true ) )
789 return false;
790 }
791 }
792
793 if( !Kiway().PlayerClose( FRAME_SIMULATOR, false ) ) // Can close the simulator?
794 return false;
795
796 // We may have gotten multiple events; don't clean up twice
797 if( !Schematic().IsValid() )
798 return false;
799
800 SCH_SHEET_LIST sheetlist = Schematic().GetSheets();
801
802 if( sheetlist.IsModified() )
803 {
804 wxFileName fileName = Schematic().RootScreen()->GetFileName();
805 wxString msg = _( "Save changes to '%s' before closing?" );
806
807 if( !HandleUnsavedChanges( this, wxString::Format( msg, fileName.GetFullName() ),
808 [&]() -> bool
809 {
810 return SaveProject();
811 } ) )
812 {
813 return false;
814 }
815 }
816
817 // Close modeless dialogs. They're trouble when they get destroyed after the frame and/or
818 // board.
819 wxWindow* open_dlg = wxWindow::FindWindowByName( DIALOG_ERC_WINDOW_NAME );
820
821 if( open_dlg )
822 open_dlg->Close( true );
823
824 return true;
825}
826
827
829{
830 SCH_SHEET_LIST sheetlist = Schematic().GetSheets();
831
832 // Shutdown all running tools
833 if( m_toolManager )
835
836 // Close the find dialog and preserve its setting if it is displayed.
838 {
841
842 m_findReplaceDialog->Destroy();
843 m_findReplaceDialog = nullptr;
844 }
845
846 wxAuiPaneInfo& hierarchy_pane = m_auimgr.GetPane( SchematicHierarchyPaneName() );
847
848 if( hierarchy_pane.IsShown() && hierarchy_pane.IsFloating() )
849 {
850 hierarchy_pane.Show( false );
851 m_auimgr.Update();
852 }
853
854 SCH_SCREENS screens( Schematic().Root() );
855 wxFileName fn;
856
857 for( SCH_SCREEN* screen = screens.GetFirst(); screen != nullptr; screen = screens.GetNext() )
858 {
859 fn = Prj().AbsolutePath( screen->GetFileName() );
860
861 // Auto save file name is the normal file name prepended with GetAutoSaveFilePrefix().
862 fn.SetName( GetAutoSaveFilePrefix() + fn.GetName() );
863
864 if( fn.IsFileWritable() )
865 wxRemoveFile( fn.GetFullPath() );
866 }
867
868 wxFileName tmpFn = Prj().GetProjectFullName();
869 wxFileName autoSaveFileName( tmpFn.GetPath(), getAutoSaveFileName() );
870
871 if( autoSaveFileName.IsFileWritable() )
872 wxRemoveFile( autoSaveFileName.GetFullPath() );
873
874 sheetlist.ClearModifyStatus();
875
876 wxString fileName = Prj().AbsolutePath( Schematic().RootScreen()->GetFileName() );
877
878 if( !Schematic().GetFileName().IsEmpty() && !Schematic().RootScreen()->IsEmpty() )
879 UpdateFileHistory( fileName );
880
881 // Make sure local settings are persisted
883
885
886 // all sub sheets are deleted, only the main sheet is usable
888
889 // Clear view before destroying schematic as repaints depend on schematic being valid
890 SetScreen( nullptr );
891
892 Schematic().Reset();
893
894 Destroy();
895}
896
897
899{
900 SCH_SHEET_LIST sheetList = Schematic().GetSheets();
901 ERC_SETTINGS& ercSettings = Schematic().ErcSettings();
902
903 ercSettings.m_ErcExclusions.clear();
904
905 for( unsigned i = 0; i < sheetList.size(); i++ )
906 {
907 for( SCH_ITEM* item : sheetList[i].LastScreen()->Items().OfType( SCH_MARKER_T ) )
908 {
909 SCH_MARKER* marker = static_cast<SCH_MARKER*>( item );
910
911 if( marker->IsExcluded() )
912 ercSettings.m_ErcExclusions.insert( marker->Serialize() );
913 }
914 }
915}
916
917
919{
920 SCH_SHEET_LIST sheetList = Schematic().GetSheets();
921
922 for( SCH_MARKER* marker : Schematic().ResolveERCExclusions() )
923 {
924 SCH_SHEET_PATH errorPath;
925 ignore_unused( sheetList.GetItem( marker->GetRCItem()->GetMainItemID(), &errorPath ) );
926
927 if( errorPath.LastScreen() )
928 errorPath.LastScreen()->Append( marker );
929 else
930 Schematic().RootScreen()->Append( marker );
931 }
932}
933
934
936{
937 return Schematic().ErcSettings().GetSeverity( aErrorCode );
938}
939
940
942{
944
945 wxASSERT( GetScreen() );
946
947 if( !GetScreen() )
948 return;
949
951 m_autoSaveRequired = true;
952
954
955 GetCanvas()->Refresh();
957
958 if( !GetTitle().StartsWith( wxS( "*" ) ) )
959 updateTitle();
960}
961
962
963void SCH_EDIT_FRAME::OnUpdatePCB( wxCommandEvent& event )
964{
965 if( Kiface().IsSingle() )
966 {
967 DisplayError( this, _( "Cannot update the PCB, because the Schematic Editor is opened"
968 " in stand-alone mode. In order to create/update PCBs from"
969 " schematics, launch the KiCad shell and create a project." ) );
970 return;
971 }
972
973 KIWAY_PLAYER* frame = Kiway().Player( FRAME_PCB_EDITOR, false );
974
975 if( !frame )
976 {
977 wxFileName fn = Prj().GetProjectFullName();
978 fn.SetExt( PcbFileExtension );
979
980 frame = Kiway().Player( FRAME_PCB_EDITOR, true );
981
982 // If Kiway() cannot create the Pcbnew frame, it shows a error message, and
983 // frame is null
984 if( !frame )
985 return;
986
987 frame->OpenProjectFiles( std::vector<wxString>( 1, fn.GetFullPath() ) );
988 }
989
990 if( !frame->IsVisible() )
991 frame->Show( true );
992
993 // On Windows, Raise() does not bring the window on screen, when iconized
994 if( frame->IsIconized() )
995 frame->Iconize( false );
996
997 frame->Raise();
998
999 std::string payload;
1001}
1002
1003
1005{
1006 m_toolManager->GetTool<SCH_NAVIGATE_TOOL>()->CleanHistory();
1008}
1009
1010
1012{
1014}
1015
1016
1018{
1019 wxString findString;
1020
1021 EE_SELECTION& selection = m_toolManager->GetTool<EE_SELECTION_TOOL>()->GetSelection();
1022
1023 if( selection.Size() == 1 )
1024 {
1025 EDA_ITEM* front = selection.Front();
1026
1027 switch( front->Type() )
1028 {
1029 case SCH_SYMBOL_T:
1030 findString = static_cast<SCH_SYMBOL*>( front )->GetValueFieldText( true );
1031 break;
1032
1033 case SCH_FIELD_T:
1034 findString = static_cast<SCH_FIELD*>( front )->GetShownText();
1035 break;
1036
1037 case SCH_LABEL_T:
1038 case SCH_GLOBAL_LABEL_T:
1039 case SCH_HIER_LABEL_T:
1040 case SCH_SHEET_PIN_T:
1041 findString = static_cast<SCH_LABEL_BASE*>( front )->GetShownText();
1042 break;
1043
1044 case SCH_TEXT_T:
1045 findString = static_cast<SCH_TEXT*>( front )->GetShownText();
1046
1047 if( findString.Contains( wxT( "\n" ) ) )
1048 findString = findString.Before( '\n' );
1049
1050 break;
1051
1052 default:
1053 break;
1054 }
1055 }
1056
1058 m_findReplaceDialog->Destroy();
1059
1061 this, static_cast<SCH_SEARCH_DATA*>( m_findReplaceData.get() ), wxDefaultPosition,
1062 wxDefaultSize, aReplace ? wxFR_REPLACEDIALOG : 0 );
1063
1066 m_findReplaceDialog->Show( true );
1067}
1068
1069
1070void SCH_EDIT_FRAME::ShowFindReplaceStatus( const wxString& aMsg, int aStatusTime )
1071{
1072 // Prepare the infobar, since we don't know its state
1075
1076 m_infoBar->ShowMessageFor( aMsg, aStatusTime, wxICON_INFORMATION );
1077}
1078
1079
1081{
1082 m_infoBar->Dismiss();
1083}
1084
1085
1087{
1090
1091 m_findReplaceDialog->Destroy();
1092 m_findReplaceDialog = nullptr;
1093
1095}
1096
1097
1098void SCH_EDIT_FRAME::OnLoadFile( wxCommandEvent& event )
1099{
1100 wxString fn = GetFileFromHistory( event.GetId(), _( "Schematic" ) );
1101
1102 if( fn.size() )
1103 OpenProjectFiles( std::vector<wxString>( 1, fn ) );
1104}
1105
1106
1107void SCH_EDIT_FRAME::OnClearFileHistory( wxCommandEvent& aEvent )
1108{
1110}
1111
1112
1114{
1115 wxString pro_dir = m_mruPath;
1116
1117 wxFileDialog dlg( this, _( "New Schematic" ), pro_dir, wxEmptyString,
1118 KiCadSchematicFileWildcard(), wxFD_SAVE );
1119
1120 if( dlg.ShowModal() != wxID_CANCEL )
1121 {
1122 // Enforce the extension, wxFileDialog is inept.
1123 wxFileName create_me = dlg.GetPath();
1124 create_me.SetExt( KiCadSchematicFileExtension );
1125
1126 if( create_me.FileExists() )
1127 {
1128 wxString msg;
1129 msg.Printf( _( "Schematic file '%s' already exists." ), create_me.GetFullName() );
1130 DisplayError( this, msg );
1131 return ;
1132 }
1133
1134 // OpenProjectFiles() requires absolute
1135 wxASSERT_MSG( create_me.IsAbsolute(), wxS( "wxFileDialog returned non-absolute path" ) );
1136
1137 OpenProjectFiles( std::vector<wxString>( 1, create_me.GetFullPath() ), KICTL_CREATE );
1138 m_mruPath = create_me.GetPath();
1139 }
1140}
1141
1142
1144{
1145 wxString pro_dir = m_mruPath;
1146 wxString wildcards = AllSchematicFilesWildcard()
1147 + wxS( "|" ) + KiCadSchematicFileWildcard()
1148 + wxS( "|" ) + LegacySchematicFileWildcard();
1149
1150 wxFileDialog dlg( this, _( "Open Schematic" ), pro_dir, wxEmptyString,
1151 wildcards, wxFD_OPEN | wxFD_FILE_MUST_EXIST );
1152
1153 if( dlg.ShowModal() != wxID_CANCEL )
1154 {
1155 OpenProjectFiles( std::vector<wxString>( 1, dlg.GetPath() ) );
1157 }
1158}
1159
1160
1161void SCH_EDIT_FRAME::OnOpenPcbnew( wxCommandEvent& event )
1162{
1163 wxFileName kicad_board = Prj().AbsolutePath( Schematic().GetFileName() );
1164
1165 if( kicad_board.IsOk() && !Schematic().GetFileName().IsEmpty() )
1166 {
1167 kicad_board.SetExt( PcbFileExtension );
1168 wxFileName legacy_board( kicad_board );
1169 legacy_board.SetExt( LegacyPcbFileExtension );
1170 wxFileName& boardfn = legacy_board;
1171
1172 if( !legacy_board.FileExists() || kicad_board.FileExists() )
1173 boardfn = kicad_board;
1174
1175 if( Kiface().IsSingle() )
1176 {
1177 ExecuteFile( PCBNEW_EXE, boardfn.GetFullPath() );
1178 }
1179 else
1180 {
1181 KIWAY_PLAYER* frame = Kiway().Player( FRAME_PCB_EDITOR, false );
1182
1183 if( !frame )
1184 {
1185 frame = Kiway().Player( FRAME_PCB_EDITOR, true );
1186
1187 // frame can be null if Cvpcb cannot be run. No need to show a warning
1188 // Kiway() generates the error messages
1189 if( !frame )
1190 return;
1191
1192 frame->OpenProjectFiles( std::vector<wxString>( 1, boardfn.GetFullPath() ) );
1193 }
1194
1195 if( !frame->IsVisible() )
1196 frame->Show( true );
1197
1198 // On Windows, Raise() does not bring the window on screen, when iconized
1199 if( frame->IsIconized() )
1200 frame->Iconize( false );
1201
1202 frame->Raise();
1203 }
1204 }
1205 else
1206 {
1207 // If we are running inside a project, it should be impossible for this case to happen
1208 wxASSERT( Kiface().IsSingle() );
1210 }
1211}
1212
1213
1214void SCH_EDIT_FRAME::OnOpenCvpcb( wxCommandEvent& event )
1215{
1216 wxFileName fn = Prj().AbsolutePath( Schematic().GetFileName() );
1217 fn.SetExt( NetlistFileExtension );
1218
1219 if( !ReadyToNetlist( _( "Assigning footprints requires a fully annotated schematic." ) ) )
1220 return;
1221
1222 try
1223 {
1224 KIWAY_PLAYER* player = Kiway().Player( FRAME_CVPCB, false ); // test open already.
1225
1226 if( !player )
1227 {
1228 player = Kiway().Player( FRAME_CVPCB, true );
1229
1230 // player can be null if Cvpcb cannot be run. No need to show a warning
1231 // Kiway() generates the error messages
1232 if( !player )
1233 return;
1234
1235 player->Show( true );
1236 }
1237
1239
1240 player->Raise();
1241 }
1242 catch( const IO_ERROR& )
1243 {
1244 DisplayError( this, _( "Could not open CvPcb" ) );
1245 }
1246}
1247
1248
1249void SCH_EDIT_FRAME::OnExit( wxCommandEvent& event )
1250{
1251 if( event.GetId() == wxID_EXIT )
1252 Kiway().OnKiCadExit();
1253
1254 if( event.GetId() == wxID_CLOSE || Kiface().IsSingle() )
1255 Close( false );
1256}
1257
1258
1260{
1261 wxString fileName = Prj().AbsolutePath( GetScreen()->GetFileName() );
1262
1263 const wxBrush& brush =
1264 wxBrush( GetColorSettings()->GetColor( LAYER_SCHEMATIC_BACKGROUND ).ToColour() );
1265 aSettings->GetPrintDC()->SetBackground( brush );
1266 aSettings->GetPrintDC()->Clear();
1267
1268 aSettings->GetPrintDC()->SetLogicalFunction( wxCOPY );
1269 GetScreen()->Print( aSettings );
1270 PrintDrawingSheet( aSettings, GetScreen(), Schematic().GetProperties(), schIUScale.IU_PER_MILS,
1271 fileName );
1272}
1273
1274
1276{
1278 SIM_LIB_MGR simLibMgr( &Prj() );
1279
1280 // Patch for bug early in V7.99 dev
1281 if( settings.m_OPO_VRange.EndsWith( 'A' ) )
1282 settings.m_OPO_VRange[ settings.m_OPO_VRange.Length() - 1 ] = 'V';
1283
1284 // Update items which may have ${OP} text variables
1285 //
1287 [&]( KIGFX::VIEW_ITEM* aItem ) -> int
1288 {
1289 int flags = 0;
1290
1291 if( SCH_ITEM* item = dynamic_cast<SCH_ITEM*>( aItem ) )
1292 {
1293 item->RunOnChildren(
1294 [&flags]( SCH_ITEM* aChild )
1295 {
1296 EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( aChild );
1297
1298 if( text && text->HasTextVars() )
1299 {
1300 text->ClearRenderCache();
1301 text->ClearBoundingBoxCache();
1302 flags |= KIGFX::GEOMETRY | KIGFX::REPAINT;
1303 }
1304 } );
1305
1306 EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( aItem );
1307
1308 if( text && text->HasTextVars() )
1309 {
1310 text->ClearRenderCache();
1311 text->ClearBoundingBoxCache();
1313 }
1314 }
1315
1316 return flags;
1317 } );
1318
1319 // Update OP overlay items
1320 //
1321 for( SCH_ITEM* item : GetScreen()->Items() )
1322 {
1323 if( item->Type() == SCH_LINE_T )
1324 {
1325 SCH_LINE* line = static_cast<SCH_LINE*>( item );
1326
1327 if( !line->GetOperatingPoint().IsEmpty() )
1328 GetCanvas()->GetView()->Update( line );
1329
1330 line->SetOperatingPoint( wxEmptyString );
1331 // update value from netlist, below
1332 }
1333 else if( item->Type() == SCH_SYMBOL_T )
1334 {
1335 SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( item );
1336 wxString ref = symbol->GetRef( &GetCurrentSheet() );
1337 std::vector<SCH_PIN*> pins = symbol->GetPins( &GetCurrentSheet() );
1338
1339 for( SCH_PIN* pin : pins )
1340 {
1341 if( !pin->GetOperatingPoint().IsEmpty() )
1342 GetCanvas()->GetView()->Update( pin );
1343
1344 pin->SetOperatingPoint( wxEmptyString );
1345 }
1346
1347 if( pins.size() == 2 )
1348 {
1349 wxString op = m_schematic->GetOperatingPoint( ref, settings.m_OPO_IPrecision,
1350 settings.m_OPO_IRange );
1351
1352 if( !op.IsEmpty() && op != wxS( "--" ) && op != wxS( "?" ) )
1353 {
1354 pins[0]->SetOperatingPoint( op );
1355 GetCanvas()->GetView()->Update( symbol );
1356 }
1357 }
1358 else
1359 {
1360 SIM_MODEL& model = simLibMgr.CreateModel( &GetCurrentSheet(), *symbol ).model;
1361
1362 SPICE_ITEM spiceItem;
1363 spiceItem.refName = ref;
1364 ref = model.SpiceGenerator().ItemName( spiceItem );
1365
1366 for( const auto& modelPin : model.GetPins() )
1367 {
1368 SCH_PIN* symbolPin = symbol->GetPin( modelPin.get().symbolPinNumber );
1369 wxString signalName = ref + wxS( ":" ) + modelPin.get().name;
1370 wxString op = m_schematic->GetOperatingPoint( signalName,
1371 settings.m_OPO_IPrecision,
1372 settings.m_OPO_IRange );
1373
1374 if( symbolPin && !op.IsEmpty() && op != wxS( "--" ) && op != wxS( "?" ) )
1375 {
1376 symbolPin->SetOperatingPoint( op );
1377 GetCanvas()->GetView()->Update( symbol );
1378 }
1379 }
1380 }
1381 }
1382 }
1383
1384 for( const auto& [ key, subgraphList ] : m_schematic->m_connectionGraph->GetNetMap() )
1385 {
1386 wxString op = m_schematic->GetOperatingPoint( key.Name, settings.m_OPO_VPrecision,
1387 settings.m_OPO_VRange );
1388
1389 if( !op.IsEmpty() && op != wxS( "--" ) && op != wxS( "?" ) )
1390 {
1391 for( CONNECTION_SUBGRAPH* subgraph : subgraphList )
1392 {
1393 SCH_LINE* longestWire = nullptr;
1394 double length = 0.0;
1395
1396 for( SCH_ITEM* item : subgraph->GetItems() )
1397 {
1398 if( item->IsType( { SCH_ITEM_LOCATE_WIRE_T } ) )
1399 {
1400 SCH_LINE* wire = static_cast<SCH_LINE*>( item );
1401
1402 if( wire->GetLength() > length )
1403 {
1404 longestWire = wire;
1405 length = wire->GetLength();
1406 }
1407 }
1408 }
1409
1410 if( longestWire )
1411 {
1412 longestWire->SetOperatingPoint( op );
1413 GetCanvas()->GetView()->Update( longestWire );
1414 }
1415 }
1416 }
1417 }
1418}
1419
1420
1422{
1423 if( aItem->IsType( { SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T } ) )
1424 {
1425 auto label = static_cast<SCH_LABEL_BASE*>( aItem );
1426 if( label->AutoRotateOnPlacement() )
1427 {
1428 auto textSpin = aScreen->GetLabelOrientationForPoint(
1429 label->GetPosition(), label->GetTextSpinStyle(), &GetCurrentSheet() );
1430 if( textSpin != label->GetTextSpinStyle() )
1431 {
1432 label->SetTextSpinStyle( textSpin );
1433 for( SCH_ITEM* item : aScreen->Items().OfType( SCH_GLOBAL_LABEL_T ) )
1434 {
1435 SCH_LABEL_BASE* otherLabel = static_cast<SCH_LABEL_BASE*>( item );
1436 if( otherLabel != label && otherLabel->GetText() == label->GetText() )
1437 {
1438 otherLabel->AutoplaceFields( aScreen, false );
1439 }
1440 }
1441 }
1442 }
1443 }
1444}
1445
1446
1448 bool aUndoAppend )
1449{
1450 wxCHECK_RET( aItem != nullptr, wxT( "Cannot add null item to list." ) );
1451
1452 SCH_SHEET* parentSheet = nullptr;
1453 SCH_SYMBOL* parentSymbol = nullptr;
1454 SCH_ITEM* undoItem = aItem;
1455
1456 if( aItem->Type() == SCH_SHEET_PIN_T )
1457 {
1458 parentSheet = (SCH_SHEET*) aItem->GetParent();
1459
1460 wxCHECK_RET( parentSheet && parentSheet->Type() == SCH_SHEET_T,
1461 wxT( "Cannot place sheet pin in invalid schematic sheet." ) );
1462
1463 undoItem = parentSheet;
1464 }
1465
1466 else if( aItem->Type() == SCH_FIELD_T )
1467 {
1468 parentSymbol = (SCH_SYMBOL*) aItem->GetParent();
1469
1470 wxCHECK_RET( parentSymbol && parentSymbol->Type() == SCH_SYMBOL_T,
1471 wxT( "Cannot place field in invalid schematic symbol." ) );
1472
1473 undoItem = parentSymbol;
1474 }
1475
1476 if( aItem->IsNew() )
1477 {
1478 if( aItem->Type() == SCH_SHEET_PIN_T )
1479 {
1480 // Sheet pins are owned by their parent sheet.
1481 SaveCopyInUndoList( aScreen, undoItem, UNDO_REDO::CHANGED, aUndoAppend );
1482
1483 parentSheet->AddPin( (SCH_SHEET_PIN*) aItem );
1484 }
1485 else if( aItem->Type() == SCH_FIELD_T )
1486 {
1487 // Symbol fields are also owned by their parent, but new symbol fields are
1488 // handled elsewhere.
1489 wxLogMessage( wxT( "addCurrentItemToScreen: unexpected new SCH_FIELD" ) );
1490 }
1491 else
1492 {
1493 if( !aScreen->CheckIfOnDrawList( aItem ) ) // don't want a loop!
1494 AddToScreen( aItem, aScreen );
1495
1496 SaveCopyForRepeatItem( aItem );
1497 SaveCopyInUndoList( aScreen, undoItem, UNDO_REDO::NEWITEM, aUndoAppend );
1498 }
1499
1500 // Update connectivity info for new item
1501 if( !aItem->IsMoving() && aItem->IsConnectable() )
1503 }
1504
1505 aItem->ClearFlags( IS_NEW );
1506
1507 aScreen->SetContentModified();
1508 UpdateItem( aItem );
1509
1510 if( !aItem->IsMoving() && aItem->IsConnectable() )
1511 {
1512 std::vector<VECTOR2I> pts = aItem->GetConnectionPoints();
1513
1514 bool connected = true;
1515 for( auto i = pts.begin(); i != pts.end(); i++ )
1516 {
1517 for( auto j = i + 1; j != pts.end(); j++ )
1518 TrimWire( *i, *j );
1519
1520 if( aScreen->IsExplicitJunctionNeeded( *i ) )
1521 {
1522 AddJunction( aScreen, *i, true, false );
1523 connected = true;
1524 }
1525 }
1526
1527 if( connected )
1528 {
1529 AutoRotateItem( aScreen, aItem );
1530 }
1531
1533
1534 for( SCH_ITEM* item : aItem->ConnectedItems( GetCurrentSheet() ) )
1535 UpdateItem( item );
1536 }
1537
1538 aItem->ClearEditFlags();
1539 GetCanvas()->Refresh();
1540}
1541
1542
1544{
1545 SCH_SCREEN* screen = GetScreen();
1546
1547 wxCHECK( screen, /* void */ );
1548
1549 wxString title;
1550
1551 if( !screen->GetFileName().IsEmpty() )
1552 {
1553 wxFileName fn( Prj().AbsolutePath( screen->GetFileName() ) );
1554 bool readOnly = false;
1555 bool unsaved = false;
1556
1557 if( fn.IsOk() && screen->FileExists() )
1558 readOnly = screen->IsReadOnly();
1559 else
1560 unsaved = true;
1561
1562 if( IsContentModified() )
1563 title = wxT( "*" );
1564
1565 title += fn.GetName();
1566
1567 wxString sheetPath = GetCurrentSheet().PathHumanReadable( false, true );
1568
1569 if( sheetPath != title )
1570 title += wxString::Format( wxT( " [%s]" ), sheetPath );
1571
1572 if( readOnly )
1573 title += wxS( " " ) + _( "[Read Only]" );
1574
1575 if( unsaved )
1576 title += wxS( " " ) + _( "[Unsaved]" );
1577 }
1578 else
1579 {
1580 title = _( "[no schematic loaded]" );
1581 }
1582
1583 title += wxT( " \u2014 " ) + _( "Schematic Editor" );
1584
1585 SetTitle( title );
1586}
1587
1588
1590{
1592 GetScreen()->m_zoomInitialized = true;
1593}
1594
1595
1597{
1598 const SCH_CONNECTION* highlight = GetHighlightedConnection();
1599 SCH_ITEM* highlightedItem = nullptr;
1600 SCH_SHEET_PATH highlightPath;
1601
1602 if( highlight )
1603 {
1604 highlightPath = highlight->LocalSheet();
1605 highlightedItem = dynamic_cast<SCH_ITEM*>( GetItem( highlight->Parent()->m_Uuid ) );
1606 }
1607
1608 SCHEMATIC_SETTINGS& settings = Schematic().Settings();
1610#ifdef PROFILE
1611 PROF_TIMER timer;
1612#endif
1613
1614 // Ensure schematic graph is accurate
1615 if( aCleanupFlags == LOCAL_CLEANUP )
1616 {
1618 }
1619 else if( aCleanupFlags == GLOBAL_CLEANUP )
1620 {
1621 for( const SCH_SHEET_PATH& sheet : list )
1622 SchematicCleanUp( sheet.LastScreen() );
1623 }
1624
1625#ifdef PROFILE
1626 timer.Stop();
1627 wxLogTrace( "CONN_PROFILE", "SchematicCleanUp() %0.4f ms", timer.msecs() );
1628#endif
1629
1630 if( settings.m_IntersheetRefsShow )
1632
1633 std::function<void( SCH_ITEM* )> changeHandler =
1634 [&]( SCH_ITEM* aChangedItem ) -> void
1635 {
1636 GetCanvas()->GetView()->Update( aChangedItem, KIGFX::REPAINT );
1637 };
1638
1639 Schematic().ConnectionGraph()->Recalculate( list, true, &changeHandler );
1640
1642 [&]( KIGFX::VIEW_ITEM* aItem ) -> int
1643 {
1644 int flags = 0;
1645 SCH_ITEM* item = dynamic_cast<SCH_ITEM*>( aItem );
1646 SCH_CONNECTION* connection = item ? item->Connection() : nullptr;
1647
1648 if( connection && connection->HasDriverChanged() )
1649 {
1650 connection->ClearDriverChanged();
1651 flags |= KIGFX::REPAINT;
1652 }
1653
1654 if( item )
1655 {
1656 item->RunOnChildren(
1657 [&flags]( SCH_ITEM* aChild )
1658 {
1659 EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( aChild );
1660
1661 if( text && text->HasTextVars() )
1662 {
1663 text->ClearRenderCache();
1664 text->ClearBoundingBoxCache();
1666 }
1667 } );
1668
1669 EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( aItem );
1670
1671 if( text && text->HasTextVars() )
1672 {
1673 text->ClearRenderCache();
1674 text->ClearBoundingBoxCache();
1676 }
1677
1678 if( flags & KIGFX::GEOMETRY )
1679 GetScreen()->Update( item, false ); // Refresh RTree
1680 }
1681
1682 return flags;
1683 } );
1684
1685 if( highlightedItem )
1686 SetHighlightedConnection( highlightedItem->Connection( &highlightPath ) );
1687}
1688
1689
1691{
1693 {
1694 for( SCH_FIELD& field : label->GetFields() )
1695 field.ClearBoundingBoxCache();
1696
1697 label->ClearBoundingBoxCache();
1698 GetCanvas()->GetView()->Update( label );
1699 } );
1700}
1701
1702
1704{
1706
1708}
1709
1710
1711void SCH_EDIT_FRAME::CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged )
1712{
1713 SCH_BASE_FRAME::CommonSettingsChanged( aEnvVarsChanged, aTextVarsChanged );
1714
1715 SCHEMATIC_SETTINGS& settings = Schematic().Settings();
1716
1718
1720
1721 EESCHEMA_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<EESCHEMA_SETTINGS>();
1724
1725 KIGFX::VIEW* view = GetCanvas()->GetView();
1731
1733
1734 settings.m_TemplateFieldNames.DeleteAllFieldNameTemplates( true /* global */ );
1735
1736 if( !cfg->m_Drawing.field_names.IsEmpty() )
1738
1740
1741 for( SCH_ITEM* item : screen->Items() )
1742 item->ClearCaches();
1743
1744 for( std::pair<const wxString, LIB_SYMBOL*>& libSymbol : screen->GetLibSymbols() )
1745 libSymbol.second->ClearCaches();
1746
1748
1750 Layout();
1751 SendSizeEvent();
1752}
1753
1754
1756{
1757 // Store the current zoom level into the current screen before calling
1758 // DisplayCurrentSheet() that set the zoom to GetScreen()->m_LastZoomLevel
1760 // Rebuild the sheet view (draw area and any other items):
1762}
1763
1764
1766{
1767 // call my base class
1769
1770 // tooltips in toolbars
1772
1773 m_auimgr.GetPane( m_hierarchy ).Caption( _( "Schematic Hierarchy" ) );
1774 m_auimgr.Update();
1776
1777 // status bar
1779
1780 updateTitle();
1781
1782 // This ugly hack is to fix an option(left) toolbar update bug that seems to only affect
1783 // windows. See https://bugs.launchpad.net/kicad/+bug/1816492. For some reason, calling
1784 // wxWindow::Refresh() does not resolve the issue. Only a resize event seems to force the
1785 // toolbar to update correctly.
1786#if defined( __WXMSW__ )
1787 PostSizeEvent();
1788#endif
1789}
1790
1791
1793{
1794 if( const SCH_CONNECTION* conn = GetHighlightedConnection() )
1795 {
1796 SetStatusText( wxString::Format( _( "Highlighted net: %s" ),
1797 UnescapeString( conn->Name() ) ) );
1798 }
1799 else
1800 {
1801 SetStatusText( wxT( "" ) );
1802 }
1803}
1804
1805
1807{
1808 if( m_toolManager )
1810
1811 SCH_BASE_FRAME::SetScreen( aScreen );
1812 GetCanvas()->DisplaySheet( static_cast<SCH_SCREEN*>( aScreen ) );
1813
1814 if( m_toolManager )
1816}
1817
1818
1819const BOX2I SCH_EDIT_FRAME::GetDocumentExtents( bool aIncludeAllVisible ) const
1820{
1821 BOX2I bBoxDoc;
1822
1823 if( aIncludeAllVisible )
1824 {
1825 // Get the whole page size and return that
1828 bBoxDoc = BOX2I( VECTOR2I( 0, 0 ), VECTOR2I( sizeX, sizeY ) );
1829 }
1830 else
1831 {
1832 // Get current drawing-sheet in a form we can compare to an EDA_ITEM
1834 EDA_ITEM* dsAsItem = static_cast<EDA_ITEM*>( ds );
1835
1836 // Calc the bounding box of all items on screen except the page border
1837 for( EDA_ITEM* item : GetScreen()->Items() )
1838 {
1839 if( item != dsAsItem ) // Ignore the drawing-sheet itself
1840 bBoxDoc.Merge( item->GetBoundingBox() );
1841 }
1842 }
1843
1844 return bBoxDoc;
1845}
1846
1847
1849{
1850 return Schematic().GetSheets().IsModified();
1851}
1852
1853
1855{
1856 EESCHEMA_SETTINGS* cfg = eeconfig();
1857 return cfg && cfg->m_Appearance.show_hidden_pins;
1858}
1859
1860
1862{
1863 static KIID lastBrightenedItemID( niluuid );
1864
1865 SCH_SHEET_LIST sheetList = Schematic().GetSheets();
1867 SCH_ITEM* lastItem = sheetList.GetItem( lastBrightenedItemID, &dummy );
1868
1869 if( lastItem && lastItem != aItem )
1870 {
1871 lastItem->ClearBrightened();
1872
1873 UpdateItem( lastItem );
1874 lastBrightenedItemID = niluuid;
1875 }
1876
1877 if( aItem )
1878 {
1879 if( !aItem->IsBrightened() )
1880 {
1881 aItem->SetBrightened();
1882
1883 UpdateItem( aItem );
1884 lastBrightenedItemID = aItem->m_Uuid;
1885 }
1886
1888 }
1889}
1890
1891
1893{
1894 return Schematic().GetFileName();
1895}
1896
1897
1899{
1900 return m_toolManager->GetTool<EE_SELECTION_TOOL>()->GetSelection();
1901}
1902
1903
1904void SCH_EDIT_FRAME::onSize( wxSizeEvent& aEvent )
1905{
1906 if( IsShown() )
1907 {
1908 // We only need this until the frame is done resizing and the final client size is
1909 // established.
1910 Unbind( wxEVT_SIZE, &SCH_EDIT_FRAME::onSize, this );
1912 }
1913
1914 // Skip() is called in the base class.
1915 EDA_DRAW_FRAME::OnSize( aEvent );
1916}
1917
1918
1920 const KIID& aSchematicSymbolUUID )
1921{
1922 bool appendToUndo = false;
1923
1924 SCH_SHEET_PATH principalPath;
1925 SCH_ITEM* item = Schematic().GetSheets().GetItem( aSchematicSymbolUUID, &principalPath );
1926 SCH_SYMBOL* principalSymbol = dynamic_cast<SCH_SYMBOL*>( item );
1927
1928 if( !principalSymbol )
1929 return;
1930
1931 wxString principalRef;
1932
1933 if( principalSymbol->IsAnnotated( &principalPath ) )
1934 principalRef = principalSymbol->GetRef( &principalPath, false );
1935
1936 std::vector< std::pair<SCH_SYMBOL*, SCH_SHEET_PATH> > otherUnits;
1937
1938 for( const SCH_SHEET_PATH& path : Schematic().GetSheets() )
1939 {
1940 for( SCH_ITEM* candidate : path.LastScreen()->Items().OfType( SCH_SYMBOL_T ) )
1941 {
1942 SCH_SYMBOL* candidateSymbol = static_cast<SCH_SYMBOL*>( candidate );
1943
1944 if( candidateSymbol == principalSymbol
1945 || ( candidateSymbol->IsAnnotated( &path )
1946 && candidateSymbol->GetRef( &path, false ) == principalRef ) )
1947 {
1948 otherUnits.emplace_back( candidateSymbol, path );
1949 }
1950 }
1951 }
1952
1953 for( auto& [ otherUnit, path ] : otherUnits )
1954 {
1955 // This needs to be done before the LIB_SYMBOL is changed to prevent stale
1956 // library symbols in the schematic file.
1957 path.LastScreen()->Remove( otherUnit );
1958
1959 if( !otherUnit->IsNew() )
1960 {
1961 SaveCopyInUndoList( path.LastScreen(), otherUnit, UNDO_REDO::CHANGED, appendToUndo );
1962 appendToUndo = true;
1963 }
1964
1965 otherUnit->SetLibSymbol( aSymbol.Flatten().release() );
1966 otherUnit->UpdateFields( &GetCurrentSheet(),
1967 true, /* update style */
1968 true, /* update ref */
1969 true, /* update other fields */
1970 false, /* reset ref */
1971 false /* reset other fields */ );
1972
1973 path.LastScreen()->Append( otherUnit );
1974 GetCanvas()->GetView()->Update( otherUnit );
1975 }
1976
1977 GetCanvas()->Refresh();
1978 OnModify();
1979}
1980
1981
1982void SCH_EDIT_FRAME::UpdateItem( EDA_ITEM* aItem, bool isAddOrDelete, bool aUpdateRtree )
1983{
1984 SCH_BASE_FRAME::UpdateItem( aItem, isAddOrDelete, aUpdateRtree );
1985
1986 if( SCH_ITEM* sch_item = dynamic_cast<SCH_ITEM*>( aItem ) )
1987 sch_item->ClearCaches();
1988}
1989
1990
1992{
1996
1997 wxASSERT( screen );
1998
1999 if( m_toolManager )
2001
2002 SCH_BASE_FRAME::SetScreen( screen );
2003
2004 if( m_toolManager )
2006
2007 // update the References
2011
2013
2014 auto visit =
2015 [&]( EDA_ITEM* item )
2016 {
2018 && !m_findReplaceData->findString.IsEmpty()
2019 && item->Matches( *m_findReplaceData, &GetCurrentSheet() ) )
2020 {
2021 item->SetForceVisible( true );
2022 selectionTool->BrightenItem( item );
2023 }
2024 else if( item->IsBrightened() )
2025 {
2026 item->SetForceVisible( false );
2027 selectionTool->UnbrightenItem( item );
2028 }
2029 };
2030
2031 for( SCH_ITEM* item : screen->Items() )
2032 {
2033 visit( item );
2034
2035 item->RunOnChildren(
2036 [&]( SCH_ITEM* aChild )
2037 {
2038 visit( aChild );
2039 } );
2040 }
2041
2042 if( !screen->m_zoomInitialized )
2043 {
2045 }
2046 else
2047 {
2048 // Set zoom to last used in this screen
2049 GetCanvas()->GetView()->SetScale( GetScreen()->m_LastZoomLevel );
2050 GetCanvas()->GetView()->SetCenter( GetScreen()->m_ScrollCenter );
2051 }
2052
2053 updateTitle();
2054
2055 HardRedraw(); // Ensure all items are redrawn (especially the drawing-sheet items)
2056
2057 // Allow tools to re-add their VIEW_ITEMs after the last call to Clear in HardRedraw
2059
2062 editTool->UpdateNetHighlighting( dummy );
2063
2065}
constexpr EDA_IU_SCALE schIUScale
Definition: base_units.h:111
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:106
@ icon_eeschema
@ icon_eeschema_16
@ icon_eeschema_32
BOX2< VECTOR2I > BOX2I
Definition: box2.h:847
static TOOL_ACTION toggleGrid
Definition: actions.h:144
static TOOL_ACTION paste
Definition: actions.h:69
static TOOL_ACTION cancelInteractive
Definition: actions.h:63
static TOOL_ACTION millimetersUnits
Definition: actions.h:150
static TOOL_ACTION copy
Definition: actions.h:68
static TOOL_ACTION updateFind
Definition: actions.h:85
static TOOL_ACTION pasteSpecial
Definition: actions.h:70
static TOOL_ACTION milsUnits
Definition: actions.h:149
static TOOL_ACTION toggleBoundingBoxes
Definition: actions.h:108
static TOOL_ACTION undo
Definition: actions.h:65
static TOOL_ACTION duplicate
Definition: actions.h:72
static TOOL_ACTION inchesUnits
Definition: actions.h:148
static TOOL_ACTION toggleCursorStyle
Definition: actions.h:105
static TOOL_ACTION doDelete
Definition: actions.h:73
static TOOL_ACTION selectionTool
Definition: actions.h:157
static TOOL_ACTION save
Definition: actions.h:51
static TOOL_ACTION zoomFitScreen
Definition: actions.h:99
static TOOL_ACTION redo
Definition: actions.h:66
static TOOL_ACTION deleteTool
Definition: actions.h:74
static TOOL_ACTION zoomTool
Definition: actions.h:102
static TOOL_ACTION cut
Definition: actions.h:67
static TOOL_ACTION selectAll
Definition: actions.h:71
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...
WINDOW_SETTINGS m_Window
Definition: app_settings.h:187
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
BOX2< Vec > & Merge(const BOX2< Vec > &aRect)
Modify the position and size of the rectangle in order to contain aRect.
Definition: box2.h:588
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
void Recalculate(const SCH_SHEET_LIST &aSheetList, bool aUnconditional=false, std::function< void(SCH_ITEM *)> *aChangedItemHandler=nullptr)
Updates the connection graph for the given list of sheets.
A subgraph is a set of items that are electrically connected on a single sheet.
wxArrayString GetFindEntries() const
wxArrayString GetReplaceEntries() const
void SetReplaceEntries(const wxArrayString &aEntries)
void SetFindEntries(const wxArrayString &aEntries, const wxString &aFindString)
bool Show(bool show) override
virtual APP_SETTINGS_BASE * config() const
Returns the settings object used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME.
virtual void setupUIConditions()
Setup the UI conditions for the various actions and their controls in this frame.
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...
WX_INFOBAR * m_infoBar
void UpdateFileHistory(const wxString &FullFileName, FILE_HISTORY *aFileHistory=nullptr)
Update the list of recently opened files.
wxAuiManager m_auimgr
void ClearFileHistory(FILE_HISTORY *aFileHistory=nullptr)
Removes all files from the file history.
virtual void OnDropFiles(wxDropFilesEvent &aEvent)
Handles event fired when a file is dropped to the window.
wxString GetFileFromHistory(int cmdId, const wxString &type, FILE_HISTORY *aFileHistory=nullptr)
Fetches the file name from the file history list.
static wxString GetAutoSaveFilePrefix()
wxString m_mruPath
wxArrayString m_replaceStringHistoryList
EDA_DRAW_PANEL_GAL::GAL_TYPE m_canvasType
KIGFX::GAL_DISPLAY_OPTIONS & GetGalDisplayOptions()
Return a reference to the gal rendering options used by GAL for rendering.
virtual void OnSize(wxSizeEvent &event) override
Recalculate the size of toolbars and display panel when the frame size changes.
void FocusOnLocation(const VECTOR2I &aPos)
Useful to focus on a particular location, in find functions.
virtual void SetScreen(BASE_SCREEN *aScreen)
void RecreateToolbars()
Rebuild all toolbars, and update the checked state of check tools.
virtual void UpdateMsgPanel()
Redraw the message panel.
void OnGridSettings(wxCommandEvent &event)
void ShowChangedLanguage() override
Redraw the menus and what not in current language.
void PrintDrawingSheet(const RENDER_SETTINGS *aSettings, BASE_SCREEN *aScreen, const std::map< wxString, wxString > *aProperties, double aMils2Iu, const wxString &aFilename, const wxString &aSheetLayer=wxEmptyString)
Prints the drawing-sheet (frame and title block).
wxArrayString m_findStringHistoryList
std::unique_ptr< EDA_SEARCH_DATA > m_findReplaceData
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
Update the board display after modifying it by a python script (note: it is automatically called by a...
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:85
virtual const VECTOR2I GetFocusPosition() const
Similar to GetPosition, but allows items to return their visual center rather than their anchor.
Definition: eda_item.h:256
const KIID m_Uuid
Definition: eda_item.h:492
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:97
void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: eda_item.h:141
void ClearBrightened()
Definition: eda_item.h:119
void SetBrightened()
Definition: eda_item.h:116
EDA_ITEM * GetParent() const
Definition: eda_item.h:99
virtual EDA_ITEM * Clone() const
Create a duplicate of this item with linked list members set to NULL.
Definition: eda_item.cpp:82
bool IsBrightened() const
Definition: eda_item.h:108
void ClearEditFlags()
Definition: eda_item.h:158
bool IsMoving() const
Definition: eda_item.h:104
bool IsNew() const
Definition: eda_item.h:103
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:72
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:87
virtual void ClearBoundingBoxCache()
Definition: eda_text.cpp:446
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 UndoAvailable()
Create a functor that tests if there are any items in the undo queue.
SELECTION_CONDITION ScriptingConsoleVisible()
Create a functor testing if the python scripting console window is visible.
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 FullscreenCursor()
Create a functor testing if the cursor is full screen in a frame.
PANEL_ANNOTATE m_AnnotatePanel
Gather all the actions that are shared by tools.
Definition: ee_actions.h:39
static TOOL_ACTION mirrorV
Definition: ee_actions.h:125
static TOOL_ACTION remapSymbols
Definition: ee_actions.h:167
static TOOL_ACTION selectionActivate
Activation of the selection tool.
Definition: ee_actions.h:46
static TOOL_ACTION toggleAnnotateAuto
Definition: ee_actions.h:244
static TOOL_ACTION lineMode90
Definition: ee_actions.h:239
static TOOL_ACTION toggleHiddenPins
Definition: ee_actions.h:214
static TOOL_ACTION navigateForward
Definition: ee_actions.h:202
static TOOL_ACTION placeSymbol
Definition: ee_actions.h:79
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:56
static TOOL_ACTION navigateBack
Definition: ee_actions.h:203
static TOOL_ACTION showPythonConsole
Definition: ee_actions.h:234
static TOOL_ACTION toggleERCWarnings
Definition: ee_actions.h:216
static TOOL_ACTION toggleERCExclusions
Definition: ee_actions.h:218
static TOOL_ACTION placeClassLabel
Definition: ee_actions.h:88
static TOOL_ACTION drawWire
Definition: ee_actions.h:81
static TOOL_ACTION drawCircle
Definition: ee_actions.h:96
static TOOL_ACTION rotateCCW
Definition: ee_actions.h:124
static TOOL_ACTION lineModeFree
Definition: ee_actions.h:238
static TOOL_ACTION drawBus
Definition: ee_actions.h:82
static TOOL_ACTION toggleERCErrors
Definition: ee_actions.h:217
static TOOL_ACTION placePower
Definition: ee_actions.h:80
static TOOL_ACTION drawLines
Definition: ee_actions.h:98
static TOOL_ACTION toggleOPCurrents
Definition: ee_actions.h:220
static TOOL_ACTION mirrorH
Definition: ee_actions.h:126
static TOOL_ACTION highlightNetTool
Definition: ee_actions.h:269
static TOOL_ACTION rotateCW
Definition: ee_actions.h:123
static TOOL_ACTION importSheetPin
Definition: ee_actions.h:92
static TOOL_ACTION leaveSheet
Definition: ee_actions.h:200
static TOOL_ACTION toggleHiddenFields
Definition: ee_actions.h:215
static TOOL_ACTION placeGlobalLabel
Definition: ee_actions.h:89
static TOOL_ACTION ddAppendFile
Definition: ee_actions.h:272
static TOOL_ACTION placeHierLabel
Definition: ee_actions.h:90
static TOOL_ACTION drawTextBox
Definition: ee_actions.h:94
static TOOL_ACTION drawRectangle
Definition: ee_actions.h:95
static TOOL_ACTION placeImage
Definition: ee_actions.h:99
static TOOL_ACTION showHierarchy
Definition: ee_actions.h:206
static TOOL_ACTION placeSchematicText
Definition: ee_actions.h:93
static TOOL_ACTION toggleOPVoltages
Definition: ee_actions.h:219
static TOOL_ACTION drawArc
Definition: ee_actions.h:97
static TOOL_ACTION lineMode45
Definition: ee_actions.h:240
static TOOL_ACTION drawSheet
Definition: ee_actions.h:91
static TOOL_ACTION navigateNext
Definition: ee_actions.h:205
static TOOL_ACTION navigateUp
Definition: ee_actions.h:201
static TOOL_ACTION placeLabel
Definition: ee_actions.h:87
static TOOL_ACTION placeBusWireEntry
Definition: ee_actions.h:86
static TOOL_ACTION placeJunction
Definition: ee_actions.h:85
static TOOL_ACTION navigatePrevious
Definition: ee_actions.h:204
static TOOL_ACTION placeNoConnect
Definition: ee_actions.h:84
Tool that displays edit points allowing to modify items by dragging the points.
bool empty() const
Definition: sch_rtree.h:176
EE_TYPE OfType(KICAD_T aType) const
Definition: sch_rtree.h:238
Container for ERC settings.
Definition: erc_settings.h:114
SEVERITY GetSeverity(int aErrorCode) const
std::set< wxString > m_ErcExclusions
Definition: erc_settings.h:174
void UpdateHierarchySelection()
Updates the tree's selection to match current page.
void UpdateHierarchyTree()
Update the hierarchical tree of the schematic.
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
Definition: ki_exception.h:76
APP_SETTINGS_BASE * KifaceSettings() const
Definition: kiface_base.h:95
void ReadWindowSettings(WINDOW_SETTINGS &aCfg)
Read GAL config options from application-level config.
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
void SetDefaultFont(const wxString &aFont)
wxDC * GetPrintDC() const
Contains methods for drawing schematic-specific items.
Definition: sch_painter.h:134
DS_PROXY_VIEW_ITEM * GetDrawingSheet() const
Definition: sch_view.h:102
void SetScale(double aScale, VECTOR2D aAnchor={ 0, 0 }) override
Set the scaling factor, zooming around a given anchor point.
Definition: sch_view.cpp:73
An abstract base class for deriving all objects that can be added to a VIEW.
Definition: view_item.h:77
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:69
double GetScale() const
Definition: view.h:269
virtual void Update(const VIEW_ITEM *aItem, int aUpdateFlags) const
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
Definition: view.cpp:1591
void SetLayerVisible(int aLayer, bool aVisible=true)
Control the visibility of a particular layer.
Definition: view.h:393
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
Definition: view.h:213
void SetCenter(const VECTOR2D &aCenter)
Set the center point of the VIEW (i.e.
Definition: view.cpp:577
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:1494
Definition: kiid.h:48
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
Definition: kiway_holder.h:53
A wxFrame capable of the OpenProjectFiles function, meaning it can load a portion of a KiCad project.
Definition: kiway_player.h:66
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:118
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:279
void OnKiCadExit()
Definition: kiway.cpp:668
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
Definition: kiway.cpp:394
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:450
virtual void ExpressMail(FRAME_T aDestination, MAIL_T aCommand, std::string &aPayload, wxWindow *aSource=nullptr)
Send aPayload to aDestination from aSource.
Definition: kiway.cpp:491
Define a library symbol object.
Definition: lib_symbol.h:99
std::unique_ptr< LIB_SYMBOL > Flatten() const
Return a flattened symbol inheritance to the caller.
Definition: lib_symbol.cpp:453
bool IsExcluded() const
Definition: marker_base.h:97
int GetHeightIU(double aIUScale) const
Gets the page height in IU.
Definition: page_info.h:153
int GetWidthIU(double aIUScale) const
Gets the page width in IU.
Definition: page_info.h:144
A small class to help profiling.
Definition: profile.h:47
void Stop()
Save the time when this function was called, and set the counter stane to stop.
Definition: profile.h:86
double msecs(bool aSinceLast=false)
Definition: profile.h:147
virtual const wxString GetProjectFullName() const
Return the full path and name of the project.
Definition: project.cpp:120
virtual const wxString GetProjectPath() const
Return the full path of the project.
Definition: project.cpp:126
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:305
These settings were stored in SCH_BASE_FRAME previously.
TEMPLATES m_TemplateFieldNames
Holds all the data relating to one schematic.
Definition: schematic.h:61
void Reset()
Initialize this schematic to a blank one, unloading anything existing.
Definition: schematic.cpp:56
CONNECTION_GRAPH * m_connectionGraph
Holds and calculates connectivity information of this schematic.
Definition: schematic.h:252
SCH_SHEET_PATH & CurrentSheet() const override
Definition: schematic.h:122
wxString GetOperatingPoint(const wxString &aNetName, int aPrecision, const wxString &aRange)
Definition: schematic.cpp:630
wxString GetFileName() const override
Helper to retrieve the filename from the root sheet screen.
Definition: schematic.cpp:199
SCHEMATIC_SETTINGS & Settings() const
Definition: schematic.cpp:205
CONNECTION_GRAPH * ConnectionGraph() const override
Definition: schematic.h:132
void SetCurrentSheet(const SCH_SHEET_PATH &aPath) override
Definition: schematic.h:127
SCH_SHEET_LIST GetSheets() const override
Builds and returns an updated schematic hierarchy TODO: can this be cached?
Definition: schematic.h:86
void SetRoot(SCH_SHEET *aRootSheet)
Initialize the schematic with a new root sheet.
Definition: schematic.cpp:109
void SetProject(PROJECT *aPrj)
Definition: schematic.cpp:81
SCH_SCREEN * RootScreen() const
Helper to retrieve the screen of the root sheet.
Definition: schematic.cpp:122
void RecomputeIntersheetRefs(const std::function< void(SCH_GLOBALLABEL *)> &aItemCallback)
Update the schematic's page reference map for all global labels, and refresh the labels so that they ...
Definition: schematic.cpp:568
bool IsValid() const
A simple test if the schematic is loaded, not a complete one.
Definition: schematic.h:107
SCH_SHEET & Root() const
Definition: schematic.h:91
void SetSheetNumberAndCount()
Set the m_ScreenNumber and m_NumberOfScreens members for screens.
Definition: schematic.cpp:539
ERC_SETTINGS & ErcSettings() const
Definition: schematic.cpp:212
A shim class between EDA_DRAW_FRAME and several derived classes: SYMBOL_EDIT_FRAME,...
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
void CommonSettingsChanged(bool aEnvVarsChanged, bool aTextVarsChanged) override
Notification event that some of the common (suite-wide) settings have changed.
EESCHEMA_SETTINGS * eeconfig() const
KIGFX::SCH_RENDER_SETTINGS * GetRenderSettings()
virtual void UpdateItem(EDA_ITEM *aItem, bool isAddOrDelete=false, bool aUpdateRtree=false)
Mark an item for refresh.
COLOR_SETTINGS * GetColorSettings(bool aForceRefresh=false) const override
Returns a pointer to the active color theme settings.
void AddToScreen(EDA_ITEM *aItem, SCH_SCREEN *aScreen)
Add an item to the screen (and view) aScreen is the screen the item is located on,...
Each graphical item can have a SCH_CONNECTION describing its logical connection (to a bus or net).
SCH_SHEET_PATH LocalSheet() const
SCH_ITEM * Parent() const
bool HasDriverChanged() const
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.
bool SchematicCleanUp(SCH_SCREEN *aScreen=nullptr)
Perform routine schematic cleaning including breaking wire and buses and deleting identical objects s...
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.
EDA_ITEM * GetItem(const KIID &aId) const override
Fetch an item by KIID.
const wxString & getAutoSaveFileName() const
std::vector< std::unique_ptr< SCH_ITEM > > m_items_to_repeat
For the repeat-last-item cmd.
const SCH_CONNECTION * GetHighlightedConnection() const
bool TrimWire(const VECTOR2I &aStart, const VECTOR2I &aEnd)
If any single wire passes through both points, remove the portion between the two points,...
void OnOpenCvpcb(wxCommandEvent &event)
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
void AddItemToScreenAndUndoList(SCH_SCREEN *aScreen, SCH_ITEM *aItem, bool aUndoAppend)
Add an item to the schematic and adds the changes to the undo/redo container.
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 ShowFindReplaceDialog(bool aReplace)
Run the Find or Find & Replace dialog.
void UpdateHierarchySelection()
Update the hierarchy navigation tree selection (cross-probe from schematic to hierarchy pane).
void SetScreen(BASE_SCREEN *aScreen) override
void OnFindDialogClose()
Notification that the Find dialog has closed.
void SaveSymbolToSchematic(const LIB_SYMBOL &aSymbol, const KIID &aSchematicSymbolUUID)
Update a schematic symbol from a LIB_SYMBOL.
void onSize(wxSizeEvent &aEvent)
void RecordERCExclusions()
Scan existing markers and record data from any that are Excluded.
void ShowChangedLanguage() override
void SaveCopyInUndoList(SCH_SCREEN *aScreen, SCH_ITEM *aItemToCopy, UNDO_REDO aTypeCommand, bool aAppend, bool aDirtyConnectivity=true)
Create a copy of the current schematic item, and put it in the undo list.
void CommonSettingsChanged(bool aEnvVarsChanged, bool aTextVarsChanged) override
Called after the preferences dialog is run.
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.
void OnAppendProject(wxCommandEvent &event)
SCHEMATIC * m_schematic
The currently loaded schematic.
void ClearFindReplaceStatus()
SCH_SHEET_PATH & GetCurrentSheet() const
void OnLoadFile(wxCommandEvent &event)
SCHEMATIC & Schematic() const
void updateTitle()
Set the main window title bar text.
bool canCloseWindow(wxCloseEvent &aCloseEvent) override
void OnUpdatePCB(wxCommandEvent &event)
void RecomputeIntersheetRefs()
Update the schematic's page reference map for all global labels, and refresh the labels so that they ...
void sendNetlistToCvpcb()
Send the KiCad netlist over to CVPCB.
void OnOpenPcbnew(wxCommandEvent &event)
void RecalculateConnections(SCH_CLEANUP_FLAGS aCleanupFlags)
Generate the connection data for the entire schematic hierarchy.
void SetSheetNumberAndCount()
Set the m_ScreenNumber and m_NumberOfScreens members for screens.
void OnPageSettingsChange() override
Called when modifying the page settings.
const BOX2I GetDocumentExtents(bool aIncludeAllVisible=true) const override
Returns bbox of document with option to not include some items.
void initScreenZoom()
Initialize the zoom value of the current screen and mark the screen as zoom-initialized.
void OnImportProject(wxCommandEvent &event)
static const wxString SchematicHierarchyPaneName()
void setupUIConditions() override
Setup the UI conditions for the various actions and their controls in this frame.
void ShowFindReplaceStatus(const wxString &aMsg, int aStatusTime)
void SetCurrentSheet(const SCH_SHEET_PATH &aSheet)
void SetHighlightedConnection(const SCH_CONNECTION *aConnection)
virtual void PrintPage(const RENDER_SETTINGS *aSettings) override
Plot or print the current sheet to the clipboard.
int GetSchematicJunctionSize()
void DisplayCurrentSheet()
Draw the current sheet on the display.
void ResolveERCExclusions()
Update markers to match recorded exclusions.
~SCH_EDIT_FRAME() override
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.
DIALOG_SCH_FIND * m_findReplaceDialog
void UpdateHierarchyNavigator()
Update the hierarchy navigation tree and history.
void AddCopyForRepeatItem(const SCH_ITEM *aItem)
void OnResizeHierarchyNavigator(wxSizeEvent &aEvent)
wxString GetCurrentFileName() const override
Get the full filename + path of the currently opened file in the frame.
SCH_JUNCTION * AddJunction(SCH_SCREEN *aScreen, const VECTOR2I &aPos, bool aAppendToUndo, bool aFinal=true)
void TestDanglingEnds()
Test all of the connectable objects in the schematic for unused connection points.
void OnExit(wxCommandEvent &event)
void AutoRotateItem(SCH_SCREEN *aScreen, SCH_ITEM *aItem)
Automatically set the rotation of an item (if the item supports it)
HIERARCHY_PANE * m_hierarchy
SEVERITY GetSeverity(int aErrorCode) const override
void FocusOnItem(SCH_ITEM *aItem)
void SaveCopyForRepeatItem(const SCH_ITEM *aItem)
Clone aItem and owns that clone in this container.
Instances are attached to a symbol or sheet and provide a place for the symbol's value,...
Definition: sch_field.h:51
Handle actions specific to the schematic editor.
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:147
virtual bool IsConnectable() const
Definition: sch_item.h:349
SCH_ITEM_SET & ConnectedItems(const SCH_SHEET_PATH &aPath)
Retrieve the set of items connected to this item on the given sheet.
Definition: sch_item.cpp:187
virtual void RunOnChildren(const std::function< void(SCH_ITEM *)> &aFunction)
Definition: sch_item.h:444
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:146
virtual std::vector< VECTOR2I > GetConnectionPoints() const
Add all the connection points for this item to aPoints.
Definition: sch_item.h:364
bool IsType(const std::vector< KICAD_T > &aScanTypes) const override
Check whether the item is one of the listed types.
Definition: sch_item.h:162
void AutoplaceFields(SCH_SCREEN *aScreen, bool aManual) override
Definition: sch_label.cpp:376
std::vector< SCH_FIELD > & GetFields()
Definition: sch_label.h:90
Tool responsible for drawing/placing items (symbols, wires, buses, labels, etc.)
Segment description base class to describe items which have 2 end points (track, wire,...
Definition: sch_line.h:40
void SetOperatingPoint(const wxString &aText)
Definition: sch_line.h:301
double GetLength() const
Definition: sch_line.cpp:238
const wxString & GetOperatingPoint() const
Definition: sch_line.h:300
wxString Serialize() const
Definition: sch_marker.cpp:78
Handle actions specific to the schematic editor.
void SetOperatingPoint(const wxString &aText)
Definition: sch_pin.h:163
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
Definition: sch_screen.h:662
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:131
void Append(SCH_ITEM *aItem, bool aUpdateLibSymbol=true)
Definition: sch_screen.cpp:145
std::map< wxString, LIB_SYMBOL * > & GetLibSymbols()
Fetch a list of unique LIB_SYMBOL object pointers required to properly render each SCH_SYMBOL in this...
Definition: sch_screen.h:481
void Clear(bool aFree=true)
Delete all draw items and clears the project settings.
Definition: sch_screen.cpp:262
double m_LastZoomLevel
last value for the zoom level, useful in Eeschema when changing the current displayed sheet to reuse ...
Definition: sch_screen.h:586
EE_RTREE & Items()
Gets the full RTree, usually for iterating.
Definition: sch_screen.h:109
void Print(const RENDER_SETTINGS *aSettings)
Print all the items in the screen to aDC.
const wxString & GetFileName() const
Definition: sch_screen.h:144
const KIID & GetUuid() const
Definition: sch_screen.h:526
bool IsReadOnly() const
Definition: sch_screen.h:147
void SetFileName(const wxString &aFileName)
Set the file name for this screen to aFileName.
Definition: sch_screen.cpp:110
bool IsExplicitJunctionNeeded(const VECTOR2I &aPosition) const
Indicates that a junction dot is necessary at the given location, and does not yet exist.
Definition: sch_screen.cpp:478
void Update(SCH_ITEM *aItem, bool aUpdateLibSymbol=true)
Update aItem's bounding box in the tree.
Definition: sch_screen.cpp:300
bool m_zoomInitialized
Definition: sch_screen.h:611
bool FileExists() const
Definition: sch_screen.h:150
TEXT_SPIN_STYLE GetLabelOrientationForPoint(const VECTOR2I &aPosition, TEXT_SPIN_STYLE aDefaultOrientation, const SCH_SHEET_PATH *aSheet) const
Definition: sch_screen.cpp:487
bool CheckIfOnDrawList(const SCH_ITEM *aItem) const
Definition: sch_screen.cpp:370
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
SCH_ITEM * GetItem(const KIID &aID, SCH_SHEET_PATH *aPathOut=nullptr) 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()
void SetPageNumber(const wxString &aPageNumber)
Set the sheet instance user definable page number.
void push_back(SCH_SHEET *aSheet)
Forwarded method from std::vector.
void clear()
Forwarded method from std::vector.
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Definition: sch_sheet_pin.h:66
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:57
void AddPin(SCH_SHEET_PIN *aSheetPin)
Add aSheetPin to the sheet.
Definition: sch_sheet.cpp:369
void SetScreen(SCH_SCREEN *aScreen)
Set the SCH_SCREEN associated with this sheet to aScreen.
Definition: sch_sheet.cpp:162
Schematic symbol object.
Definition: sch_symbol.h:81
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const
Return the reference for the given sheet path.
Definition: sch_symbol.cpp:674
std::vector< SCH_PIN * > GetPins(const SCH_SHEET_PATH *aSheet=nullptr) const
Retrieve a list of the SCH_PINs for the given sheet path.
bool IsAnnotated(const SCH_SHEET_PATH *aSheet)
Check if the symbol has a valid annotation (reference) for the given sheet path.
Definition: sch_symbol.cpp:752
SCH_PIN * GetPin(const wxString &number) const
Find a symbol pin by number.
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)
EDA_ITEM * Front() const
Definition: selection.h:208
int Size() const
Returns the number of selected parts.
Definition: selection.h:115
bool UnloadProject(PROJECT *aProject, bool aSave=true)
Saves, unloads and unregisters the given PROJECT.
SIM_MODEL & CreateModel(SIM_MODEL::TYPE aType, const std::vector< LIB_PIN * > &aPins)
std::vector< std::reference_wrapper< const PIN > > GetPins() const
Definition: sim_model.cpp:749
const SPICE_GENERATOR & SpiceGenerator() const
Definition: sim_model.h:419
virtual std::string ItemName(const SPICE_ITEM &aItem) const
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:170
TOOL_DISPATCHER * m_toolDispatcher
Definition: tools_holder.h:172
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
Definition: tools_holder.h:54
ACTIONS * m_actions
Definition: tools_holder.h:171
@ MODEL_RELOAD
Model changes (required full reload)
Definition: tool_base.h:80
Generic, UI-independent tool event.
Definition: tool_event.h:156
Master controller class:
Definition: tool_manager.h:55
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:142
ACTION_MANAGER * GetActionManager() const
Definition: tool_manager.h:196
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()
Initializes all registered tools.
void ShutdownAllTools()
Shutdown all tools with a currently registered event loop in this tool manager by waking them up with...
void RemoveAllButtons()
Remove all the buttons that have been added by the user.
Definition: wx_infobar.cpp:289
void ShowMessageFor(const wxString &aMessage, int aTime, int aFlags=wxICON_INFORMATION, MESSAGE_TYPE aType=WX_INFOBAR::MESSAGE_TYPE::GENERIC)
Show the infobar with the provided message and icon for a specific period of time.
Definition: wx_infobar.cpp:128
void Dismiss() override
Dismisses the infobar and updates the containing layout and AUI manager (if one is provided).
Definition: wx_infobar.cpp:175
void AddCloseButton(const wxString &aTooltip=_("Hide this message."))
Add the default close button to the infobar on the right side.
Definition: wx_infobar.cpp:279
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:300
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:260
This file is part of the common library.
#define DIALOG_ERC_WINDOW_NAME
Definition: dialog_erc.h:37
#define _HKI(x)
#define _(s)
#define KICAD_DEFAULT_DRAWFRAME_STYLE
#define SCH_EDIT_FRAME_NAME
#define IS_NEW
New item, just created.
@ ID_IMPORT_NON_KICAD_SCH
Definition: eeschema_id.h:63
@ LINE_MODE_90
@ LINE_MODE_45
@ LINE_MODE_FREE
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:40
@ 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_SCH_VIEWER_MODAL
Definition: frame_type.h:37
@ FRAME_SIMULATOR
Definition: frame_type.h:38
@ FRAME_CVPCB
Definition: frame_type.h:48
int ExecuteFile(const wxString &aEditorName, const wxString &aFileName, wxProcess *aCallback)
Call the executable file aEditorName with the parameter aFileName.
Definition: gestfich.cpp:115
const std::string LegacyPcbFileExtension
#define PcbFileExtension
const std::string NetlistFileExtension
const std::string KiCadSchematicFileExtension
wxString KiCadSchematicFileWildcard()
wxString LegacySchematicFileWildcard()
wxString AllSchematicFilesWildcard()
@ ID_FILE_LIST_CLEAR
Definition: id.h:87
@ ID_EDA_SOCKET_EVENT
Definition: id.h:164
@ ID_EDA_SOCKET_EVENT_SERV
Definition: id.h:163
@ ID_FILEMAX
Definition: id.h:85
@ ID_FILE1
Definition: id.h:84
@ ID_GRID_SETTINGS
Definition: id.h:146
@ ID_APPEND_PROJECT
Definition: id.h:74
void ignore_unused(const T &)
Definition: ignore.h:24
KIID niluuid(0)
#define KICTL_CREATE
caller thinks requested project files may not exist.
Definition: kiway_player.h:82
@ LAYER_ERC_WARN
Definition: layer_ids.h:369
@ LAYER_ERC_EXCLUSION
Definition: layer_ids.h:371
@ LAYER_ERC_ERR
Definition: layer_ids.h:370
@ LAYER_OP_CURRENTS
Definition: layer_ids.h:388
@ LAYER_SCHEMATIC_BACKGROUND
Definition: layer_ids.h:376
@ LAYER_INTERSHEET_REFS
Definition: layer_ids.h:355
@ LAYER_OP_VOLTAGES
Definition: layer_ids.h:387
@ MAIL_PCB_UPDATE
Definition: mail_type.h:46
EESCHEMA_SETTINGS * eeconfig()
Definition: sch_painter.cpp:75
@ REPAINT
Item needs to be redrawn.
Definition: view_item.h:52
@ GEOMETRY
Position or shape has changed.
Definition: view_item.h:49
void SetShutdownBlockReason(wxWindow *aWindow, const wxString &aReason)
Sets the block reason why the window/application is preventing OS shutdown.
Definition: gtk/app.cpp:83
bool SupportsShutdownBlockReason()
Whether or not the window supports setting a shutdown block reason.
Definition: gtk/app.cpp:72
see class PGM_BASE
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
SEVERITY
#define CHECK(x)
#define CURRENT_TOOL(action)
#define ENABLE(x)
SCH_CLEANUP_FLAGS
@ LOCAL_CLEANUP
@ NO_CLEANUP
@ GLOBAL_CLEANUP
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:111
std::vector< FAB_LAYER_COLOR > dummy
wxString UnescapeString(const wxString &aSource)
const double IU_PER_MILS
Definition: base_units.h:78
std::string refName
Definition for symbol library class.
@ SCH_LINE_T
Definition: typeinfo.h:146
@ SCH_SYMBOL_T
Definition: typeinfo.h:156
@ SCH_FIELD_T
Definition: typeinfo.h:155
@ SCH_LABEL_T
Definition: typeinfo.h:151
@ SCH_SHEET_T
Definition: typeinfo.h:158
@ SCH_MARKER_T
Definition: typeinfo.h:141
@ SCH_HIER_LABEL_T
Definition: typeinfo.h:153
@ SCH_SHEET_PIN_T
Definition: typeinfo.h:157
@ SCH_TEXT_T
Definition: typeinfo.h:150
@ SCH_GLOBAL_LABEL_T
Definition: typeinfo.h:152
VECTOR2< int > VECTOR2I
Definition: vector2d.h:590
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.