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 The 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, see <https://www.gnu.org/licenses/>.
18 */
19
20#ifndef SCH_EDIT_TABLE_TOOL_H
21#define SCH_EDIT_TABLE_TOOL_H
22
23#include <tools/sch_tool_base.h>
25#include <sch_table.h>
26#include <sch_tablecell.h>
27#include <sch_commit.h>
28
29
30class SCH_EDIT_FRAME;
31
32
33class SCH_EDIT_TABLE_TOOL : public SCH_TOOL_BASE<SCH_EDIT_FRAME>,
34 public EDIT_TABLE_TOOL_BASE<SCH_TABLE, SCH_TABLECELL, SCH_COMMIT>
35{
36public:
38 ~SCH_EDIT_TABLE_TOOL() override { }
39
41 bool Init() override;
42
43 int AddRowAbove( const TOOL_EVENT& aEvent ) { return doAddRowAbove( aEvent ); }
44 int AddRowBelow( const TOOL_EVENT& aEvent ) { return doAddRowBelow( aEvent ); }
45 int AddColumnBefore( const TOOL_EVENT& aEvent ) { return doAddColumnBefore( aEvent ); }
46 int AddColumnAfter( const TOOL_EVENT& aEvent ) { return doAddColumnAfter( aEvent ); }
47 int DeleteRows( const TOOL_EVENT& aEvent ) { return doDeleteRows( aEvent ); }
48 int DeleteColumns( const TOOL_EVENT& aEvent ) { return doDeleteColumns( aEvent ); }
49
50 int MergeCells( const TOOL_EVENT& aEvent ) { return doMergeCells( aEvent ); }
51 int UnmergeCells( const TOOL_EVENT& aEvent ) { return doUnmergeCells( aEvent ); }
52
53 int EditTable( const TOOL_EVENT& aEvent );
54 int ExportTableToCSV( const TOOL_EVENT& aEvent );
55
56private:
58 void setTransitions() override;
59
60private:
61 TOOL_MANAGER* getToolMgr() override { return m_toolMgr; }
62 BASE_SCREEN* getScreen() override { return m_frame->GetScreen(); }
63
64 const SELECTION& getTableCellSelection() override;
65 void clearSelection() override { m_toolMgr->RunAction( ACTIONS::selectionClear ); };
66
67 SCH_TABLECELL* copyCell( SCH_TABLECELL* aSource ) override;
68};
69
70#endif //SCH_EDIT_TABLE_TOOL_H
static TOOL_ACTION selectionClear
Clear the current selection.
Definition actions.h:220
Handles how to draw a screen (a board, a schematic ...)
Definition base_screen.h:37
SCH_TABLE_EDIT_TOOL and PCB_TABLE_EDIT_TOOL share most of their algorithms, which are implemented her...
Schematic editor (Eeschema) main window.
void setTransitions() override
< Set up handlers for various events.
BASE_SCREEN * getScreen() override
int DeleteRows(const TOOL_EVENT &aEvent)
int ExportTableToCSV(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
SCH_TOOL_BASE(const std::string &aName)
Generic, UI-independent tool event.
Definition tool_event.h:167
friend class TOOL_MANAGER