KiCad PCB EDA Suite
Loading...
Searching...
No Matches
sch_edit_table_tool.h
Go to the documentation of this file.
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
24#ifndef SCH_EDIT_TABLE_TOOL_H
25#define SCH_EDIT_TABLE_TOOL_H
26
27#include <tools/ee_tool_base.h>
29#include <sch_table.h>
30#include <sch_tablecell.h>
31#include <sch_commit.h>
32
33
34class SCH_EDIT_FRAME;
35
36
37class SCH_EDIT_TABLE_TOOL : public EE_TOOL_BASE<SCH_EDIT_FRAME>,
38 public EDIT_TABLE_TOOL_BASE<SCH_TABLE, SCH_TABLECELL, SCH_COMMIT>
39{
40public:
42 ~SCH_EDIT_TABLE_TOOL() override { }
43
45 bool Init() override;
46
47 int AddRowAbove( const TOOL_EVENT& aEvent ) { return doAddRowAbove( aEvent ); }
48 int AddRowBelow( const TOOL_EVENT& aEvent ) { return doAddRowBelow( aEvent ); }
49 int AddColumnBefore( const TOOL_EVENT& aEvent ) { return doAddColumnBefore( aEvent ); }
50 int AddColumnAfter( const TOOL_EVENT& aEvent ) { return doAddColumnAfter( aEvent ); }
51 int DeleteRows( const TOOL_EVENT& aEvent ) { return doDeleteRows( aEvent ); }
52 int DeleteColumns( const TOOL_EVENT& aEvent ) { return doDeleteColumns( aEvent ); }
53
54 int MergeCells( const TOOL_EVENT& aEvent ) { return doMergeCells( aEvent ); }
55 int UnmergeCells( const TOOL_EVENT& aEvent ) { return doUnmergeCells( aEvent ); }
56
57 int EditTable( const TOOL_EVENT& aEvent );
58
59private:
61 void setTransitions() override;
62
63private:
64 TOOL_MANAGER* getToolMgr() override { return m_toolMgr; }
65 BASE_SCREEN* getScreen() override { return m_frame->GetScreen(); }
66
67 const SELECTION& getTableCellSelection() override;
69
70 SCH_TABLECELL* copyCell( SCH_TABLECELL* aSource ) override;
71};
72
73#endif //SCH_EDIT_TABLE_TOOL_H
Handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:41
SCH_TABLE_EDIT_TOOL and PCB_TABLE_EDIT_TOOL share most of their algorithms, which are implemented her...
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:56
A foundation class for a tool operating on a schematic or symbol.
Definition: ee_tool_base.h:48
Schematic editor (Eeschema) main window.
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
void setTransitions() override
< Set up handlers for various events.
BASE_SCREEN * getScreen() override
int DeleteRows(const TOOL_EVENT &aEvent)
int MergeCells(const TOOL_EVENT &aEvent)
void clearSelection() override
int UnmergeCells(const TOOL_EVENT &aEvent)
TOOL_MANAGER * getToolMgr() override
int AddRowBelow(const TOOL_EVENT &aEvent)
int AddColumnBefore(const TOOL_EVENT &aEvent)
int EditTable(const TOOL_EVENT &aEvent)
const SELECTION & getTableCellSelection() override
int DeleteColumns(const TOOL_EVENT &aEvent)
bool Init() override
Init() is called once upon a registration of the tool.
int AddColumnAfter(const TOOL_EVENT &aEvent)
int AddRowAbove(const TOOL_EVENT &aEvent)
SCH_TABLECELL * copyCell(SCH_TABLECELL *aSource) override
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216
Generic, UI-independent tool event.
Definition: tool_event.h:167
Master controller class:
Definition: tool_manager.h:57
bool RunAction(const std::string &aActionName, T aParam)
Run the specified action immediately, pausing the current action to run the new one.
Definition: tool_manager.h:145