KiCad PCB EDA Suite
dialog_change_symbols.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) 2020 CERN
5  * Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
6  *
7  * @author Wayne Stambaugh <stambaughw@gmail.com>
8  *
9  * This program is free software: you can redistribute it and/or modify it
10  * under the terms of the GNU General Public License as published by the
11  * Free Software Foundation, either version 3 of the License, or (at your
12  * option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful, but
15  * WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License along
20  * with this program. If not, see <http://www.gnu.org/licenses/>.
21  */
22 
23 #ifndef _DIALOG_CHANGE_SYMBOLS_H_
24 #define _DIALOG_CHANGE_SYMBOLS_H_
25 
27 
28 class LIB_ID;
29 class SCH_COMPONENT;
30 class SCH_EDIT_FRAME;
31 class SCH_SCREEN;
32 class SCH_SHEET_PATH;
33 
38 {
39 public:
40  enum class MODE { CHANGE = 0, UPDATE };
41 
43  MODE aMode = MODE::UPDATE );
44  ~DIALOG_CHANGE_SYMBOLS() override;
45 
46 protected:
47  void launchMatchIdSymbolBrowser( wxCommandEvent& aEvent ) override;
48  void launchNewIdSymbolBrowser( wxCommandEvent& aEvent ) override;
49  void onMatchTextKillFocus( wxFocusEvent& event ) override;
50  void onOkButtonClicked( wxCommandEvent& aEvent ) override;
51  void onMatchByAll( wxCommandEvent& aEvent ) override;
52  void onMatchBySelected( wxCommandEvent& aEvent ) override;
53  void onMatchByReference( wxCommandEvent& aEvent ) override;
54  void onMatchByValue( wxCommandEvent& aEvent ) override;
55  void onMatchById( wxCommandEvent& aEvent ) override;
56 
57  void onSelectAll( wxCommandEvent& event ) override
58  {
59  checkAll( true );
60  }
61 
62  void onSelectNone( wxCommandEvent& event ) override
63  {
64  checkAll( false );
65  }
66 
68  void checkAll( bool aCheck );
69 
70 private:
71  void updateFieldsList();
72 
73  bool isMatch( SCH_COMPONENT* aSymbol, SCH_SHEET_PATH* aInstance );
75  bool processSymbol( SCH_COMPONENT* aSymbol, const SCH_SHEET_PATH* aInstance,
76  const LIB_ID& aNewId, bool aAppendToUndo );
77 
80 
82  std::set<wxString> m_updateFields;
83 };
84 
85 #endif // _DIALOG_CHANGE_SYMBOLS_H_
void onMatchByReference(wxCommandEvent &aEvent) override
Schematic editor (Eeschema) main window.
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
Dialog to update or change schematic library symbols.
void onMatchByAll(wxCommandEvent &aEvent) override
std::set< wxString > m_updateFields
void onSelectNone(wxCommandEvent &event) override
Select or deselect all fields in the listbox widget.
Class DIALOG_CHANGE_SYMBOLS_BASE.
DIALOG_CHANGE_SYMBOLS(SCH_EDIT_FRAME *aParent, SCH_COMPONENT *aSymbol, MODE aMode=MODE::UPDATE)
void onMatchBySelected(wxCommandEvent &aEvent) override
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
void launchMatchIdSymbolBrowser(wxCommandEvent &aEvent) override
void onMatchByValue(wxCommandEvent &aEvent) override
void onSelectAll(wxCommandEvent &event) override
void launchNewIdSymbolBrowser(wxCommandEvent &aEvent) override
void onMatchById(wxCommandEvent &aEvent) override
bool isMatch(SCH_COMPONENT *aSymbol, SCH_SHEET_PATH *aInstance)
Schematic symbol object.
Definition: sch_symbol.h:78
void onMatchTextKillFocus(wxFocusEvent &event) override
MODE m_mode
Set of field names that should have values updated.
bool processSymbol(SCH_COMPONENT *aSymbol, const SCH_SHEET_PATH *aInstance, const LIB_ID &aNewId, bool aAppendToUndo)
void onOkButtonClicked(wxCommandEvent &aEvent) override