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.

71 lines
2.7 KiB

  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2023 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 SCH_EDIT_TABLE_TOOL_H
  24. #define SCH_EDIT_TABLE_TOOL_H
  25. #include <tools/ee_tool_base.h>
  26. #include <tool/edit_table_tool_base.h>
  27. #include <sch_table.h>
  28. #include <sch_tablecell.h>
  29. #include <sch_commit.h>
  30. class SCH_EDIT_FRAME;
  31. class SCH_EDIT_TABLE_TOOL : public EE_TOOL_BASE<SCH_EDIT_FRAME>,
  32. public EDIT_TABLE_TOOL_BASE<SCH_TABLE, SCH_TABLECELL, SCH_COMMIT>
  33. {
  34. public:
  35. SCH_EDIT_TABLE_TOOL();
  36. ~SCH_EDIT_TABLE_TOOL() override { }
  37. /// @copydoc TOOL_INTERACTIVE::Init()
  38. bool Init() override;
  39. int AddRowAbove( const TOOL_EVENT& aEvent ) { return doAddRowAbove( aEvent ); }
  40. int AddRowBelow( const TOOL_EVENT& aEvent ) { return doAddRowBelow( aEvent ); }
  41. int AddColumnBefore( const TOOL_EVENT& aEvent ) { return doAddColumnBefore( aEvent ); }
  42. int AddColumnAfter( const TOOL_EVENT& aEvent ) { return doAddColumnAfter( aEvent ); }
  43. int DeleteRows( const TOOL_EVENT& aEvent ) { return doDeleteRows( aEvent ); }
  44. int DeleteColumns( const TOOL_EVENT& aEvent ) { return doDeleteColumns( aEvent ); }
  45. int MergeCells( const TOOL_EVENT& aEvent ) { return doMergeCells( aEvent ); }
  46. int UnmergeCells( const TOOL_EVENT& aEvent ) { return doUnmergeCells( aEvent ); }
  47. private:
  48. ///< Set up handlers for various events.
  49. void setTransitions() override;
  50. private:
  51. TOOL_MANAGER* getToolMgr() override { return m_toolMgr; }
  52. BASE_SCREEN* getScreen() override { return m_frame->GetScreen(); }
  53. const SELECTION& getTableCellSelection() override;
  54. void clearSelection() override { m_toolMgr->RunAction( EE_ACTIONS::clearSelection ); };
  55. SCH_TABLECELL* copyCell( SCH_TABLECELL* aSource ) override;
  56. };
  57. #endif //SCH_EDIT_TABLE_TOOL_H