LibrePCB Developers Documentation
Loading...
Searching...
No Matches
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#include <memory>
31
32/*******************************************************************************
33 * Namespace / Forward Declarations
34 ******************************************************************************/
35namespace librepcb {
36
37class Angle;
38class BI_Device;
39class Board;
40class ComponentInstance;
41
42namespace editor {
43
44class CmdDeviceInstanceEditAll;
45
46/*******************************************************************************
47 * Class BoardEditorState_AddDevice
48 ******************************************************************************/
49
54 Q_OBJECT
55
56public:
57 // Constructors / Destructor
60 BoardEditorState_AddDevice(const Context& context) noexcept;
61 virtual ~BoardEditorState_AddDevice() noexcept;
62
63 // General Methods
64 virtual bool entry() noexcept override;
65 virtual bool exit() noexcept override;
66
67 // Event Handlers
68 virtual bool processAddDevice(ComponentInstance& component,
69 const Uuid& device,
70 const Uuid& footprint) noexcept override;
71 virtual bool processRotate(const Angle& rotation) noexcept override;
72 virtual bool processFlip(Qt::Orientation orientation) noexcept override;
74 QGraphicsSceneMouseEvent& e) noexcept override;
76 QGraphicsSceneMouseEvent& e) noexcept override;
78 QGraphicsSceneMouseEvent& e) noexcept override;
80 QGraphicsSceneMouseEvent& e) noexcept override;
81
82 // Operator Overloadings
84 delete;
85
86private:
87 // Private Methods
88 bool addDevice(ComponentInstance& cmp, const Uuid& dev,
89 const Uuid& fpt) noexcept;
90 bool rotateDevice(const Angle& angle) noexcept;
91 bool mirrorDevice(Qt::Orientation orientation) noexcept;
92 bool abortCommand(bool showErrMsgBox) noexcept;
93
94 // State
96
97 // Information about the current device to place. Only valid if
98 // mIsUndoCmdActive == true.
101};
102
103/*******************************************************************************
104 * End of File
105 ******************************************************************************/
106
107} // namespace editor
108} // namespace librepcb
109
110#endif
The Angle class is used to represent an angle (for example 12.75 degrees)
Definition angle.h:76
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:56
The "add device" state/tool of the board editor.
Definition boardeditorstate_adddevice.h:53
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
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
std::unique_ptr< CmdDeviceInstanceEditAll > mCurrentDeviceEditCmd
Definition boardeditorstate_adddevice.h:100
bool abortCommand(bool showErrMsgBox) noexcept
Definition boardeditorstate_adddevice.cpp:218
BI_Device * mCurrentDeviceToPlace
Definition boardeditorstate_adddevice.h:99
bool mIsUndoCmdActive
Definition boardeditorstate_adddevice.h:95
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:76
Definition uuid.h:186
FSM Context.
Definition boardeditorfsm.h:88