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.

94 lines
3.0 KiB

  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2019-2022 KiCad Developers, see AUTHORS.txt for contributors.
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License
  8. * as published by the Free Software Foundation; either version 2
  9. * of the License, or (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, you may find one here:
  18. * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  19. * or you may search the http://www.gnu.org website for the version 2 license,
  20. * or you may write to the Free Software Foundation, Inc.,
  21. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  22. */
  23. #include "dialog_lib_edit_pin_table_base.h"
  24. #include <lib_item.h>
  25. #include <symbol_library.h>
  26. enum COL_ORDER
  27. {
  28. COL_PIN_COUNT,
  29. COL_NUMBER,
  30. COL_NAME,
  31. COL_TYPE,
  32. COL_SHAPE,
  33. COL_ORIENTATION,
  34. COL_NUMBER_SIZE,
  35. COL_NAME_SIZE,
  36. COL_LENGTH,
  37. COL_POSX,
  38. COL_POSY,
  39. COL_VISIBLE,
  40. COL_UNIT,
  41. COL_DEMORGAN,
  42. COL_COUNT // keep as last
  43. };
  44. class PIN_TABLE_DATA_MODEL;
  45. class SYMBOL_EDIT_FRAME;
  46. class DIALOG_LIB_EDIT_PIN_TABLE : public DIALOG_LIB_EDIT_PIN_TABLE_BASE
  47. {
  48. public:
  49. DIALOG_LIB_EDIT_PIN_TABLE( SYMBOL_EDIT_FRAME* parent, LIB_SYMBOL* aSymbol );
  50. ~DIALOG_LIB_EDIT_PIN_TABLE() override;
  51. bool TransferDataToWindow() override;
  52. bool TransferDataFromWindow() override;
  53. void OnColSort( wxGridEvent& aEvent );
  54. void OnAddRow( wxCommandEvent& event ) override;
  55. void OnDeleteRow( wxCommandEvent& event ) override;
  56. void OnSize( wxSizeEvent& event ) override;
  57. void OnCellEdited( wxGridEvent& event ) override;
  58. void OnRebuildRows( wxCommandEvent& event ) override;
  59. void OnGroupSelected( wxCommandEvent& event ) override;
  60. void OnFilterCheckBox( wxCommandEvent& event ) override;
  61. void OnFilterChoice( wxCommandEvent& event ) override;
  62. void OnUpdateUI( wxUpdateUIEvent& event ) override;
  63. void OnCancel( wxCommandEvent& event ) override;
  64. void OnClose( wxCloseEvent& event ) override;
  65. void AddPin( LIB_PIN* pin );
  66. void RemovePin( LIB_PIN* pin );
  67. bool IsDisplayGrouped();
  68. protected:
  69. void updateSummary();
  70. void adjustGridColumns();
  71. SYMBOL_EDIT_FRAME* m_editFrame;
  72. bool m_initialized = false;
  73. int m_originalColWidths[ COL_COUNT ];
  74. wxString m_columnsShown;
  75. LIB_SYMBOL* m_symbol;
  76. LIB_PINS m_pins; // a copy of the pins owned by me
  77. bool m_modified; ///< true when there are unsaved changes
  78. wxSize m_size;
  79. PIN_TABLE_DATA_MODEL* m_dataModel;
  80. };