LibrePCB Developers Documentation
boardeditorstate_adddevice.h
Go to the documentation of this file.
1/*
2 * LibrePCB - Professional EDA for everyone!
3 * Copyright (C) 2013 LibrePCB Developers, see AUTHORS.md for contributors.
4 * https://librepcb.org/
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (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 <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef LIBREPCB_EDITOR_BOARDEDITORSTATE_ADDDEVICE_H
21#define LIBREPCB_EDITOR_BOARDEDITORSTATE_ADDDEVICE_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "boardeditorstate.h"
27
28#include <QtCore>
29
30/*******************************************************************************
31 * Namespace / Forward Declarations
32 ******************************************************************************/
33namespace librepcb {
34
35class Angle;
36class BI_Device;
37class Board;
38class ComponentInstance;
39
40namespace editor {
41
42class CmdDeviceInstanceEditAll;
43
44/*******************************************************************************
45 * Class BoardEditorState_AddDevice
46 ******************************************************************************/
47
52 Q_OBJECT
53
54public:
55 // Constructors / Destructor
58 BoardEditorState_AddDevice(const Context& context) noexcept;
59 virtual ~BoardEditorState_AddDevice() noexcept;
60
61 // General Methods
62 virtual bool entry() noexcept override;
63 virtual bool exit() noexcept override;
64
65 // Event Handlers
66 virtual bool processAddDevice(ComponentInstance& component,
67 const Uuid& device,
68 const Uuid& footprint) noexcept override;
69 virtual bool processRotate(const Angle& rotation) noexcept override;
70 virtual bool processFlip(Qt::Orientation orientation) noexcept override;
72 QGraphicsSceneMouseEvent& e) noexcept override;
74 QGraphicsSceneMouseEvent& e) noexcept override;
76 QGraphicsSceneMouseEvent& e) noexcept override;
78 QGraphicsSceneMouseEvent& e) noexcept override;
79
80 // Operator Overloadings
82 delete;
83
84private:
85 // Private Methods
86 bool addDevice(ComponentInstance& cmp, const Uuid& dev,
87 const Uuid& fpt) noexcept;
88 bool rotateDevice(const Angle& angle) noexcept;
89 bool mirrorDevice(Qt::Orientation orientation) noexcept;
90 bool abortCommand(bool showErrMsgBox) noexcept;
91
92 // State
94
95 // Information about the current device to place. Only valid if
96 // mIsUndoCmdActive == true.
99};
100
101/*******************************************************************************
102 * End of File
103 ******************************************************************************/
104
105} // namespace editor
106} // namespace librepcb
107
108#endif
The Angle class is used to represent an angle (for example 12.75 degrees)
Definition: angle.h:78
The BI_Device class.
Definition: bi_device.h:57
The ComponentInstance class.
Definition: componentinstance.h:54
The Uuid class is a replacement for QUuid to get UUID strings without {} braces.
Definition: uuid.h:58
The "add device" state/tool of the board editor.
Definition: boardeditorstate_adddevice.h:51
bool mirrorDevice(Qt::Orientation orientation) noexcept
Definition: boardeditorstate_adddevice.cpp:201
virtual bool processGraphicsSceneMouseMoved(QGraphicsSceneMouseEvent &e) noexcept override
Definition: boardeditorstate_adddevice.cpp:92
bool addDevice(ComponentInstance &cmp, const Uuid &dev, const Uuid &fpt) noexcept
Definition: boardeditorstate_adddevice.cpp:152
bool rotateDevice(const Angle &angle) noexcept
Definition: boardeditorstate_adddevice.cpp:192
QScopedPointer< CmdDeviceInstanceEditAll > mCurrentDeviceEditCmd
Definition: boardeditorstate_adddevice.h:98
virtual bool processAddDevice(ComponentInstance &component, const Uuid &device, const Uuid &footprint) noexcept override
Definition: boardeditorstate_adddevice.cpp:75
virtual bool processRotate(const Angle &rotation) noexcept override
Definition: boardeditorstate_adddevice.cpp:83
bool abortCommand(bool showErrMsgBox) noexcept
Definition: boardeditorstate_adddevice.cpp:218
BI_Device * mCurrentDeviceToPlace
Definition: boardeditorstate_adddevice.h:97
bool mIsUndoCmdActive
Definition: boardeditorstate_adddevice.h:93
BoardEditorState_AddDevice(const BoardEditorState_AddDevice &other)=delete
virtual bool exit() noexcept override
Definition: boardeditorstate_adddevice.cpp:66
virtual bool processGraphicsSceneRightMouseButtonReleased(QGraphicsSceneMouseEvent &e) noexcept override
Definition: boardeditorstate_adddevice.cpp:136
virtual bool processFlip(Qt::Orientation orientation) noexcept override
Definition: boardeditorstate_adddevice.cpp:87
virtual bool processGraphicsSceneLeftMouseButtonPressed(QGraphicsSceneMouseEvent &e) noexcept override
Definition: boardeditorstate_adddevice.cpp:106
virtual ~BoardEditorState_AddDevice() noexcept
Definition: boardeditorstate_adddevice.cpp:54
virtual bool entry() noexcept override
Definition: boardeditorstate_adddevice.cpp:61
virtual bool processGraphicsSceneLeftMouseButtonDoubleClicked(QGraphicsSceneMouseEvent &e) noexcept override
Definition: boardeditorstate_adddevice.cpp:131
The board editor state base class.
Definition: boardeditorstate.h:59
The CmdDeviceInstanceEditAll class.
Definition: cmddeviceinstanceeditall.h:51
Definition: occmodel.cpp:77
FSM Context.
Definition: boardeditorfsm.h:88