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.

101 lines
3.3 KiB

  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 1992-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. #ifndef _DIALOG_EDIT_COMPONENT_IN_LIB_H_
  24. #define _DIALOG_EDIT_COMPONENT_IN_LIB_H_
  25. #include <fields_grid_table.h>
  26. #include <widgets/unit_binder.h>
  27. #include <dialog_edit_component_in_lib_base.h>
  28. class LIB_EDIT_FRAME;
  29. class LIB_PART;
  30. class WX_GRID;
  31. class DIALOG_EDIT_COMPONENT_IN_LIBRARY: public DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE
  32. {
  33. static int m_lastOpenedPage; // To remember the last notebook selection
  34. enum LAST_LAYOUT {
  35. NONE,
  36. ALIAS,
  37. PARENT
  38. };
  39. static LAST_LAYOUT m_lastLayout;
  40. public:
  41. LIB_EDIT_FRAME* m_Parent;
  42. LIB_PART* m_libEntry;
  43. FIELDS_GRID_TABLE<LIB_FIELD>* m_fields;
  44. UNIT_BINDER m_pinNameOffset;
  45. wxControl* m_delayedFocusCtrl;
  46. WX_GRID* m_delayedFocusGrid;
  47. int m_delayedFocusRow;
  48. int m_delayedFocusColumn;
  49. int m_delayedFocusPage;
  50. wxString m_delayedErrorMessage;
  51. wxString m_shownColumns;
  52. int m_width;
  53. bool TransferDataToWindow() override;
  54. bool TransferDataFromWindow() override;
  55. bool Validate() override;
  56. public:
  57. /// Constructors
  58. DIALOG_EDIT_COMPONENT_IN_LIBRARY( LIB_EDIT_FRAME* parent, LIB_PART* aLibEntry );
  59. ~DIALOG_EDIT_COMPONENT_IN_LIBRARY();
  60. private:
  61. void transferAliasDataToBuffer();
  62. void OnAddField( wxCommandEvent& event ) override;
  63. void OnDeleteField( wxCommandEvent& event ) override;
  64. void OnMoveUp( wxCommandEvent& event ) override;
  65. void OnMoveDown( wxCommandEvent& event ) override;
  66. void OnSymbolNameKillFocus( wxFocusEvent& event ) override;
  67. void OnSymbolNameText( wxCommandEvent& event ) override;
  68. void OnAddFootprintFilter( wxCommandEvent& event ) override;
  69. void OnDeleteFootprintFilter( wxCommandEvent& event ) override;
  70. void OnEditFootprintFilter( wxCommandEvent& event ) override;
  71. void OnSizeGrid( wxSizeEvent& event ) override;
  72. void OnGridCellChanging( wxGridEvent& event );
  73. void OnEditSpiceModel( wxCommandEvent& event ) override;
  74. void OnUpdateUI( wxUpdateUIEvent& event ) override;
  75. void OnFilterDClick( wxMouseEvent& event ) override;
  76. void OnCancelButtonClick( wxCommandEvent& event ) override;
  77. void adjustGridColumns( int aWidth );
  78. void syncControlStates( bool aIsAlias );
  79. };
  80. #endif // _DIALOG_EDIT_COMPONENT_IN_LIB_H_