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 The 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#include <template_fieldnames.h>
31
32
33class SCH_SYMBOL;
34class SCH_EDIT_FRAME;
35class SCH_SCREEN;
36class SCH_COMMIT;
37
38
40{
41 std::vector<SCH_SHEET_PATH> m_Instances;
43};
44
45
50{
51public:
52 enum class MODE { CHANGE = 0, UPDATE };
53
55 MODE aMode = MODE::UPDATE );
56 ~DIALOG_CHANGE_SYMBOLS() override;
57
58protected:
59 void launchMatchIdSymbolBrowser( wxCommandEvent& aEvent ) override;
60 void launchNewIdSymbolBrowser( wxCommandEvent& aEvent ) override;
61 void onMatchTextKillFocus( wxFocusEvent& event ) override;
62 void onMatchIDKillFocus( wxFocusEvent& event ) override;
63 void onNewLibIDKillFocus( wxFocusEvent& event ) override;
64 void onOkButtonClicked( wxCommandEvent& aEvent ) override;
65 void onMatchByAll( wxCommandEvent& aEvent ) override;
66 void onMatchBySelected( wxCommandEvent& aEvent ) override;
67 void onMatchByReference( wxCommandEvent& aEvent ) override;
68 void onMatchByValue( wxCommandEvent& aEvent ) override;
69 void onMatchById( wxCommandEvent& aEvent ) override;
70
71 void onSelectAll( wxCommandEvent& event ) override
72 {
73 checkAll( true );
74 }
75
76 void onSelectNone( wxCommandEvent& event ) override
77 {
78 checkAll( false );
79 }
80
82 void checkAll( bool aCheck );
83
84private:
85 void updateFieldsList();
86
87 bool isMatch( SCH_SYMBOL* aSymbol, SCH_SHEET_PATH* aInstance );
88 int processMatchingSymbols( SCH_COMMIT* aCommit );
89 int processSymbols( SCH_COMMIT* aCommit,
90 const std::map<SCH_SYMBOL*, SYMBOL_CHANGE_INFO>& aSymbols );
91 wxString getSymbolReferences( SCH_SYMBOL& aSymbol, const LIB_ID& aNewId,
92 const wxString* aOldLibLinkName = nullptr );
93
94private:
97
99 std::set<wxString> m_updateFields;
100
102 std::map<FIELD_T, int> m_mandatoryFieldListIndexes;
103};
104
105#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
bool isMatch(SCH_SYMBOL *aSymbol, SCH_SHEET_PATH *aInstance)
std::map< FIELD_T, int > m_mandatoryFieldListIndexes
Index in the list control for each mandatory FIELD_T type.
void onOkButtonClicked(wxCommandEvent &aEvent) override
void onSelectNone(wxCommandEvent &event) override
std::set< wxString > m_updateFields
Set of field names that should have values updated.
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 checkAll(bool aCheck)
Select or deselect all fields in the listbox widget.
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:77
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.
std::vector< SCH_SHEET_PATH > m_Instances