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
36#include <core/typeinfo.h>
37#include <eda_base_frame.h>
38#include <eeschema_settings.h>
39#include <math/box2.h>
40#include <sch_base_frame.h>
41#include <template_fieldnames.h>
43#include <map>
45
46class SCH_ITEM;
47class EDA_ITEM;
48class SCH_LINE;
49class SCH_TEXT;
50class SCH_BITMAP;
51class SCH_SHEET;
52class SCH_SHEET_PATH;
53class SCH_SHEET_PIN;
54class SCH_SYMBOL;
55class SCH_FIELD;
56class SCH_JUNCTION;
57class SCHEMATIC;
58class SCH_COMMIT;
62class DIALOG_ERC;
64class RESCUER;
65class HIERARCHY_PANE;
68class API_HANDLER_SCH;
71class wxSearchCtrl;
72class wxGenericTreeCtrl;
73class BITMAP_BUTTON;
74
75
76namespace SCH_CONNECTIVITY
77{
79}
80
87
88
89wxDECLARE_EVENT( EDA_EVT_SCHEMATIC_CHANGING, wxCommandEvent );
90wxDECLARE_EVENT( EDA_EVT_SCHEMATIC_CHANGED, wxCommandEvent );
91
92
96class NET_NAVIGATOR_ITEM_DATA : public wxTreeItemData
97{
98public:
99 NET_NAVIGATOR_ITEM_DATA( const SCH_SHEET_PATH& aSheetPath, const SCH_ITEM* aItem ) :
100 m_sheetPath( aSheetPath ),
101 m_item( aItem )
102 {
103 }
104
106 m_item( nullptr )
107 {
108 }
109
111 const SCH_ITEM* GetItem() const { return m_item; }
112
113 bool operator==( const NET_NAVIGATOR_ITEM_DATA& aRhs ) const
114 {
115 return ( m_sheetPath == aRhs.m_sheetPath ) && ( m_item == aRhs.m_item );
116 }
117
119 {
120 if( this == &aItemData )
121 return *this;
122
123 m_sheetPath = aItemData.m_sheetPath;
124 m_item = aItemData.m_item;
125
126 return *this;
127 }
128
129private:
132};
133
134
139{
140public:
141 SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent );
142 ~SCH_EDIT_FRAME() override;
143
144 SCH_SCREEN* GetScreen() const override;
145
146 SELECTION& GetCurrentSelection() override;
147
148 SCHEMATIC& Schematic() const;
149
150 std::unique_ptr<GRID_HELPER> MakeGridHelper() override;
151
155 bool GetShowAllPins() const override;
156
160 void SaveProjectLocalSettings() override;
161
167 bool LoadProjectSettings();
168
172
180
185 void RefreshProjectSettings( bool aAliasesChanged );
186
190 void LoadDrawingSheet();
191
192 void ShowSchematicSetupDialog( const wxString& aInitialPage = wxEmptyString );
193
194 void LoadSettings( APP_SETTINGS_BASE* aCfg ) override;
195 void SaveSettings( APP_SETTINGS_BASE* aCfg ) override;
196
198
199 void setupUIConditions() override;
200
206 bool IsContentModified() const override;
207
212 void OnModify() override;
213
219 void SetContentModified( bool aModified );
220
221 SEVERITY GetSeverity( int aErrorCode ) const override;
222
226 wxString GetScreenDesc() const override;
227 wxString GetFullScreenDesc() const override;
228
249 void ExecuteRemoteCommand( const char* cmdline ) override;
250
251 void HandleRemoteNetHighlight( const wxString& aNetName );
252
253 void KiwayMailIn( KIWAY_MAIL_EVENT& aEvent ) override;
254
259
264
268 void AutoRotateItem( SCH_SCREEN* aScreen, SCH_ITEM* aItem );
269
273 void UpdateHierarchyNavigator( bool aRefreshNetNavigator = true, bool aClear = false );
274
282
288
293
294 void AddVariant();
295
296 void RemoveVariant();
297
299
300 void RenameVariant();
301
302 void CopyVariant();
303
309 void SyncVariantUI();
310
311 void SetCurrentVariant( const wxString& aVariantName );
312
318 bool ShowAddVariantDialog( wxWindow* aParent = nullptr );
319
320 void onVariantSelected( wxCommandEvent& aEvent );
321
325 void TestDanglingEnds();
326
336 void SendSelectItemsToPcb( const std::vector<EDA_ITEM*>& aItems, bool aForce );
337
343 void SendCrossProbeNetName( const wxString& aNetName );
344
350 void SetCrossProbeConnection( const wxString& aName );
351
356
357 const wxString& GetHighlightedConnection() const
358 {
359 return m_highlightedConn;
360 }
361
362 const wxString& GetHighlightedNetChain() const
363 {
365 }
366
367 void SetHighlightedConnection( const wxString& aConnection, const NET_NAVIGATOR_ITEM_DATA* aSelection = nullptr,
368 bool aForceNetNavigatorRefresh = false );
369
371
372 void SetHighlightedNetChain( const wxString& aNetChain )
373 {
374 m_highlightedNetChain = aNetChain;
375 if( m_schematic )
376 m_schematic->SetHighlightedNetChain( aNetChain );
377 }
378
390 bool ReadyToNetlist( const wxString& aAnnotateMessage, bool* aUserCancelled = nullptr );
391
407 bool WriteNetListFile( int aFormat, const wxString& aFullFileName, unsigned aNetlistOptions,
408 REPORTER* aReporter = nullptr );
409
417 void DeleteAnnotation( ANNOTATE_SCOPE_T aAnnotateScope, bool aRecursive, REPORTER& aReporter );
418
444 void AnnotateSymbols( SCH_COMMIT* aCommit, ANNOTATE_SCOPE_T aAnnotateScope, ANNOTATE_ORDER_T aSortOption,
445 ANNOTATE_ALGO_T aAlgoOption, bool aRecursive, int aStartNumber, bool aResetAnnotation,
446 bool aRegroupUnits, bool aRepairTimestamps, REPORTER& aReporter );
447
465 int CheckAnnotate( ANNOTATION_ERROR_HANDLER aErrorHandler, ANNOTATE_SCOPE_T aAnnotateScope,
466 bool aRecursive );
467
474 int ModalAnnotate( const wxString& aMessage );
475
476 // Functions used for hierarchy handling
478
479 void SetCurrentSheet( const SCH_SHEET_PATH& aSheet );
480
481 void UpdateItem( EDA_ITEM* aItem, bool isAddOrDelete = false, bool aUpdateRtree = false ) override;
482
488 void HardRedraw() override;
489
493 void DisplayCurrentSheet();
494
499
506 void OnPageSettingsChange() override;
507
514
515 wxPageSetupDialogData& GetPageSetupData() { return m_pageSetupData; }
516
517 void NewProject();
518 void LoadProject();
519 void ProjectChanged() override;
520
528 bool SaveProject( bool aSaveAs = false );
529
530 bool OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl = 0 ) override;
531
538 bool ReloadFromDisk();
539
545 bool ConfirmReloadFromDisk( const wxString& aMessage, const wxString& aTitle );
546
553
554 void SetSchematic( SCHEMATIC* aSchematic );
555
556 wxString GetCurrentFileName() const override;
557
558 bool CanAcceptApiCommands() override;
559
567 bool AskToSaveChanges();
568
569 SCH_JUNCTION* AddJunction( SCH_COMMIT* aCommit, SCH_SCREEN* aScreen, const VECTOR2I& aPos );
570
580 bool TrimWire( SCH_COMMIT* aCommit, const VECTOR2I& aStart, const VECTOR2I& aEnd );
581
582 void OnOpenPcbnew();
583 void OnOpenCvpcb();
584 void OnUpdatePCB();
585 void OnAnnotate();
586
594 bool CheckSheetForRecursion( SCH_SHEET* aSheet, SCH_SHEET_PATH* aCurrentSheet );
595
608 bool AllowCaseSensitiveFileNameClashes( const wxString& aOldName,
609 const wxString& aSchematicFileName );
610
644 bool EditSheetProperties( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHierarchy,
645 bool* aIsUndoable = nullptr, bool* aClearAnnotationNewItems = nullptr,
646 bool* aUpdateHierarchyNavigator = nullptr,
647 wxString* aSourceSheetFilename = nullptr );
648
649 void InitSheet( SCH_SHEET* aSheet, const wxString& aNewFilename );
650
668 bool ChangeSheetFile( SCH_SHEET* aSheet, const wxString& aNewFilename,
669 bool* aClearAnnotationNewItems = nullptr,
670 bool* aIsUndoable = nullptr,
671 const wxString* aSourceSheetFilename = nullptr );
672
723 bool LoadSheetFromFile( SCH_SHEET* aSheet, SCH_SHEET_PATH* aCurrentSheet, const wxString& aFileName,
724 bool aSkipRecursionCheck = false, bool aSkipLibCheck = false );
725
732 void DeleteJunction( SCH_COMMIT* aCommit, SCH_ITEM* aItem );
733
734 void UpdateHopOveredWires( SCH_ITEM* aItem );
735
744 void SelectUnit( SCH_SYMBOL* aSymbol, int aUnit, SCH_COMMIT* aCommit = nullptr );
745
754 void SelectBodyStyle( SCH_SYMBOL* aSymbol, int aBodyStyle, SCH_COMMIT* aCommit = nullptr );
755
756 void SetAltPinFunction( SCH_PIN* aPin, const wxString& aFunction );
757
758 /* Undo - redo */
759
776 void SaveCopyInUndoList( SCH_SCREEN* aScreen, SCH_ITEM* aItemToCopy, UNDO_REDO aTypeCommand,
777 bool aAppend );
778
786 void SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsList, UNDO_REDO aTypeCommand,
787 bool aAppend );
788
795
807 void ClearUndoORRedoList( UNDO_REDO_LIST whichList, int aItemCount = -1 ) override;
808
812 void SaveCopyForRepeatItem( const SCH_ITEM* aItem );
813 void AddCopyForRepeatItem( const SCH_ITEM* aItem );
814
820 const std::vector<std::unique_ptr<SCH_ITEM>>& GetRepeatItems() const
821 {
822 return m_items_to_repeat;
823 }
824
831 {
832 m_items_to_repeat.clear();
833 }
834
835 EDA_ITEM* ResolveItem( const KIID& aId, bool aAllowNullptrReturn = false ) const override;
836
843
850 bool CreateArchiveLibrary( const wxString& aFileName );
851
852 bool SaveSheetAsDesignBlock( const wxString& aLibraryName, SCH_SHEET_PATH& aSheetPath );
853
854 bool SaveSelectionAsDesignBlock( const wxString& aLibraryName );
855
856 bool UpdateDesignBlockFromSheet( const LIB_ID& aLibId, SCH_SHEET_PATH& aSheetPath );
857
858 bool UpdateDesignBlockFromSelection( const LIB_ID& aLibId );
859
861
862 void SetNetListerCommand( const wxString& aCommand ) { m_netListerCommand = aCommand; }
863
867 void DefaultExecFlags() { m_exec_flags = wxEXEC_SYNC; }
868
874 void SetExecFlags( const int aFlags ) { m_exec_flags |= aFlags; }
875
882 void ClearExecFlags( const int aFlags ) { m_exec_flags &= ~( aFlags ); }
883
884 wxString GetNetListerCommand() const { return m_netListerCommand; }
885
895 bool RecalculateConnections( SCH_COMMIT* aCommit, SCH_CLEANUP_FLAGS aCleanupFlags,
896 PROGRESS_REPORTER* aProgressReporter = nullptr, bool aCleanupDone = false );
897
898 // Commit source cleanup before the exporter's full connectivity rebuild.
899 void PrepareForNetlist();
900
901 // Refresh connectivity-dependent display state after a model rebuild.
902 void RefreshConnectivity( bool aForce = false, const SCH_CONNECTIVITY::CHANGE_SET* aChanges = nullptr );
903
907 void CommonSettingsChanged( int aFlags ) override;
908
910
911 void ShowChangedLanguage() override;
912
913 void SetScreen( BASE_SCREEN* aScreen ) override;
914
915 const BOX2I GetDocumentExtents( bool aIncludeAllVisible = true ) const override;
916
917 void FocusOnItem( EDA_ITEM* aItem, bool aAllowScroll = true ) override;
918
921
930 bool SaveSymbolToSchematic( const LIB_SYMBOL& aSymbol, const KIID& aSchematicSymbolUUID );
931
937
941 void IntersheetRefUpdate( SCH_GLOBALLABEL* aItem ) override;
942
943 void ShowAllIntersheetRefs( bool aShow );
944
949
953 void ToggleSearch();
954
955 void ToggleProperties() override;
956
957 void ToggleLibraryTree() override;
958
960
961
963
965 void ClearErcMarkers();
966 void RefreshErcMarkers();
967
969
970 wxGenericTreeCtrl* GetNetNavigator();
971
973
977 static const wxString SchematicHierarchyPaneName()
978 {
979 return wxT( "SchematicHierarchy" );
980 }
981
985 static const wxString SearchPaneName() { return wxT( "Search" ); }
986
987 bool IsSearchPaneShown() { return m_auimgr.GetPane( SearchPaneName() ).IsShown(); }
988
989 void FocusSearch();
990
1000 void AddSchematicChangeListener( wxEvtHandler* aListener );
1001
1005 void RemoveSchematicChangeListener( wxEvtHandler* aListener );
1006
1007 static const wxString NetNavigatorPaneName()
1008 {
1009 return wxS( "NetNavigator" );
1010 }
1011
1012 void RefreshNetNavigator( const NET_NAVIGATOR_ITEM_DATA* aSelection = nullptr,
1013 const std::vector<wxString>* aChangedNets = nullptr );
1014
1015 void MakeNetNavigatorNode( const wxString& aNetName, wxTreeItemId aParentId,
1016 const NET_NAVIGATOR_ITEM_DATA* aSelection,
1017 const SCH_CONNECTIVITY::NAVIGATION_QUERY& aQuery );
1018
1019 void SelectNetNavigatorItem( const NET_NAVIGATOR_ITEM_DATA* aSelection = nullptr );
1020
1021 const SCH_ITEM* SelectNextPrevNetNavigatorItem( bool aNext );
1022
1023 void ToggleNetNavigator();
1024 void FindNetInInspector( const wxString& aNetName );
1025
1027 {
1029 }
1030
1031 void ClearToolbarControl( int aId ) override;
1032
1033 void StartCrossProbeFlash( const std::vector<SCH_ITEM*>& aItems );
1034
1042 bool ValidateNewVariantName( const wxString& aName, const wxString& aExcludeName );
1043
1044 DECLARE_EVENT_TABLE()
1045
1046protected:
1052 bool doAutoSave() override;
1053
1054 bool canRunAutoSave() const override;
1055
1060 bool interactiveOperationInProgress() const;
1061
1062 void configureToolbars() override;
1063
1064 void doReCreateMenuBar() override;
1065
1069 void sendNetlistToCvpcb();
1070
1071 void saveProjectSettings() override;
1072
1073 void onCloseSymbolDiffDialog( wxCommandEvent& aEvent );
1074
1075 void onCloseErcDialog( wxCommandEvent& aEvent );
1076
1077 void onCloseSymbolFieldsTableDialog( wxCommandEvent& aEvent );
1078
1079 void unitsChangeRefresh() override;
1080
1081 void updateSelectionFilterVisbility() override;
1082
1083 void onPluginAvailabilityChanged( wxCommandEvent& aEvt );
1084
1085private:
1087 void registerHistorySaver();
1088
1090 void selectCurrentVariant();
1091
1092 // Called when resizing the Hierarchy Navigator panel
1093 void OnResizeHierarchyNavigator( wxSizeEvent& aEvent );
1094
1095 void onResizeNetNavigator( wxSizeEvent& aEvent );
1096
1097 // Sets up the tool framework
1098 void setupTools();
1099
1100 void OnExit( wxCommandEvent& event );
1101
1102 void OnLoadFile( wxCommandEvent& event );
1103 void OnImportProject();
1104
1105 void OnClearFileHistory( wxCommandEvent& aEvent );
1106
1107 bool canCloseWindow( wxCloseEvent& aCloseEvent ) override;
1108 void doCloseWindow() override;
1109
1118 void updateTitle();
1119
1123 void initScreenZoom();
1124
1134
1142 bool importFile( const wxString& aFileName, int aFileType,
1143 const std::map<std::string, UTF8>* aProperties = nullptr );
1144
1154 bool saveSchematicFile( SCH_SHEET* aSheet, const wxString& aSavePath, bool isSaveAs );
1155
1161 void mapExistingAnnotation( std::map<wxString, wxString>& aMap );
1162
1164
1165 void onNetNavigatorDPIChanged( wxDPIChangedEvent& aEvent );
1166 void onNetNavigatorFilterChanged( wxCommandEvent& aEvent );
1167 void onNetNavigatorKey( wxKeyEvent& aEvent );
1168 void onNetNavigatorItemMenu( wxTreeEvent& aEvent );
1169 void onNetNavigatorContextMenu( wxContextMenuEvent& aEvent );
1170 void onNetNavigatorMenuCommand( wxCommandEvent& aEvent );
1171 void showNetNavigatorMenu( const wxTreeItemId& aItem );
1172
1173 void onNetNavigatorSelection( wxTreeEvent& aEvent );
1174
1175 void onNetNavigatorSelChanging( wxTreeEvent& aEvent );
1176
1178
1179 void OnCrossProbeFlashTimer( wxTimerEvent& aEvent );
1180
1181private:
1182 // The schematic editor control class should be able to access some internal
1183 // functions of the editor frame.
1185
1186 enum
1187 {
1188 ID_NET_NAVIGATOR_EXPAND_ALL = wxID_HIGHEST + 400,
1193 };
1194
1195 void subscribeConnectivity();
1200
1201 wxPageSetupDialogData m_pageSetupData;
1202 std::vector<std::unique_ptr<SCH_ITEM>> m_items_to_repeat;
1203
1208
1214
1215
1221 std::map<wxString, wxTreeItemId> m_netNavigatorNodes;
1224
1225 bool m_syncingPcbToSchSelection; // Recursion guard when synchronizing selection from PCB
1226 // Cross-probe flashing support
1229 std::vector<KIID> m_crossProbeFlashItems;
1233
1234 std::vector<wxEvtHandler*> m_schematicChangeListeners;
1235
1236 std::vector<LIB_ID> m_designBlockHistoryList;
1239
1241
1242 std::unique_ptr<API_HANDLER_SCH> m_apiHandler;
1243 std::unique_ptr<API_HANDLER_COMMON> m_apiHandlerCommon;
1244 std::unique_ptr<API_HANDLER_LIBRARIES> m_apiLibrariesHandler;
1245};
1246
1247
1248#endif // SCH_EDIT_FRAME_H
BOX2< VECTOR2I > BOX2I
Definition box2.h:917
Base class for API handlers related to library management.
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:98
Definition kiid.h:46
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:348
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:114
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)
The net navigator's tree control.
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:73
Holds all the data relating to one schematic.
Definition schematic.h:155
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
Commit for the schematic and symbol editors.
Definition sch_commit.h:54
One UI operation's hierarchy index.
Main-thread registration owner.
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)
bool ValidateNewVariantName(const wxString &aName, const wxString &aExcludeName)
Validate a user-entered variant name for the rename/copy dialogs.
void ToggleProperties() override
bool interactiveOperationInProgress() const
Return true when a tool other than passive selection or an idle point editor is active.
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
wxString m_netNavigatorConnection
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:38
void registerHistorySaver()
Register the loaded schematic and its project for autosave history. A no-op when they already are.
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 ReloadProjectFileSettings()
Bring the frame in line with a project file that was reread from disk.
bool SaveSymbolToSchematic(const LIB_SYMBOL &aSymbol, const KIID &aSchematicSymbolUUID)
Update a schematic symbol from a LIB_SYMBOL.
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:984
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:105
void doCloseWindow() override
std::unique_ptr< API_HANDLER_SCH > m_apiHandler
NET_NAVIGATOR_TREE * m_netNavigator
DIALOG_BOOK_REPORTER * m_diffSymbolDialog
void ToggleLibraryTree() override
bool TopLevelSheetsChangedOnDisk()
Check whether the last read of the project file brought a top-level sheet list that the open schemati...
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
void MakeNetNavigatorNode(const wxString &aNetName, wxTreeItemId aParentId, const NET_NAVIGATOR_ITEM_DATA *aSelection, const SCH_CONNECTIVITY::NAVIGATION_QUERY &aQuery)
void SyncVariantUI()
Refill the toolbar variant control and any open symbol fields table from the schematic.
wxWindow * createHighlightedNetNavigator()
void onCloseErcDialog(wxCommandEvent &aEvent)
void InitSheet(SCH_SHEET *aSheet, const wxString &aNewFilename)
Definition sheet.cpp:116
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 RefreshNetNavigator(const NET_NAVIGATOR_ITEM_DATA *aSelection=nullptr, const std::vector< wxString > *aChangedNets=nullptr)
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
void SelectBodyStyle(SCH_SYMBOL *aSymbol, int aBodyStyle, SCH_COMMIT *aCommit=nullptr)
Change the body style of aSymbol.
void RefreshConnectivity(bool aForce=false, const SCH_CONNECTIVITY::CHANGE_SET *aChanges=nullptr)
bool doAutoSave() override
Save the schematic files that have been modified and not yet saved.
wxChoice * m_currentVariantCtrl
bool UpdateDesignBlockFromSelection(const LIB_ID &aLibId)
void SetCurrentVariant(const wxString &aVariantName)
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:410
void SetAltPinFunction(SCH_PIN *aPin, const wxString &aFunction)
void ApplyProjectFileSettings()
Apply the project file's render settings.
void CommonSettingsChanged(int aFlags) override
Called after the preferences dialog is run.
void doReCreateMenuBar() override
void ShowChangedLanguage() override
Redraw the menus and what not in current language.
bool canRunAutoSave() const override
Return true when it is safe to run an autosave snapshot right now.
void SendSelectItemsToPcb(const std::vector< EDA_ITEM * > &aItems, bool aForce)
Send items to board editor for selection.
BITMAP_BUTTON * m_netNavigatorMenuButton
bool RecalculateConnections(SCH_COMMIT *aCommit, SCH_CLEANUP_FLAGS aCleanupFlags, PROGRESS_REPORTER *aProgressReporter=nullptr, bool aCleanupDone=false)
Generate the connection data for the entire schematic hierarchy.
std::unique_ptr< API_HANDLER_COMMON > m_apiHandlerCommon
bool ReadyToNetlist(const wxString &aAnnotateMessage, bool *aUserCancelled=nullptr)
Check if we are ready to write a netlist file for the current schematic.
void onNetNavigatorKey(wxKeyEvent &aEvent)
wxPageSetupDialogData & GetPageSetupData()
void configureToolbars() override
std::vector< wxEvtHandler * > m_schematicChangeListeners
bool ReloadFromDisk()
Reload the schematic and all its sheets from disk.
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)
bool GetShowAllPins() const override
Allow edit frame to show/hide hidden pins.
bool CanAcceptApiCommands() override
Check if this frame is ready to accept API commands.
PANEL_REMOTE_SYMBOL * m_remoteSymbolPane
bool WriteNetListFile(int aFormat, const wxString &aFullFileName, unsigned aNetlistOptions, REPORTER *aReporter=nullptr)
Create a netlist file.
bool saveSchematicFile(SCH_SHEET *aSheet, const wxString &aSavePath, bool isSaveAs)
Save aSheet to a schematic 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
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)
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:890
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.
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:94
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:848
SCH_DESIGN_BLOCK_PANE * m_designBlocksPane
void SetContentModified(bool aModified)
Set whether the schematic has unsaved changes.
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.
bool ShowAddVariantDialog(wxWindow *aParent=nullptr)
Show a dialog to create a new variant with name and description.
void SendCrossProbeNetName(const wxString &aNetName)
Send a net name to Pcbnew for highlighting.
bool ConfirmReloadFromDisk(const wxString &aMessage, const wxString &aTitle)
Ask whether to reload when that would discard unsaved edits.
std::vector< KIID > m_crossProbeFlashItems
Items to flash.
wxString m_highlightedNetChain
std::map< wxString, wxTreeItemId > m_netNavigatorNodes
void LoadDrawingSheet()
Load the drawing sheet file.
void SetSyncingSelection(bool aSet)
void onNetNavigatorMenuCommand(wxCommandEvent &aEvent)
void KiwayMailIn(KIWAY_MAIL_EVENT &aEvent) override
Receive KIWAY_MAIL_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.
const BOX2I GetDocumentExtents(bool aIncludeAllVisible=true) const override
Return bounding box of document with option to not include some items.
std::unique_ptr< API_HANDLER_LIBRARIES > m_apiLibrariesHandler
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:60
void UpdateLabelsHierarchyNavigator()
Update the hierarchy navigation tree labels.
SCH_CONNECTIVITY::SUBSCRIPTION m_connectivitySubscription
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 SetHighlightedConnection(const wxString &aConnection, const NET_NAVIGATOR_ITEM_DATA *aSelection=nullptr, bool aForceNetNavigatorRefresh=false)
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)
int CheckAnnotate(ANNOTATION_ERROR_HANDLER aErrorHandler, ANNOTATE_SCOPE_T aAnnotateScope, bool aRecursive)
Check for annotation errors.
Definition annotate.cpp:481
void RefreshComposedReferences()
Redraw the displayed symbols after a sheet suffix change made on another screen.
void selectCurrentVariant()
Select the schematic's current variant in the toolbar control, which must exist.
void SetHighlightedNetChain(const wxString &aNetChain)
void SetCrossProbeConnection(const wxString &aName)
Send a connection (net or bus) to Pcbnew for highlighting.
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:175
void SetNetListerCommand(const wxString &aCommand)
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)
Annotate the symbols in the schematic that are not currently annotated.
Definition annotate.cpp:226
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 RefreshProjectSettings(bool aAliasesChanged)
Update what depends on the schematic's project settings after they changed in memory.
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)
void HandleRemoteNetHighlight(const wxString &aNetName)
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 onNetNavigatorDPIChanged(wxDPIChangedEvent &aEvent)
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.
void SelectUnit(SCH_SYMBOL *aSymbol, int aUnit, SCH_COMMIT *aCommit=nullptr)
Change the unit of aSymbol, swapping with another placed unit if the user asks.
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:170
Segment description base class to describe items which have 2 end points (track, wire,...
Definition sch_line.h:39
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:50
Schematic symbol object.
Definition sch_symbol.h:76
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.
Value keys and the key session of the schematic connectivity engine.
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.
SCH_CLEANUP_FLAGS
Definition schematic.h:98
Difference between two publications.
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:708