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.

96 lines
3.5 KiB

  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2024 KiCad Developers, see AUTHORS.txt for contributors.
  5. *
  6. * This program is free software: you can redistribute it and/or modify it
  7. * under the terms of the GNU General Public License as published by the
  8. * Free Software Foundation, either version 3 of the License, or (at your
  9. * option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful, but
  12. * WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License along
  17. * with this program. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. #pragma once
  20. #include <dialog_lib_fields_table_base.h>
  21. #include <sch_reference_list.h>
  22. #include <lib_fields_data_model.h>
  23. class SYMBOL_EDIT_FRAME;
  24. class LIB_SYMBOL;
  25. class DIALOG_LIB_FIELDS_TABLE : public DIALOG_LIB_FIELDS_TABLE_BASE
  26. {
  27. public:
  28. enum SCOPE : int
  29. {
  30. SCOPE_LIBRARY = 0,
  31. SCOPE_RELATED_SYMBOLS
  32. };
  33. DIALOG_LIB_FIELDS_TABLE( SYMBOL_EDIT_FRAME* parent, DIALOG_LIB_FIELDS_TABLE::SCOPE aScope );
  34. ~DIALOG_LIB_FIELDS_TABLE() override;
  35. bool TransferDataToWindow() override;
  36. bool TransferDataFromWindow() override;
  37. void ShowHideColumn( int aCol, bool aShow );
  38. private:
  39. void UpdateFieldList();
  40. void AddField( const wxString& aFieldName, const wxString& aLabelValue, bool show, bool groupBy,
  41. bool addedByUser = false, bool aIsCheckbox = false );
  42. void RemoveField( const wxString& fieldName );
  43. void RenameField( const wxString& oldName, const wxString& newName );
  44. void RegroupSymbols();
  45. void OnColSort( wxGridEvent& aEvent );
  46. void OnColMove( wxGridEvent& aEvent );
  47. void SetupColumnProperties( int aCol );
  48. void SetupAllColumnProperties();
  49. void setScope( SCOPE aScope );
  50. // Set bitmap and tooltip according to left panel visibility
  51. void setSideBarButtonLook( bool aIsLeftPanelCollapsed );
  52. void loadSymbols( const wxArrayString& aSymbolNames );
  53. void OnViewControlsCellChanged( wxGridEvent& aEvent ) override;
  54. void OnSizeViewControlsGrid( wxSizeEvent& event ) override;
  55. void OnAddField( wxCommandEvent& event ) override;
  56. void OnRenameField( wxCommandEvent& event ) override;
  57. void OnRemoveField( wxCommandEvent& event ) override;
  58. void OnFilterMouseMoved( wxMouseEvent& event ) override;
  59. void OnFilterText( wxCommandEvent& event ) override;
  60. void OnScope( wxCommandEvent& event ) override;
  61. void OnGroupSymbolsToggled( wxCommandEvent& event ) override;
  62. void OnRegroupSymbols( wxCommandEvent& event ) override;
  63. void OnTableValueChanged( wxGridEvent& event ) override;
  64. void OnTableCellClick( wxGridEvent& event ) override;
  65. void OnTableItemContextMenu( wxGridEvent& event ) override;
  66. void OnTableColSize( wxGridSizeEvent& event ) override;
  67. void OnSidebarToggle( wxCommandEvent& event ) override;
  68. void OnCancel( wxCommandEvent& event ) override;
  69. void OnOk( wxCommandEvent& event ) override;
  70. void OnApply( wxCommandEvent& event ) override;
  71. void OnClose( wxCloseEvent& event ) override;
  72. private:
  73. SYMBOL_EDIT_FRAME* m_parent;
  74. SCOPE m_scope;
  75. VIEW_CONTROLS_GRID_DATA_MODEL* m_viewControlsDataModel;
  76. LIB_FIELDS_EDITOR_GRID_DATA_MODEL* m_dataModel;
  77. std::vector<LIB_SYMBOL*> m_symbolsList;
  78. };