You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

71 lines
2.0 KiB

  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. * This program is free software: you can redistribute it and/or modify it
  8. * under the terms of the GNU General Public License as published by the
  9. * Free Software Foundation, either version 3 of the License, or (at your
  10. * option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License along
  18. * with this program. If not, see <http://www.gnu.org/licenses/>.
  19. */
  20. #ifndef DIALOG_UPDATE_SYMBOL_FIELDS_H
  21. #define DIALOG_UPDATE_SYMBOL_FIELDS_H
  22. #include <dialog_update_symbol_fields_base.h>
  23. #include <set>
  24. #include <template_fieldnames.h>
  25. class LIB_ID;
  26. class LIB_SYMBOL;
  27. class SYMBOL_EDIT_FRAME;
  28. /**
  29. * Dialog to update or change schematic library symbols.
  30. */
  31. class DIALOG_UPDATE_SYMBOL_FIELDS : public DIALOG_UPDATE_SYMBOL_FIELDS_BASE
  32. {
  33. public:
  34. DIALOG_UPDATE_SYMBOL_FIELDS( SYMBOL_EDIT_FRAME* aParent, LIB_SYMBOL* aSymbol );
  35. ~DIALOG_UPDATE_SYMBOL_FIELDS() override;
  36. protected:
  37. void onOkButtonClicked( wxCommandEvent& aEvent ) override;
  38. void onSelectAll( wxCommandEvent& event ) override
  39. {
  40. checkAll( true );
  41. }
  42. void onSelectNone( wxCommandEvent& event ) override
  43. {
  44. checkAll( false );
  45. }
  46. /// Select or deselect all fields in the listbox widget.
  47. void checkAll( bool aCheck );
  48. private:
  49. void updateFieldsList();
  50. private:
  51. SYMBOL_EDIT_FRAME* m_editFrame;
  52. LIB_SYMBOL* m_symbol;
  53. /// Set of field names that should have values updated.
  54. std::set<wxString> m_updateFields;
  55. /// Index in the list control for each MANDATORY_FIELD type
  56. std::map<FIELD_T, int> m_mandatoryFieldListIndexes;
  57. };
  58. #endif // DIALOG_UPDATE_SYMBOL_FIELDS_H