2020-08-13 17:51:26 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2020 CERN
|
2021-01-26 15:23:37 +00:00
|
|
|
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
2020-08-13 17:51:26 +00:00
|
|
|
*
|
|
|
|
* @author Wayne Stambaugh <stambaughw@gmail.com>
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License as published by the
|
|
|
|
* Free Software Foundation, either version 3 of the License, or (at your
|
|
|
|
* option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2021-02-13 21:28:06 +00:00
|
|
|
#ifndef _DIALOG_CHANGE_SYMBOLS_H_
|
|
|
|
#define _DIALOG_CHANGE_SYMBOLS_H_
|
|
|
|
|
2020-08-13 17:51:26 +00:00
|
|
|
#include <dialog_change_symbols_base.h>
|
|
|
|
|
|
|
|
class LIB_ID;
|
2021-06-10 14:10:55 +00:00
|
|
|
class SCH_SYMBOL;
|
2020-08-13 17:51:26 +00:00
|
|
|
class SCH_EDIT_FRAME;
|
|
|
|
class SCH_SCREEN;
|
|
|
|
class SCH_SHEET_PATH;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Dialog to update or change schematic library symbols.
|
|
|
|
*/
|
|
|
|
class DIALOG_CHANGE_SYMBOLS : public DIALOG_CHANGE_SYMBOLS_BASE
|
|
|
|
{
|
|
|
|
public:
|
2021-01-15 22:18:51 +00:00
|
|
|
enum class MODE { CHANGE = 0, UPDATE };
|
2020-08-13 17:51:26 +00:00
|
|
|
|
2021-06-10 14:10:55 +00:00
|
|
|
DIALOG_CHANGE_SYMBOLS( SCH_EDIT_FRAME* aParent, SCH_SYMBOL* aSymbol,
|
2020-09-27 13:07:48 +00:00
|
|
|
MODE aMode = MODE::UPDATE );
|
2020-08-13 17:51:26 +00:00
|
|
|
~DIALOG_CHANGE_SYMBOLS() override;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void launchMatchIdSymbolBrowser( wxCommandEvent& aEvent ) override;
|
|
|
|
void launchNewIdSymbolBrowser( wxCommandEvent& aEvent ) override;
|
2020-09-27 13:07:48 +00:00
|
|
|
void onMatchTextKillFocus( wxFocusEvent& event ) override;
|
2020-08-13 17:51:26 +00:00
|
|
|
void onOkButtonClicked( wxCommandEvent& aEvent ) override;
|
2020-09-27 13:07:48 +00:00
|
|
|
void onMatchByAll( wxCommandEvent& aEvent ) override;
|
|
|
|
void onMatchBySelected( wxCommandEvent& aEvent ) override;
|
2020-08-13 17:51:26 +00:00
|
|
|
void onMatchByReference( wxCommandEvent& aEvent ) override;
|
|
|
|
void onMatchByValue( wxCommandEvent& aEvent ) override;
|
|
|
|
void onMatchById( wxCommandEvent& aEvent ) override;
|
|
|
|
|
2020-09-27 13:07:48 +00:00
|
|
|
void onSelectAll( wxCommandEvent& event ) override
|
|
|
|
{
|
|
|
|
checkAll( true );
|
|
|
|
}
|
|
|
|
|
|
|
|
void onSelectNone( wxCommandEvent& event ) override
|
|
|
|
{
|
|
|
|
checkAll( false );
|
|
|
|
}
|
|
|
|
|
2021-01-26 15:23:37 +00:00
|
|
|
///< Select or deselect all fields in the listbox widget
|
2020-09-27 13:07:48 +00:00
|
|
|
void checkAll( bool aCheck );
|
|
|
|
|
2020-08-13 17:51:26 +00:00
|
|
|
private:
|
2020-09-27 13:07:48 +00:00
|
|
|
void updateFieldsList();
|
|
|
|
|
2021-06-10 14:10:55 +00:00
|
|
|
bool isMatch( SCH_SYMBOL* aSymbol, SCH_SHEET_PATH* aInstance );
|
2020-08-13 17:51:26 +00:00
|
|
|
bool processMatchingSymbols();
|
2021-06-10 14:10:55 +00:00
|
|
|
bool processSymbol( SCH_SYMBOL* aSymbol, const SCH_SHEET_PATH* aInstance,
|
2020-11-23 21:23:40 +00:00
|
|
|
const LIB_ID& aNewId, bool aAppendToUndo );
|
2020-08-13 17:51:26 +00:00
|
|
|
|
2021-06-10 14:10:55 +00:00
|
|
|
SCH_SYMBOL* m_symbol;
|
|
|
|
MODE m_mode;
|
2020-09-27 13:07:48 +00:00
|
|
|
|
2021-01-26 15:23:37 +00:00
|
|
|
///< Set of field names that should have values updated
|
2020-09-27 13:07:48 +00:00
|
|
|
std::set<wxString> m_updateFields;
|
2020-08-13 17:51:26 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // _DIALOG_CHANGE_SYMBOLS_H_
|