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.

60 lines
1.8 KiB

  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright The KiCad Developers, see AUTHORS.TXT for contributors.
  5. *
  6. * This program is free software; you can redistribute it and/or modify it under the terms of
  7. * the GNU General Public License as published by the Free Software Foundation; either version 3
  8. * of the License, or (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
  11. * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  12. * See the GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License along with this program;
  15. * if not, you may find one at http://www.gnu.org/licenses/
  16. */
  17. #ifndef LIBRARY_EDITOR_CONTROL_H
  18. #define LIBRARY_EDITOR_CONTROL_H
  19. #include <tool/tool_interactive.h>
  20. #include <project.h>
  21. class EDA_DRAW_FRAME;
  22. /**
  23. * Module editor specific tools.
  24. */
  25. class LIBRARY_EDITOR_CONTROL : public TOOL_INTERACTIVE
  26. {
  27. public:
  28. LIBRARY_EDITOR_CONTROL();
  29. /// @copydoc TOOL_INTERACTIVE::Reset()
  30. void Reset( RESET_REASON aReason ) override;
  31. void AddContextMenuItems( CONDITIONAL_MENU* aMenu );
  32. int PinLibrary( const TOOL_EVENT& aEvent );
  33. int UnpinLibrary( const TOOL_EVENT& aEvent );
  34. int ToggleLibraryTree( const TOOL_EVENT& aEvent );
  35. int LibraryTreeSearch( const TOOL_EVENT& aEvent );
  36. bool RenameLibrary( const wxString& aTitle, const wxString& aName,
  37. std::function<bool( const wxString& aNewName )> aValidator );
  38. private:
  39. void changeSelectedPinStatus( const bool aPin );
  40. /// Set up handlers for various events.
  41. void setTransitions() override;
  42. void regenerateLibraryTree();
  43. private:
  44. EDA_DRAW_FRAME* m_frame;
  45. };
  46. #endif // LIBRARY_EDITOR_CONTROL_H