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 (C) 2024 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#pragma once
25
26#include <memory>
27
28#include <wx/event.h>
29
30#include <math/vector2d.h>
31#include <tools/pcb_tool_base.h>
32#include <tools/pcb_selection.h>
33
34class ARRAY_OPTIONS;
35class BOARD_COMMIT;
37
47class ARRAY_TOOL : public PCB_TOOL_BASE, public wxEvtHandler
48{
49public:
50 ARRAY_TOOL();
52
53 void Reset( RESET_REASON aReason ) override;
54
56 bool Init() override;
57
61 int CreateArray( const TOOL_EVENT& aEvent );
62
67 // int DoCreateArray( const VECTOR2I& anchor, const VECTOR2I& translation );
68
70 void setTransitions() override;
71
72private:
73 void onDialogClosed( wxCloseEvent& aEvent );
74
76 std::unique_ptr<ARRAY_OPTIONS> m_array_opts;
77 std::unique_ptr<PCB_SELECTION> m_selection;
78};
Options that govern the setup of an "array" of multiple item.
Definition: array_options.h:38
The array tool.
Definition: array_tool.h:48
void onDialogClosed(wxCloseEvent &aEvent)
Definition: array_tool.cpp:112
int CreateArray(const TOOL_EVENT &aEvent)
Invoke a dialog box to allow positioning of the item relative to another by an exact amount.
Definition: array_tool.cpp:72
bool Init() override
Init() is called once upon a registration of the tool.
Definition: array_tool.cpp:66
std::unique_ptr< ARRAY_OPTIONS > m_array_opts
Definition: array_tool.h:76
DIALOG_CREATE_ARRAY * m_dialog
Definition: array_tool.h:75
std::unique_ptr< PCB_SELECTION > m_selection
Definition: array_tool.h:77
void setTransitions() override
Position the m_position_relative_selection selection relative to anchor position using the given tran...
Definition: array_tool.cpp:298
RESET_REASON
Determine the reason of reset for a tool.
Definition: tool_base.h:78
Generic, UI-independent tool event.
Definition: tool_event.h:167
void Reset() override