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.

85 lines
2.7 KiB

  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2019 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 <class_library.h>
  26. enum COL_ORDER
  27. {
  28. COL_NUMBER,
  29. COL_NAME,
  30. COL_TYPE,
  31. COL_SHAPE,
  32. COL_ORIENTATION,
  33. COL_NUMBER_SIZE,
  34. COL_NAME_SIZE,
  35. COL_LENGTH,
  36. COL_POSX,
  37. COL_POSY,
  38. COL_COUNT // keep as last
  39. };
  40. class PIN_TABLE_DATA_MODEL;
  41. class LIB_EDIT_FRAME;
  42. class DIALOG_LIB_EDIT_PIN_TABLE : public DIALOG_LIB_EDIT_PIN_TABLE_BASE
  43. {
  44. public:
  45. DIALOG_LIB_EDIT_PIN_TABLE( LIB_EDIT_FRAME* parent, LIB_PART* aPart );
  46. ~DIALOG_LIB_EDIT_PIN_TABLE() override;
  47. bool TransferDataToWindow() override;
  48. bool TransferDataFromWindow() override;
  49. void OnColSort( wxGridEvent& aEvent );
  50. void OnAddRow( wxCommandEvent& event ) override;
  51. void OnDeleteRow( wxCommandEvent& event ) override;
  52. void OnSize( wxSizeEvent& event ) override;
  53. void OnCellEdited( wxGridEvent& event ) override;
  54. void OnRebuildRows( wxCommandEvent& event ) override;
  55. void OnUpdateUI( wxUpdateUIEvent& event ) override;
  56. void OnCancel( wxCommandEvent& event ) override;
  57. void OnClose( wxCloseEvent& event ) override;
  58. protected:
  59. void updateSummary();
  60. void adjustGridColumns( int aWidth );
  61. LIB_EDIT_FRAME* m_editFrame;
  62. bool m_initialized = false;
  63. int m_originalColWidths[ COL_COUNT ];
  64. wxString m_columnsShown;
  65. LIB_PART* m_part;
  66. LIB_PINS m_pins; // a copy of the pins owned by me
  67. bool m_modified; ///< true when there are unsaved changes
  68. int m_width;
  69. PIN_TABLE_DATA_MODEL* m_dataModel;
  70. };