KiCad PCB EDA Suite
Loading...
Searching...
No Matches
sch_edit_frame.h
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) 2015 Jean-Pierre Charras, jp.charras wanadoo.fr
5 * Copyright (C) 2008 Wayne Stambaugh <[email protected]>
6 * Copyright (C) 2023 CERN (www.cern.ch)
7 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <https://www.gnu.org/licenses/>.
21 */
22
23#ifndef SCH_EDIT_FRAME_H
24#define SCH_EDIT_FRAME_H
25
26#include <stddef.h>
27#include <vector>
28#include <wx/cmndata.h>
29#include <wx/event.h>
30#include <wx/gdicmn.h>
31#include <wx/string.h>
32#include <wx/treectrl.h>
33#include <wx/utils.h>
34#include <wx/filename.h>
35#include <wx/generic/treectlg.h>
36
37#include <core/typeinfo.h>
38#include <eda_base_frame.h>
39#include <eeschema_settings.h>
40#include <math/box2.h>
41#include <sch_base_frame.h>
42#include <template_fieldnames.h>
43
44class SCH_ITEM;
45class EDA_ITEM;
46class SCH_LINE;
47class SCH_TEXT;
48class SCH_BITMAP;
49class SCH_SHEET;
50class SCH_SHEET_PATH;
51class SCH_SHEET_PIN;
52class SCH_SYMBOL;
53class SCH_FIELD;
54class SCH_JUNCTION;
55class SCHEMATIC;
56class SCH_COMMIT;
60class DIALOG_ERC;
62class RESCUER;
63class HIERARCHY_PANE;
65class API_HANDLER_SCH;
68class wxSearchCtrl;
69class wxGenericTreeCtrl;
70class BITMAP_BUTTON;
71
72
79
80
81wxDECLARE_EVENT( EDA_EVT_SCHEMATIC_CHANGING, wxCommandEvent );
82wxDECLARE_EVENT( EDA_EVT_SCHEMATIC_CHANGED, wxCommandEvent );
83
84
88class NET_NAVIGATOR_ITEM_DATA : public wxTreeItemData
89{
90public:
91 NET_NAVIGATOR_ITEM_DATA( const SCH_SHEET_PATH& aSheetPath, const SCH_ITEM* aItem ) :
92 m_sheetPath( aSheetPath ),
93 m_item( aItem )
94 {
95 }
96
98 m_item( nullptr )
99 {
100 }
101
103 const SCH_ITEM* GetItem() const { return m_item; }
104
105 bool operator==( const NET_NAVIGATOR_ITEM_DATA& aRhs ) const
106 {
107 return ( m_sheetPath == aRhs.m_sheetPath ) && ( m_item == aRhs.m_item );
108 }
109
111 {
112 if( this == &aItemData )
113 return *this;
114
115 m_sheetPath = aItemData.m_sheetPath;
116 m_item = aItemData.m_item;
117
118 return *this;
119 }
120
121private:
124};
125
126
131{
132public:
133 SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent );
134 ~SCH_EDIT_FRAME() override;
135
136 SCH_SCREEN* GetScreen() const override;
137
138 SELECTION& GetCurrentSelection() override;
139
140 SCHEMATIC& Schematic() const;
141
142 std::unique_ptr<GRID_HELPER> MakeGridHelper() override;
143
147 bool GetShowAllPins() const override;
148
152 void SaveProjectLocalSettings() override;
153
159 bool LoadProjectSettings();
160
164 void LoadDrawingSheet();
165
166 void ShowSchematicSetupDialog( const wxString& aInitialPage = wxEmptyString );
167
168 void LoadSettings( APP_SETTINGS_BASE* aCfg ) override;
169 void SaveSettings( APP_SETTINGS_BASE* aCfg ) override;
170
172
173 void setupUIConditions() override;
174
180 bool IsContentModified() const override;
181
186 void OnModify() override;
187
188 SEVERITY GetSeverity( int aErrorCode ) const override;
189
193 wxString GetScreenDesc() const override;
194 wxString GetFullScreenDesc() const override;
195
216 void ExecuteRemoteCommand( const char* cmdline ) override;
217
218 void KiwayMailIn( KIWAY_MAIL_EVENT& aEvent ) override;
219
224
228 void AutoRotateItem( SCH_SCREEN* aScreen, SCH_ITEM* aItem );
229
233 void UpdateHierarchyNavigator( bool aRefreshNetNavigator = true, bool aClear = false );
234
242
248
253
254 void AddVariant();
255
256 void RemoveVariant();
257
259
267 void UpdateVariantSelectionCtrl( const wxArrayString& aVariantNames );
268
269 void SetCurrentVariant( const wxString& aVariantName );
270
277
278 void onVariantSelected( wxCommandEvent& aEvent );
279
285 void TestDanglingEnds();
286
296 void SendSelectItemsToPcb( const std::vector<EDA_ITEM*>& aItems, bool aForce );
297
303 void SendCrossProbeNetName( const wxString& aNetName );
304
310 void SetCrossProbeConnection( const SCH_CONNECTION* aConnection );
311
316
317 const wxString& GetHighlightedConnection() const
318 {
319 return m_highlightedConn;
320 }
321
322 const wxString& GetHighlightedNetChain() const
323 {
325 }
326
327 void SetHighlightedConnection( const wxString& aConnection,
328 const NET_NAVIGATOR_ITEM_DATA* aSelection = nullptr );
329
331
332 void SetHighlightedNetChain( const wxString& aNetChain )
333 {
334 m_highlightedNetChain = aNetChain;
335 if( m_schematic )
336 m_schematic->SetHighlightedNetChain( aNetChain );
337 }
338
347 bool ReadyToNetlist( const wxString& aAnnotateMessage );
348
364 bool WriteNetListFile( int aFormat, const wxString& aFullFileName, unsigned aNetlistOptions,
365 REPORTER* aReporter = nullptr );
366
374 void DeleteAnnotation( ANNOTATE_SCOPE_T aAnnotateScope, bool aRecursive, REPORTER& aReporter );
375
401 void AnnotateSymbols( SCH_COMMIT* aCommit, ANNOTATE_SCOPE_T aAnnotateScope, ANNOTATE_ORDER_T aSortOption,
402 ANNOTATE_ALGO_T aAlgoOption, bool aRecursive, int aStartNumber, bool aResetAnnotation,
403 bool aRegroupUnits, bool aRepairTimestamps, REPORTER& aReporter,
404 SYMBOL_FILTER aSymbolFilter );
405
422 int CheckAnnotate( ANNOTATION_ERROR_HANDLER aErrorHandler, ANNOTATE_SCOPE_T aAnnotateScope,
423 bool aRecursive, SYMBOL_FILTER aSymbolFilter );
424
431 int ModalAnnotate( const wxString& aMessage );
432
433 // Functions used for hierarchy handling
435
436 void SetCurrentSheet( const SCH_SHEET_PATH& aSheet );
437
438 void UpdateItem( EDA_ITEM* aItem, bool isAddOrDelete = false, bool aUpdateRtree = false ) override;
439
445 void HardRedraw() override;
446
450 void DisplayCurrentSheet();
451
456
463 void OnPageSettingsChange() override;
464
471
472 wxPageSetupDialogData& GetPageSetupData() { return m_pageSetupData; }
473
474 void NewProject();
475 void LoadProject();
476 void ProjectChanged() override;
477
485 bool SaveProject( bool aSaveAs = false );
486
487 bool OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl = 0 ) override;
488
489 void SetSchematic( SCHEMATIC* aSchematic );
490
491 wxString GetCurrentFileName() const override;
492
500 bool AskToSaveChanges();
501
502 SCH_JUNCTION* AddJunction( SCH_COMMIT* aCommit, SCH_SCREEN* aScreen, const VECTOR2I& aPos );
503
513 bool TrimWire( SCH_COMMIT* aCommit, const VECTOR2I& aStart, const VECTOR2I& aEnd );
514
515 void OnOpenPcbnew();
516 void OnOpenCvpcb();
517 void OnUpdatePCB();
518 void OnAnnotate();
519
527 bool CheckSheetForRecursion( SCH_SHEET* aSheet, SCH_SHEET_PATH* aCurrentSheet );
528
540 bool AllowCaseSensitiveFileNameClashes( const wxString& aOldName,
541 const wxString& aSchematicFileName );
542
576 bool EditSheetProperties( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHierarchy,
577 bool* aIsUndoable = nullptr, bool* aClearAnnotationNewItems = nullptr,
578 bool* aUpdateHierarchyNavigator = nullptr,
579 wxString* aSourceSheetFilename = nullptr );
580
581 void InitSheet( SCH_SHEET* aSheet, const wxString& aNewFilename );
582
600 bool ChangeSheetFile( SCH_SHEET* aSheet, const wxString& aNewFilename,
601 bool* aClearAnnotationNewItems = nullptr,
602 bool* aIsUndoable = nullptr,
603 const wxString* aSourceSheetFilename = nullptr );
604
655 bool LoadSheetFromFile( SCH_SHEET* aSheet, SCH_SHEET_PATH* aCurrentSheet, const wxString& aFileName,
656 bool aSkipRecursionCheck = false, bool aSkipLibCheck = false );
657
663 void DeleteJunction( SCH_COMMIT* aCommit, SCH_ITEM* aItem );
664
665 void UpdateHopOveredWires( SCH_ITEM* aItem );
666
667 void SelectUnit( SCH_SYMBOL* aSymbol, int aUnit );
668
669 void SelectBodyStyle( SCH_SYMBOL* aSymbol, int aBodyStyle );
670
671 void SetAltPinFunction( SCH_PIN* aPin, const wxString& aFunction );
672
673 /* Undo - redo */
674
690 void SaveCopyInUndoList( SCH_SCREEN* aScreen, SCH_ITEM* aItemToCopy, UNDO_REDO aTypeCommand,
691 bool aAppend );
692
700 void SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsList, UNDO_REDO aTypeCommand,
701 bool aAppend );
702
709
721 void ClearUndoORRedoList( UNDO_REDO_LIST whichList, int aItemCount = -1 ) override;
722
726 void SaveCopyForRepeatItem( const SCH_ITEM* aItem );
727 void AddCopyForRepeatItem( const SCH_ITEM* aItem );
728
734 const std::vector<std::unique_ptr<SCH_ITEM>>& GetRepeatItems() const
735 {
736 return m_items_to_repeat;
737 }
738
745 {
746 m_items_to_repeat.clear();
747 }
748
749 EDA_ITEM* ResolveItem( const KIID& aId, bool aAllowNullptrReturn = false ) const override;
750
757
764 bool CreateArchiveLibrary( const wxString& aFileName );
765
766 bool SaveSheetAsDesignBlock( const wxString& aLibraryName, SCH_SHEET_PATH& aSheetPath );
767
768 bool SaveSelectionAsDesignBlock( const wxString& aLibraryName );
769
770 bool UpdateDesignBlockFromSheet( const LIB_ID& aLibId, SCH_SHEET_PATH& aSheetPath );
771
772 bool UpdateDesignBlockFromSelection( const LIB_ID& aLibId );
773
775
776 void SetNetListerCommand( const wxString& aCommand ) { m_netListerCommand = aCommand; }
777
781 void DefaultExecFlags() { m_exec_flags = wxEXEC_SYNC; }
782
788 void SetExecFlags( const int aFlags ) { m_exec_flags |= aFlags; }
789
796 void ClearExecFlags( const int aFlags ) { m_exec_flags &= ~( aFlags ); }
797
798 wxString GetNetListerCommand() const { return m_netListerCommand; }
799
803 void RecalculateConnections( SCH_COMMIT* aCommit, SCH_CLEANUP_FLAGS aCleanupFlags,
804 PROGRESS_REPORTER* aProgressReporter = nullptr );
805
809 void CommonSettingsChanged( int aFlags ) override;
810
812
813 void ShowChangedLanguage() override;
814
815 void SetScreen( BASE_SCREEN* aScreen ) override;
816
817 const BOX2I GetDocumentExtents( bool aIncludeAllVisible = true ) const override;
818
819 void FocusOnItem( EDA_ITEM* aItem, bool aAllowScroll = true ) override;
820
822
831 void SaveSymbolToSchematic( const LIB_SYMBOL& aSymbol, const KIID& aSchematicSymbolUUID );
832
838
842 void IntersheetRefUpdate( SCH_GLOBALLABEL* aItem ) override;
843
844 void ShowAllIntersheetRefs( bool aShow );
845
850
854 void ToggleSearch();
855
856 void ToggleProperties() override;
857
858 void ToggleLibraryTree() override;
859
861
862
864
866
868
869 wxGenericTreeCtrl* GetNetNavigator();
870
872
876 static const wxString SchematicHierarchyPaneName()
877 {
878 return wxT( "SchematicHierarchy" );
879 }
880
884 static const wxString SearchPaneName() { return wxT( "Search" ); }
885
886 bool IsSearchPaneShown() { return m_auimgr.GetPane( SearchPaneName() ).IsShown(); }
887
888 void FocusSearch();
889
899 void AddSchematicChangeListener( wxEvtHandler* aListener );
900
904 void RemoveSchematicChangeListener( wxEvtHandler* aListener );
905
906 static const wxString NetNavigatorPaneName()
907 {
908 return wxS( "NetNavigator" );
909 }
910
911 void RefreshNetNavigator( const NET_NAVIGATOR_ITEM_DATA* aSelection = nullptr );
912
913 void MakeNetNavigatorNode( const wxString& aNetName, wxTreeItemId aParentId,
914 const NET_NAVIGATOR_ITEM_DATA* aSelection,
915 bool aSingleSheetSchematic );
916
917 void SelectNetNavigatorItem( const NET_NAVIGATOR_ITEM_DATA* aSelection = nullptr );
918
919 const SCH_ITEM* SelectNextPrevNetNavigatorItem( bool aNext );
920
921 void ToggleNetNavigator();
922 void FindNetInInspector( const wxString& aNetName );
923
928
929 void ClearToolbarControl( int aId ) override;
930
931 DECLARE_EVENT_TABLE()
932
933protected:
939 bool doAutoSave() override;
940
941 void configureToolbars() override;
942
943 void doReCreateMenuBar() override;
944
948 void sendNetlistToCvpcb();
949
950 void onSize( wxSizeEvent& aEvent );
951
952 void saveProjectSettings() override;
953
954 void onCloseSymbolDiffDialog( wxCommandEvent& aEvent );
955
956 void onCloseErcDialog( wxCommandEvent& aEvent );
957
958 void onCloseSymbolFieldsTableDialog( wxCommandEvent& aEvent );
959
960 void unitsChangeRefresh() override;
961
962 void updateSelectionFilterVisbility() override;
963
964 void onPluginAvailabilityChanged( wxCommandEvent& aEvt );
965
966private:
967 // Called when resizing the Hierarchy Navigator panel
968 void OnResizeHierarchyNavigator( wxSizeEvent& aEvent );
969
970 void onResizeNetNavigator( wxSizeEvent& aEvent );
971
972 // Sets up the tool framework
973 void setupTools();
974
975 void OnExit( wxCommandEvent& event );
976
977 void OnLoadFile( wxCommandEvent& event );
978 void OnImportProject();
979
980 void OnClearFileHistory( wxCommandEvent& aEvent );
981
982 bool canCloseWindow( wxCloseEvent& aCloseEvent ) override;
983 void doCloseWindow() override;
984
993 void updateTitle();
994
998 void initScreenZoom();
999
1009
1016 bool importFile( const wxString& aFileName, int aFileType,
1017 const std::map<std::string, UTF8>* aProperties = nullptr );
1018
1026 bool saveSchematicFile( SCH_SHEET* aSheet, const wxString& aSavePath );
1027
1033 void mapExistingAnnotation( std::map<wxString, wxString>& aMap );
1034
1036
1037 void onNetNavigatorFilterChanged( wxCommandEvent& aEvent );
1038 void onNetNavigatorKey( wxKeyEvent& aEvent );
1039 void onNetNavigatorItemMenu( wxTreeEvent& aEvent );
1040 void onNetNavigatorContextMenu( wxContextMenuEvent& aEvent );
1041 void onNetNavigatorMenuCommand( wxCommandEvent& aEvent );
1042 void showNetNavigatorMenu( const wxTreeItemId& aItem );
1043
1044 void onNetNavigatorSelection( wxTreeEvent& aEvent );
1045
1046 void onNetNavigatorSelChanging( wxTreeEvent& aEvent );
1047
1049
1050 void StartCrossProbeFlash( const std::vector<SCH_ITEM*>& aItems );
1051 void OnCrossProbeFlashTimer( wxTimerEvent& aEvent );
1052
1053private:
1054 // The schematic editor control class should be able to access some internal
1055 // functions of the editor frame.
1057
1058 enum
1059 {
1060 ID_NET_NAVIGATOR_EXPAND_ALL = wxID_HIGHEST + 400,
1065 };
1066
1070
1071 wxPageSetupDialogData m_pageSetupData;
1072 std::vector<std::unique_ptr<SCH_ITEM>> m_items_to_repeat;
1073
1078
1084
1085
1086 wxGenericTreeCtrl* m_netNavigator;
1091
1092 bool m_syncingPcbToSchSelection; // Recursion guard when synchronizing selection from PCB
1093 // Cross-probe flashing support
1096 std::vector<KIID> m_crossProbeFlashItems;
1100
1101 std::vector<wxEvtHandler*> m_schematicChangeListeners;
1102
1103 std::vector<LIB_ID> m_designBlockHistoryList;
1106
1108
1109 std::unique_ptr<API_HANDLER_SCH> m_apiHandler;
1110 std::unique_ptr<API_HANDLER_COMMON> m_apiHandlerCommon;
1111};
1112
1113
1114#endif // SCH_EDIT_FRAME_H
BOX2< VECTOR2I > BOX2I
Definition box2.h:918
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
Handles how to draw a screen (a board, a schematic ...)
Definition base_screen.h:37
A bitmap button widget that behaves like an AUI toolbar item's button when it is drawn.
UNDO_REDO_LIST
Specify whether we are interacting with the undo or redo stacks.
wxAuiManager m_auimgr
A base class for most all the KiCad significant classes used in schematics and boards.
Definition eda_item.h:96
Definition kiid.h:44
Carry a payload from one KIWAY_PLAYER to another within a PROJECT.
Definition kiway_mail.h:34
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition kiway.h:311
A logical library item identifier and consists of various portions much like a URI.
Definition lib_id.h:45
Define a library symbol object.
Definition lib_symbol.h:79
Tree view item data for the net navigator.
const SCH_ITEM * m_item
const SCH_ITEM * GetItem() const
bool operator==(const NET_NAVIGATOR_ITEM_DATA &aRhs) const
NET_NAVIGATOR_ITEM_DATA(const SCH_SHEET_PATH &aSheetPath, const SCH_ITEM *aItem)
SCH_SHEET_PATH & GetSheetPath()
NET_NAVIGATOR_ITEM_DATA & operator=(const NET_NAVIGATOR_ITEM_DATA &aItemData)
A holder to handle information on schematic or board items.
A progress reporter interface for use in multi-threaded environments.
A pure virtual class used to derive REPORTER objects from.
Definition reporter.h:71
Holds all the data relating to one schematic.
Definition schematic.h:90
SCH_BASE_FRAME(KIWAY *aKiway, wxWindow *aParent, FRAME_T aWindowType, const wxString &aTitle, const wxPoint &aPosition, const wxSize &aSize, long aStyle, const wxString &aFrameName)
Object to handle a bitmap image that can be inserted in a schematic.
Definition sch_bitmap.h:36
Each graphical item can have a SCH_CONNECTION describing its logical connection (to a bus or net).
void ShowSchematicSetupDialog(const wxString &aInitialPage=wxEmptyString)
void RollbackSchematicFromUndo()
Perform an undo of the last edit without logging a corresponding redo.
void DefaultExecFlags()
Reset the execution flags to defaults for external netlist and bom generators.
bool IsSyncingSelection()
void OnCrossProbeFlashTimer(wxTimerEvent &aEvent)
void ToggleProperties() override
bool IsContentModified() const override
Get if the current schematic has been modified but not saved.
void RefreshOperatingPointDisplay()
Refresh the display of any operating points.
wxPageSetupDialogData m_pageSetupData
SCH_DESIGN_BLOCK_PANE * GetDesignBlockPane() const
SELECTION & GetCurrentSelection() override
Get the current selection from the canvas area.
void mapExistingAnnotation(std::map< wxString, wxString > &aMap)
Fill a map of uuid -> reference from the currently loaded schematic.
Definition annotate.cpp:37
std::vector< std::unique_ptr< SCH_ITEM > > m_items_to_repeat
For the repeat-last-item cmd.
void FocusOnItem(EDA_ITEM *aItem, bool aAllowScroll=true) override
Focus on a particular canvas item.
void onResizeNetNavigator(wxSizeEvent &aEvent)
void updateSelectionFilterVisbility() override
Selection filter panel doesn't have a dedicated visibility control, so show it if any other AUI panel...
void onNetNavigatorSelChanging(wxTreeEvent &aEvent)
void SetExecFlags(const int aFlags)
Set (adds) specified flags for next execution of external generator of the netlist or bom.
bool AllowCaseSensitiveFileNameClashes(const wxString &aOldName, const wxString &aSchematicFileName)
Check aSchematicFileName for a potential file name case sensitivity clashes.
Definition sheet.cpp:963
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag and update other data struc...
void showNetNavigatorMenu(const wxTreeItemId &aItem)
void ShowAllIntersheetRefs(bool aShow)
void SaveProjectLocalSettings() override
Save changes to the project settings to the project (.pro) file.
bool OpenProjectFiles(const std::vector< wxString > &aFileSet, int aCtl=0) override
Open a project or set of files given by aFileList.
void DeleteAnnotation(ANNOTATE_SCOPE_T aAnnotateScope, bool aRecursive, REPORTER &aReporter)
Clear the current symbol annotation.
Definition annotate.cpp:58
void doCloseWindow() override
std::unique_ptr< API_HANDLER_SCH > m_apiHandler
DIALOG_BOOK_REPORTER * m_diffSymbolDialog
void ToggleLibraryTree() override
void SetHighlightedConnection(const wxString &aConnection, const NET_NAVIGATOR_ITEM_DATA *aSelection=nullptr)
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
bool ReadyToNetlist(const wxString &aAnnotateMessage)
Check if we are ready to write a netlist file for the current schematic.
wxWindow * createHighlightedNetNavigator()
void onCloseErcDialog(wxCommandEvent &aEvent)
void InitSheet(SCH_SHEET *aSheet, const wxString &aNewFilename)
Definition sheet.cpp:114
void UpdateHierarchySelection()
Update the hierarchy navigation tree selection (cross-probe from schematic to hierarchy pane).
void SaveCopyInUndoList(SCH_SCREEN *aScreen, SCH_ITEM *aItemToCopy, UNDO_REDO aTypeCommand, bool aAppend)
Create a copy of the current schematic item, and put it in the undo list.
bool m_syncingPcbToSchSelection
void DirtyHighlightedConnection()
void SetScreen(BASE_SCREEN *aScreen) override
bool AskToSaveChanges()
Check if any of the screens has unsaved changes and asks the user whether to save or drop them.
wxString GetNetListerCommand() const
friend class SCH_EDITOR_CONTROL
bool doAutoSave() override
Save the schematic files that have been modified and not yet saved.
wxChoice * m_currentVariantCtrl
void SaveSymbolToSchematic(const LIB_SYMBOL &aSymbol, const KIID &aSchematicSymbolUUID)
Update a schematic symbol from a LIB_SYMBOL.
bool UpdateDesignBlockFromSelection(const LIB_ID &aLibId)
void SetCurrentVariant(const wxString &aVariantName)
void onSize(wxSizeEvent &aEvent)
DIALOG_SCHEMATIC_SETUP * m_schematicSetupDialog
bool LoadSheetFromFile(SCH_SHEET *aSheet, SCH_SHEET_PATH *aCurrentSheet, const wxString &aFileName, bool aSkipRecursionCheck=false, bool aSkipLibCheck=false)
Load a the KiCad schematic file aFileName into the sheet aSheet.
Definition sheet.cpp:408
void SetAltPinFunction(SCH_PIN *aPin, const wxString &aFunction)
void CommonSettingsChanged(int aFlags) override
Called after the preferences dialog is run.
void UpdateVariantSelectionCtrl(const wxArrayString &aVariantNames)
Update the variant name control on the main toolbar.
void doReCreateMenuBar() override
void ShowChangedLanguage() override
Redraw the menus and what not in current language.
void SendSelectItemsToPcb(const std::vector< EDA_ITEM * > &aItems, bool aForce)
Send items to board editor for selection.
bool ShowAddVariantDialog()
Show a dialog to create a new variant with name and description.
BITMAP_BUTTON * m_netNavigatorMenuButton
std::unique_ptr< API_HANDLER_COMMON > m_apiHandlerCommon
void onNetNavigatorKey(wxKeyEvent &aEvent)
wxPageSetupDialogData & GetPageSetupData()
void configureToolbars() override
std::vector< wxEvtHandler * > m_schematicChangeListeners
void SendCrossProbeClearHighlight()
Tell Pcbnew to clear the existing highlighted net, if one exists.
void HardRedraw() override
Rebuild the GAL and redraw the screen.
void OnClearFileHistory(wxCommandEvent &aEvent)
void MakeNetNavigatorNode(const wxString &aNetName, wxTreeItemId aParentId, const NET_NAVIGATOR_ITEM_DATA *aSelection, bool aSingleSheetSchematic)
bool GetShowAllPins() const override
Allow edit frame to show/hide hidden pins.
PANEL_REMOTE_SYMBOL * m_remoteSymbolPane
void SelectBodyStyle(SCH_SYMBOL *aSymbol, int aBodyStyle)
bool WriteNetListFile(int aFormat, const wxString &aFullFileName, unsigned aNetlistOptions, REPORTER *aReporter=nullptr)
Create a netlist file.
void ClearUndoORRedoList(UNDO_REDO_LIST whichList, int aItemCount=-1) override
Free the undo or redo list from aList element.
SCHEMATIC * m_schematic
The currently loaded schematic.
void onNetNavigatorFilterChanged(wxCommandEvent &aEvent)
void onCloseSymbolFieldsTableDialog(wxCommandEvent &aEvent)
SCH_SHEET_PATH & GetCurrentSheet() const
void RecalculateConnections(SCH_COMMIT *aCommit, SCH_CLEANUP_FLAGS aCleanupFlags, PROGRESS_REPORTER *aProgressReporter=nullptr)
Generate the connection data for the entire schematic hierarchy.
wxString m_netNavigatorFilterValue
void ProjectChanged() override
Notification event that the project has changed.
void OnLoadFile(wxCommandEvent &event)
const SCH_ITEM * GetSelectedNetNavigatorItem() const
PLUGIN_ACTION_SCOPE PluginActionScope() const override
SCHEMATIC & Schematic() const
void updateTitle()
Set the main window title bar text.
void ExecuteRemoteCommand(const char *cmdline) override
Execute a remote command sent via a socket on port KICAD_SCH_PORT_SERVICE_NUMBER (which defaults to 4...
const std::vector< std::unique_ptr< SCH_ITEM > > & GetRepeatItems() const
Return the items which are to be repeated with the insert key.
void SetSchematic(SCHEMATIC *aSchematic)
bool saveSchematicFile(SCH_SHEET *aSheet, const wxString &aSavePath)
Save aSheet to a schematic file.
void ToggleSearch()
Toggle the show/hide state of Search pane.
void DrawCurrentSheetToClipboard()
Use the wxWidgets print code to draw an image of the current sheet onto the clipboard.
Definition sheet.cpp:865
bool LoadProjectSettings()
Load the KiCad project file (*.pro) settings specific to Eeschema.
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
void RefreshNetNavigator(const NET_NAVIGATOR_ITEM_DATA *aSelection=nullptr)
wxSearchCtrl * m_netNavigatorFilter
wxString GetFullScreenDesc() const override
static const wxString SearchPaneName()
DIALOG_BOOK_REPORTER * GetSymbolDiffDialog()
bool canCloseWindow(wxCloseEvent &aCloseEvent) override
void onNetNavigatorContextMenu(wxContextMenuEvent &aEvent)
int m_exec_flags
Flags of the wxExecute() function to call a custom net list generator.
void RecomputeIntersheetRefs()
Update the schematic's page reference map for all global labels, and refresh the labels so that they ...
const wxString & GetHighlightedNetChain() const
bool checkForNoFullyDefinedLibIds(SCH_SHEET *aSheet)
Verify that the symbol library links aSheet and all of its child sheets have been remapped to the sym...
Definition sheet.cpp:92
DIALOG_ERC * GetErcDialog()
void sendNetlistToCvpcb()
Send the KiCad netlist over to CVPCB.
bool EditSheetProperties(SCH_SHEET *aSheet, SCH_SHEET_PATH *aHierarchy, bool *aIsUndoable=nullptr, bool *aClearAnnotationNewItems=nullptr, bool *aUpdateHierarchyNavigator=nullptr, wxString *aSourceSheetFilename=nullptr)
Edit an existing sheet or add a new sheet to the schematic.
Definition sheet.cpp:844
SCH_DESIGN_BLOCK_PANE * m_designBlocksPane
void UpdateHierarchyNavigator(bool aRefreshNetNavigator=true, bool aClear=false)
Update the hierarchy navigation tree and history.
SCH_EDIT_FRAME(KIWAY *aKiway, wxWindow *aParent)
void ToggleSchematicHierarchy()
Toggle the show/hide state of the left side schematic navigation panel.
bool importFile(const wxString &aFileName, int aFileType, const std::map< std::string, UTF8 > *aProperties=nullptr)
Load the given filename but sets the path to the current project path.
void SendCrossProbeNetName(const wxString &aNetName)
Send a net name to Pcbnew for highlighting.
std::vector< KIID > m_crossProbeFlashItems
Items to flash.
wxString m_highlightedNetChain
void LoadDrawingSheet()
Load the drawing sheet file.
void onNetNavigatorMenuCommand(wxCommandEvent &aEvent)
void KiwayMailIn(KIWAY_MAIL_EVENT &aEvent) override
Receive #KIWAY_ROUTED_EVENT messages from other players.
const SCH_ITEM * SelectNextPrevNetNavigatorItem(bool aNext)
void SetSheetNumberAndCount()
Set the m_ScreenNumber and m_NumberOfScreens members for screens.
void SaveSettings(APP_SETTINGS_BASE *aCfg) override
Save common frame parameters to a configuration data file.
std::vector< LIB_ID > m_designBlockHistoryList
void OnPageSettingsChange() override
Called when modifying the page settings.
void ClearRepeatItemsList()
Clear the list of items which are to be repeated with the insert key.
void SelectUnit(SCH_SYMBOL *aSymbol, int aUnit)
const BOX2I GetDocumentExtents(bool aIncludeAllVisible=true) const override
Return bounding box of document with option to not include some items.
wxGenericTreeCtrl * m_netNavigator
int CheckAnnotate(ANNOTATION_ERROR_HANDLER aErrorHandler, ANNOTATE_SCOPE_T aAnnotateScope, bool aRecursive, SYMBOL_FILTER aSymbolFilter)
Check for annotation errors.
Definition annotate.cpp:510
void CaptureHierarchyPaneSize()
void StartCrossProbeFlash(const std::vector< SCH_ITEM * > &aItems)
void initScreenZoom()
Initialize the zoom value of the current screen and mark the screen as zoom-initialized.
bool CheckSheetForRecursion(SCH_SHEET *aSheet, SCH_SHEET_PATH *aCurrentSheet)
Verify that aSheet will not cause a recursion error in aCurrentSheet.
Definition sheet.cpp:58
void UpdateLabelsHierarchyNavigator()
Update the hierarchy navigation tree labels.
void ClearExecFlags(const int aFlags)
Clear (removes) specified flags that not needed for next execution of external generator of the netli...
static const wxString SchematicHierarchyPaneName()
void setupUIConditions() override
Setup the UI conditions for the various actions and their controls in this frame.
EDA_ITEM * ResolveItem(const KIID &aId, bool aAllowNullptrReturn=false) const override
Fetch an item by KIID.
wxString m_netNavigatorMenuNetName
void unitsChangeRefresh() override
Called when when the units setting has changed to allow for any derived classes to handle refreshing ...
void RemoveSchematicChangeListener(wxEvtHandler *aListener)
Remove aListener to from the schematic changed listener list.
bool CreateArchiveLibrary(const wxString &aFileName)
Create a library aFileName that contains all symbols used in the current schematic.
void SetCurrentSheet(const SCH_SHEET_PATH &aSheet)
void AnnotateSymbols(SCH_COMMIT *aCommit, ANNOTATE_SCOPE_T aAnnotateScope, ANNOTATE_ORDER_T aSortOption, ANNOTATE_ALGO_T aAlgoOption, bool aRecursive, int aStartNumber, bool aResetAnnotation, bool aRegroupUnits, bool aRepairTimestamps, REPORTER &aReporter, SYMBOL_FILTER aSymbolFilter)
Annotate the symbols in the schematic that are not currently annotated.
Definition annotate.cpp:225
void SetHighlightedNetChain(const wxString &aNetChain)
void DisplayCurrentSheet()
Draw the current sheet on the display.
bool ChangeSheetFile(SCH_SHEET *aSheet, const wxString &aNewFilename, bool *aClearAnnotationNewItems=nullptr, bool *aIsUndoable=nullptr, const wxString *aSourceSheetFilename=nullptr)
Change the file backing a schematic sheet.
Definition sheet.cpp:173
void SetNetListerCommand(const wxString &aCommand)
void PutDataInPreviousState(PICKED_ITEMS_LIST *aList)
Restore an undo or redo command to put data pointed by aList in the previous state.
int ModalAnnotate(const wxString &aMessage)
Run a modal version of the annotate dialog for a specific purpose.
~SCH_EDIT_FRAME() override
void onVariantSelected(wxCommandEvent &aEvent)
const wxString & GetHighlightedConnection() const
DIALOG_ERC * m_ercDialog
void UpdateItem(EDA_ITEM *aItem, bool isAddOrDelete=false, bool aUpdateRtree=false) override
Mark an item for refresh.
wxString m_netListerCommand
Command line to call a custom net list generator.
bool TrimWire(SCH_COMMIT *aCommit, const VECTOR2I &aStart, const VECTOR2I &aEnd)
If any single wire passes through both points, remove the portion between the two points,...
void UpdateNetHighlightStatus()
wxString GetScreenDesc() const override
Return a human-readable description of the current screen.
void onNetNavigatorItemMenu(wxTreeEvent &aEvent)
void ClearToolbarControl(int aId) override
void SelectNetNavigatorItem(const NET_NAVIGATOR_ITEM_DATA *aSelection=nullptr)
void AddCopyForRepeatItem(const SCH_ITEM *aItem)
DIALOG_SYMBOL_FIELDS_TABLE * GetSymbolFieldsTableDialog()
void OnResizeHierarchyNavigator(wxSizeEvent &aEvent)
bool SaveSheetAsDesignBlock(const wxString &aLibraryName, SCH_SHEET_PATH &aSheetPath)
wxString GetCurrentFileName() const override
Get the full filename + path of the currently opened file in the frame.
void UpdateDesignBlockOptions()
Design block panel options have changed and the panel needs to be refreshed.
wxString m_highlightedConn
The highlighted net or bus or empty string.
wxGenericTreeCtrl * GetNetNavigator()
static const wxString NetNavigatorPaneName()
void SetCrossProbeConnection(const SCH_CONNECTION *aConnection)
Send a connection (net or bus) to Pcbnew for highlighting.
bool UpdateDesignBlockFromSheet(const LIB_ID &aLibId, SCH_SHEET_PATH &aSheetPath)
void onCloseSymbolDiffDialog(wxCommandEvent &aEvent)
bool SaveSelectionAsDesignBlock(const wxString &aLibraryName)
void TestDanglingEnds()
Test all of the connectable objects in the schematic for unused connection points.
bool SaveProject(bool aSaveAs=false)
Save the currently-open schematic (including its hierarchy) and associated project.
void IntersheetRefUpdate(SCH_GLOBALLABEL *aItem) override
Callback from schematic ref update.
void saveProjectSettings() override
Save any design-related project settings associated with this frame.
void OnExit(wxCommandEvent &event)
void DeleteJunction(SCH_COMMIT *aCommit, SCH_ITEM *aItem)
Remove a given junction and heals any wire segments under the junction.
void AutoRotateItem(SCH_SCREEN *aScreen, SCH_ITEM *aItem)
Automatically set the rotation of an item (if the item supports it).
wxTimer m_crossProbeFlashTimer
Timer to toggle selection visibility.
void AddSchematicChangeListener(wxEvtHandler *aListener)
Add aListener to post #EDA_EVT_SCHEMATIC_CHANGED command events to.
HIERARCHY_PANE * m_hierarchy
DIALOG_SYMBOL_FIELDS_TABLE * m_symbolFieldsTableDialog
std::unique_ptr< GRID_HELPER > MakeGridHelper() override
void UpdateHopOveredWires(SCH_ITEM *aItem)
SEVERITY GetSeverity(int aErrorCode) const override
void onPluginAvailabilityChanged(wxCommandEvent &aEvt)
void onNetNavigatorSelection(wxTreeEvent &aEvent)
void FindNetInInspector(const wxString &aNetName)
SCH_JUNCTION * AddJunction(SCH_COMMIT *aCommit, SCH_SCREEN *aScreen, const VECTOR2I &aPos)
void SaveCopyForRepeatItem(const SCH_ITEM *aItem)
Clone aItem and owns that clone in this container.
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition sch_item.h:162
Segment description base class to describe items which have 2 end points (track, wire,...
Definition sch_line.h:38
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition sch_sheet.h:44
Schematic symbol object.
Definition sch_symbol.h:69
An 8 bit string that is assuredly encoded in UTF8, and supplies special conversion support to and fro...
Definition utf8.h:67
Base window classes and related definitions.
STL namespace.
PLUGIN_ACTION_SCOPE
SEVERITY
wxDECLARE_EVENT(EDA_EVT_SCHEMATIC_CHANGING, wxCommandEvent)
SCH_SEARCH_T
Schematic search type used by the socket link with Pcbnew.
@ HIGHLIGHT_SYMBOL
@ HIGHLIGHT_PIN
std::function< void(ERCE_T aType, const wxString &aMsg, SCH_REFERENCE *aItemA, SCH_REFERENCE *aItemB)> ANNOTATION_ERROR_HANDLER
Define a standard error handler for annotation errors.
ANNOTATE_ORDER_T
Schematic annotation order options.
ANNOTATE_SCOPE_T
Schematic annotation scope options.
ANNOTATE_ALGO_T
Schematic annotation type options.
SYMBOL_FILTER
SCH_CLEANUP_FLAGS
Definition schematic.h:76
UNDO_REDO
Undo Redo considerations: Basically we have 3 cases New item Deleted item Modified item there is also...
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:683