KiCad PCB EDA Suite
sch_editor_control.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) 2019 CERN
5  * Copyright (C) 2019 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 
26 #ifndef SCH_EDITOR_CONTROL_H
27 #define SCH_EDITOR_CONTROL_H
28 
29 #include <sch_base_frame.h>
30 #include <tools/ee_tool_base.h>
31 #include <status_popup.h>
32 
33 class SCH_EDIT_FRAME;
34 
40 class SCH_EDITOR_CONTROL : public wxEvtHandler, public EE_TOOL_BASE<SCH_EDIT_FRAME>
41 {
42 public:
44  EE_TOOL_BASE<SCH_EDIT_FRAME>( "eeschema.EditorControl" ),
45  m_probingPcbToSch( false ),
46  m_pickerItem( nullptr )
47  { }
48 
50 
51  int New( const TOOL_EVENT& aEvent );
52  int Open( const TOOL_EVENT& aEvent );
53  int Save( const TOOL_EVENT& aEvent );
54  int SaveAs( const TOOL_EVENT& aEvent );
55  int PageSetup( const TOOL_EVENT& aEvent );
56  int Print( const TOOL_EVENT& aEvent );
57  int Plot( const TOOL_EVENT& aEvent );
58  int Quit( const TOOL_EVENT& aEvent );
59 
60  int FindAndReplace( const TOOL_EVENT& aEvent );
61 
62  int FindNext( const TOOL_EVENT& aEvent );
63  bool HasMatch();
64  int ReplaceAndFindNext( const TOOL_EVENT& aEvent );
65  int ReplaceAll( const TOOL_EVENT& aEvent );
66 
67  int UpdateFind( const TOOL_EVENT& aEvent );
68 
70  int CrossProbeToPcb( const TOOL_EVENT& aEvent );
71 
74  int ExplicitCrossProbeToPcb( const TOOL_EVENT& aEvent );
75 
76 #ifdef KICAD_SPICE
77  int SimProbe( const TOOL_EVENT& aEvent );
78  int SimTune( const TOOL_EVENT& aEvent );
79 #endif /* KICAD_SPICE */
80 
82  int HighlightNet( const TOOL_EVENT& aEvent );
83 
85  int ClearHighlight( const TOOL_EVENT& aEvent );
86 
88  int UpdateNetHighlighting( const TOOL_EVENT& aEvent );
89 
91  int HighlightNetCursor( const TOOL_EVENT& aEvent );
92 
93  int Undo( const TOOL_EVENT& aEvent );
94  int Redo( const TOOL_EVENT& aEvent );
95 
97  int Cut( const TOOL_EVENT& aEvent );
98  int Copy( const TOOL_EVENT& aEvent );
99  int Paste( const TOOL_EVENT& aEvent );
100 
101  int EditWithLibEdit( const TOOL_EVENT& aEvent );
102  int ShowCvpcb( const TOOL_EVENT& aEvent );
103  int Annotate( const TOOL_EVENT& aEvent );
104  int EditSymbolFields( const TOOL_EVENT& aEvent );
105  int EditSymbolLibraryLinks( const TOOL_EVENT& aEvent );
106  int ShowPcbNew( const TOOL_EVENT& aEvent );
107  int UpdatePCB( const TOOL_EVENT& aEvent );
108  int ImportFPAssignments( const TOOL_EVENT& aEvent );
109  int ExportNetlist( const TOOL_EVENT& aEvent );
110  int GenerateBOM( const TOOL_EVENT& aEvent );
111  int DrawSheetOnClipboard( const TOOL_EVENT& aEvent );
112 
113  int ShowBusManager( const TOOL_EVENT& aEvent );
114 
115  int EnterSheet( const TOOL_EVENT& aEvent );
116  int LeaveSheet( const TOOL_EVENT& aEvent );
117  int NavigateHierarchy( const TOOL_EVENT& aEvent );
118 
119  int ToggleHiddenPins( const TOOL_EVENT& aEvent );
120  int ToggleForceHV( const TOOL_EVENT& aEvent );
121 
122  void BackAnnotateFootprints( const std::string& aChangedSetOfReferences );
123 
133  SCH_ITEM* FindComponentAndItem( const wxString& aReference,
134  bool aSearchHierarchy,
135  SCH_SEARCH_T aSearchType,
136  const wxString& aSearchText );
137 
138 private:
140  bool doCopy();
141 
142  bool searchSupplementaryClipboard( const wxString& aSheetFilename, SCH_SCREEN** aScreen );
143 
144  void doCrossProbeSchToPcb( const TOOL_EVENT& aEvent, bool aForce );
145 
153 
174  bool processCmpToFootprintLinkFile( const wxString& aFullFilename,
175  bool aForceVisibilityState,
176  bool aVisibilityState );
177 
179  void setTransitions() override;
180 
181 private:
182  bool m_probingPcbToSch; // Recursion guard when cross-probing to PCBNew
183  EDA_ITEM* m_pickerItem; // Current item for picker highlighting.
184 
185  // A map of sheet paths --> screens for the clipboard contents. We use these to hook up
186  // cut/paste operations for unsaved sheet content.
187  std::map<wxString, SCH_SCREEN*> m_supplementaryClipboard;
188 };
189 
190 
191 #endif // SCH_EDITOR_CONTROL_H
int Save(const TOOL_EVENT &aEvent)
int FindAndReplace(const TOOL_EVENT &aEvent)
int Copy(const TOOL_EVENT &aEvent)
void doCrossProbeSchToPcb(const TOOL_EVENT &aEvent, bool aForce)
int HighlightNetCursor(const TOOL_EVENT &aEvent)
Launches a tool to highlight nets.
int Redo(const TOOL_EVENT &aEvent)
int NavigateHierarchy(const TOOL_EVENT &aEvent)
Definition: hierarch.cpp:132
int EditSymbolFields(const TOOL_EVENT &aEvent)
int ReplaceAndFindNext(const TOOL_EVENT &aEvent)
int New(const TOOL_EVENT &aEvent)
Schematic editor (Eeschema) main window.
int FindNext(const TOOL_EVENT &aEvent)
int ExplicitCrossProbeToPcb(const TOOL_EVENT &aEvent)
Equivalent to the above, but initiated by the user.
bool searchSupplementaryClipboard(const wxString &aSheetFilename, SCH_SCREEN **aScreen)
int Annotate(const TOOL_EVENT &aEvent)
int GenerateBOM(const TOOL_EVENT &aEvent)
int EditSymbolLibraryLinks(const TOOL_EVENT &aEvent)
int CrossProbeToPcb(const TOOL_EVENT &aEvent)
Notifies pcbnew about the selected item.
void setTransitions() override
Sets up handlers for various events.
int DrawSheetOnClipboard(const TOOL_EVENT &aEvent)
int SaveAs(const TOOL_EVENT &aEvent)
int ToggleForceHV(const TOOL_EVENT &aEvent)
int HighlightNet(const TOOL_EVENT &aEvent)
Highlights net under the cursor.
Class SCH_EDITOR_CONTROL.
int EnterSheet(const TOOL_EVENT &aEvent)
int ShowPcbNew(const TOOL_EVENT &aEvent)
std::map< wxString, SCH_SCREEN * > m_supplementaryClipboard
int Paste(const TOOL_EVENT &aEvent)
SCH_ITEM * FindComponentAndItem(const wxString &aReference, bool aSearchHierarchy, SCH_SEARCH_T aSearchType, const wxString &aSearchText)
Finds a component in the schematic and an item in this component.
int UpdatePCB(const TOOL_EVENT &aEvent)
void BackAnnotateFootprints(const std::string &aChangedSetOfReferences)
Definition: backanno.cpp:45
int ShowCvpcb(const TOOL_EVENT &aEvent)
int LeaveSheet(const TOOL_EVENT &aEvent)
bool loadCmpToFootprintLinkFile()
Loads a .cmp file from CvPcb and update the footprint field of components.
int Print(const TOOL_EVENT &aEvent)
int ReplaceAll(const TOOL_EVENT &aEvent)
int UpdateFind(const TOOL_EVENT &aEvent)
Class TOOL_EVENT.
Definition: tool_event.h:171
int EditWithLibEdit(const TOOL_EVENT &aEvent)
int Plot(const TOOL_EVENT &aEvent)
bool processCmpToFootprintLinkFile(const wxString &aFullFilename, bool aForceVisibilityState, bool aVisibilityState)
Read the footprint info from each line in the stuff file by reference designator.
Definition: backanno.cpp:124
int ImportFPAssignments(const TOOL_EVENT &aEvent)
Definition: backanno.cpp:207
int ToggleHiddenPins(const TOOL_EVENT &aEvent)
int UpdateNetHighlighting(const TOOL_EVENT &aEvent)
Updates net highlighting after an edit
int Open(const TOOL_EVENT &aEvent)
int PageSetup(const TOOL_EVENT &aEvent)
int Quit(const TOOL_EVENT &aEvent)
SCH_SEARCH_T
Schematic search type used by the socket link with Pcbnew.
int ShowBusManager(const TOOL_EVENT &aEvent)
int Cut(const TOOL_EVENT &aEvent)
Clipboard support.
int ClearHighlight(const TOOL_EVENT &aEvent)
Removes any net highlighting
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:163
int Undo(const TOOL_EVENT &aEvent)
bool doCopy()
copy selection to clipboard
Class EE_TOOL_BASE.
Definition: ee_tool_base.h:50
Class SCH_ITEM is a base class for any item which can be embedded within the SCHEMATIC container clas...
Definition: sch_item.h:114
int ExportNetlist(const TOOL_EVENT &aEvent)