KiCad PCB EDA Suite
Loading...
Searching...
No Matches
array_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#pragma once
21
22#include <memory>
23
24#include <wx/event.h>
25
26#include <math/vector2d.h>
27#include <tools/pcb_tool_base.h>
28#include <tools/pcb_selection.h>
29
30class ARRAY_OPTIONS;
31class BOARD_COMMIT;
33
42
43class ARRAY_TOOL : public PCB_TOOL_BASE, public wxEvtHandler
44{
45public:
46 ARRAY_TOOL();
48
49 void Reset( RESET_REASON aReason ) override;
50
52 bool Init() override;
53
57 int CreateArray( const TOOL_EVENT& aEvent );
58
63 // int DoCreateArray( const VECTOR2I& anchor, const VECTOR2I& translation );
64
66 void setTransitions() override;
67
68private:
69 void onDialogClosed( wxCloseEvent& aEvent );
70
72 std::unique_ptr<ARRAY_OPTIONS> m_array_opts;
73 std::unique_ptr<PCB_SELECTION> m_selection;
74};
Options that govern the setup of an "array" of multiple item.
void onDialogClosed(wxCloseEvent &aEvent)
int CreateArray(const TOOL_EVENT &aEvent)
Invoke a dialog box to allow positioning of the item relative to another by an exact amount.
bool Init() override
Init() is called once upon a registration of the tool.
std::unique_ptr< ARRAY_OPTIONS > m_array_opts
Definition array_tool.h:72
DIALOG_CREATE_ARRAY * m_dialog
Definition array_tool.h:71
std::unique_ptr< PCB_SELECTION > m_selection
Definition array_tool.h:73
void setTransitions() override
Position the m_position_relative_selection selection relative to anchor position using the given tran...
PCB_TOOL_BASE(TOOL_ID aId, const std::string &aName)
Constructor.
RESET_REASON
Determine the reason of reset for a tool.
Definition tool_base.h:74
Generic, UI-independent tool event.
Definition tool_event.h:167
void Reset() override