LibrePCB Developers Documentation
boardeditorstate_addhole.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_ADDHOLE_H
21#define LIBREPCB_EDITOR_BOARDEDITORSTATE_ADDHOLE_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "boardeditorstate.h"
27
29
30#include <QtCore>
31
32/*******************************************************************************
33 * Namespace / Forward Declarations
34 ******************************************************************************/
35namespace librepcb {
36
37class Board;
38
39namespace editor {
40
41class CmdBoardHoleEdit;
42class PositiveLengthEdit;
43
44/*******************************************************************************
45 * Class BoardEditorState_AddHole
46 ******************************************************************************/
47
52 Q_OBJECT
53
54public:
55 // Constructors / Destructor
58 explicit BoardEditorState_AddHole(const Context& context) noexcept;
59 virtual ~BoardEditorState_AddHole() noexcept;
60
61 // General Methods
62 virtual bool entry() noexcept override;
63 virtual bool exit() noexcept override;
64
65 // Event Handlers
67 QGraphicsSceneMouseEvent& e) noexcept override;
69 QGraphicsSceneMouseEvent& e) noexcept override;
71 QGraphicsSceneMouseEvent& e) noexcept override;
72
73 // Operator Overloadings
75 delete;
76
77private: // Methods
78 bool addHole(const Point& pos) noexcept;
79 bool updatePosition(const Point& pos) noexcept;
80 bool fixPosition(const Point& pos) noexcept;
81 bool abortCommand(bool showErrMsgBox) noexcept;
82 void diameterEditValueChanged(const PositiveLength& value) noexcept;
83
84private: // Data
85 // State
88
89 // Information about the current hole to place. Only valid if
90 // mIsUndoCmdActive == true.
93};
94
95/*******************************************************************************
96 * End of File
97 ******************************************************************************/
98
99} // namespace editor
100} // namespace librepcb
101
102#endif
The BI_Hole class.
Definition: bi_hole.h:46
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5....
Definition: point.h:79
The "add hole" state/tool of the board editor.
Definition: boardeditorstate_addhole.h:51
virtual bool processGraphicsSceneMouseMoved(QGraphicsSceneMouseEvent &e) noexcept override
Definition: boardeditorstate_addhole.cpp:107
BI_Hole * mCurrentHoleToPlace
Definition: boardeditorstate_addhole.h:91
PositiveLength mLastDiameter
Definition: boardeditorstate_addhole.h:87
void diameterEditValueChanged(const PositiveLength &value) noexcept
Definition: boardeditorstate_addhole.cpp:207
virtual ~BoardEditorState_AddHole() noexcept
Definition: boardeditorstate_addhole.cpp:57
bool addHole(const Point &pos) noexcept
Definition: boardeditorstate_addhole.cpp:130
bool updatePosition(const Point &pos) noexcept
Definition: boardeditorstate_addhole.cpp:157
BoardEditorState_AddHole(const BoardEditorState_AddHole &other)=delete
bool abortCommand(bool showErrMsgBox) noexcept
Definition: boardeditorstate_addhole.cpp:185
bool mIsUndoCmdActive
Definition: boardeditorstate_addhole.h:86
virtual bool exit() noexcept override
Definition: boardeditorstate_addhole.cpp:92
QScopedPointer< CmdBoardHoleEdit > mCurrentHoleEditCmd
Definition: boardeditorstate_addhole.h:92
bool fixPosition(const Point &pos) noexcept
Definition: boardeditorstate_addhole.cpp:166
virtual bool processGraphicsSceneLeftMouseButtonPressed(QGraphicsSceneMouseEvent &e) noexcept override
Definition: boardeditorstate_addhole.cpp:113
virtual bool entry() noexcept override
Definition: boardeditorstate_addhole.cpp:64
virtual bool processGraphicsSceneLeftMouseButtonDoubleClicked(QGraphicsSceneMouseEvent &e) noexcept override
Definition: boardeditorstate_addhole.cpp:121
The board editor state base class.
Definition: boardeditorstate.h:59
The CmdBoardHoleEdit class.
Definition: cmdboardholeedit.h:49
Definition: occmodel.cpp:77
type_safe::constrained_type< Length, PositiveLengthConstraint, PositiveLengthVerifier > PositiveLength
Definition: length.h:812
FSM Context.
Definition: boardeditorfsm.h:88