KiCad PCB EDA Suite
Loading...
Searching...
No Matches
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-2023 KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * @author Wayne Stambaugh <[email protected]>
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#include <lib_id.h>
29#include <sch_sheet_path.h>
30
31
32class SCH_SYMBOL;
33class SCH_EDIT_FRAME;
34class SCH_SCREEN;
35class SCH_COMMIT;
36
37
39{
40 std::vector<SCH_SHEET_PATH> m_Instances;
42};
43
44
49{
50public:
51 enum class MODE { CHANGE = 0, UPDATE };
52
54 MODE aMode = MODE::UPDATE );
55 ~DIALOG_CHANGE_SYMBOLS() override;
56
57protected:
58 void launchMatchIdSymbolBrowser( wxCommandEvent& aEvent ) override;
59 void launchNewIdSymbolBrowser( wxCommandEvent& aEvent ) override;
60 void onMatchTextKillFocus( wxFocusEvent& event ) override;
61 void onMatchIDKillFocus( wxFocusEvent& event ) override;
62 void onNewLibIDKillFocus( wxFocusEvent& event ) override;
63 void onOkButtonClicked( wxCommandEvent& aEvent ) override;
64 void onMatchByAll( wxCommandEvent& aEvent ) override;
65 void onMatchBySelected( wxCommandEvent& aEvent ) override;
66 void onMatchByReference( wxCommandEvent& aEvent ) override;
67 void onMatchByValue( wxCommandEvent& aEvent ) override;
68 void onMatchById( wxCommandEvent& aEvent ) override;
69
70 void onSelectAll( wxCommandEvent& event ) override
71 {
72 checkAll( true );
73 }
74
75 void onSelectNone( wxCommandEvent& event ) override
76 {
77 checkAll( false );
78 }
79
81 void checkAll( bool aCheck );
82
83private:
84 void updateFieldsList();
85
86 bool isMatch( SCH_SYMBOL* aSymbol, SCH_SHEET_PATH* aInstance );
87 int processMatchingSymbols( SCH_COMMIT* aCommit );
88 int processSymbols( SCH_COMMIT* aCommit,
89 const std::map<SCH_SYMBOL*, SYMBOL_CHANGE_INFO>& aSymbols );
90 wxString getSymbolReferences( SCH_SYMBOL& aSymbol, const LIB_ID& aNewId,
91 const wxString* aOldLibLinkName = nullptr );
92
95
97 std::set<wxString> m_updateFields;
98};
99
100#endif // _DIALOG_CHANGE_SYMBOLS_H_
Class DIALOG_CHANGE_SYMBOLS_BASE.
Dialog to update or change schematic library symbols.
void onNewLibIDKillFocus(wxFocusEvent &event) override
void onMatchBySelected(wxCommandEvent &aEvent) override
MODE m_mode
Set of field names that should have values updated.
bool isMatch(SCH_SYMBOL *aSymbol, SCH_SHEET_PATH *aInstance)
void onOkButtonClicked(wxCommandEvent &aEvent) override
void onSelectNone(wxCommandEvent &event) override
Select or deselect all fields in the listbox widget.
std::set< wxString > m_updateFields
void onMatchById(wxCommandEvent &aEvent) override
void launchMatchIdSymbolBrowser(wxCommandEvent &aEvent) override
void onMatchByReference(wxCommandEvent &aEvent) override
void onMatchByValue(wxCommandEvent &aEvent) override
int processMatchingSymbols(SCH_COMMIT *aCommit)
void onMatchTextKillFocus(wxFocusEvent &event) override
void onSelectAll(wxCommandEvent &event) override
void onMatchIDKillFocus(wxFocusEvent &event) override
wxString getSymbolReferences(SCH_SYMBOL &aSymbol, const LIB_ID &aNewId, const wxString *aOldLibLinkName=nullptr)
void launchNewIdSymbolBrowser(wxCommandEvent &aEvent) override
void onMatchByAll(wxCommandEvent &aEvent) override
int processSymbols(SCH_COMMIT *aCommit, const std::map< SCH_SYMBOL *, SYMBOL_CHANGE_INFO > &aSymbols)
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:49
Schematic editor (Eeschema) main window.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
Schematic symbol object.
Definition: sch_symbol.h:104
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.
std::vector< SCH_SHEET_PATH > m_Instances