LibrePCB Developers Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
packageeditorstate_addholes.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_LIBRARY_EDITOR_PACKAGEEDITORSTATE_ADDHOLES_H
21 #define LIBREPCB_LIBRARY_EDITOR_PACKAGEEDITORSTATE_ADDHOLES_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
26 #include "packageeditorstate.h"
27 
28 #include <QtCore>
29 #include <QtWidgets>
30 
31 /*******************************************************************************
32  * Namespace / Forward Declarations
33  ******************************************************************************/
34 namespace librepcb {
35 
36 class Hole;
37 class HoleGraphicsItem;
38 class CmdHoleEdit;
39 
40 namespace library {
41 
42 namespace editor {
43 
44 /*******************************************************************************
45  * Class PackageEditorState_AddHoles
46  ******************************************************************************/
47 
52  Q_OBJECT
53 
54 public:
55  // Constructors / Destructor
56  PackageEditorState_AddHoles() = delete;
58  delete;
59  explicit PackageEditorState_AddHoles(Context& context) noexcept;
61 
62  // General Methods
63  bool entry() noexcept override;
64  bool exit() noexcept override;
65 
66  // Event Handlers
68  QGraphicsSceneMouseEvent& e) noexcept override;
70  QGraphicsSceneMouseEvent& e) noexcept override;
71 
72  // Operator Overloadings
74  const PackageEditorState_AddHoles& rhs) = delete;
75 
76 private: // Methods
77  bool startAddHole(const Point& pos) noexcept;
78  bool finishAddHole(const Point& pos) noexcept;
79  bool abortAddHole() noexcept;
80  void diameterSpinBoxValueChanged(double value) noexcept;
81 
82 private: // Data
84  QScopedPointer<CmdHoleEdit> mEditCmd;
87 
88  // parameter memory
90 };
91 
92 /*******************************************************************************
93  * End of File
94  ******************************************************************************/
95 
96 } // namespace editor
97 } // namespace library
98 } // namespace librepcb
99 
100 #endif // LIBREPCB_LIBRARY_EDITOR_PACKAGEEDITORSTATE_ADDHOLES_H
Point mStartPos
Definition: packageeditorstate_addholes.h:83
bool finishAddHole(const Point &pos) noexcept
Definition: packageeditorstate_addholes.cpp:156
The Hole class.
Definition: hole.h:46
bool processGraphicsSceneLeftMouseButtonPressed(QGraphicsSceneMouseEvent &e) noexceptoverride
Definition: packageeditorstate_addholes.cpp:119
~PackageEditorState_AddHoles() noexcept
Definition: packageeditorstate_addholes.cpp:57
The HoleGraphicsItem class is the graphical representation of a librepcb::Hole.
Definition: holegraphicsitem.h:48
bool startAddHole(const Point &pos) noexcept
Definition: packageeditorstate_addholes.cpp:133
void diameterSpinBoxValueChanged(double value) noexcept
Definition: packageeditorstate_addholes.cpp:189
PositiveLength mLastDiameter
Definition: packageeditorstate_addholes.h:89
HoleGraphicsItem * mCurrentGraphicsItem
Definition: packageeditorstate_addholes.h:86
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5...
Definition: point.h:78
QScopedPointer< CmdHoleEdit > mEditCmd
Definition: packageeditorstate_addholes.h:84
bool abortAddHole() noexcept
Definition: packageeditorstate_addholes.cpp:175
The PackageEditorState_AddHoles class.
Definition: packageeditorstate_addholes.h:51
Hole * mCurrentHole
Definition: packageeditorstate_addholes.h:85
The PackageEditorState class is the base class of all package editor FSM states.
Definition: packageeditorstate.h:49
PackageEditorState_AddHoles & operator=(const PackageEditorState_AddHoles &rhs)=delete
bool processGraphicsSceneMouseMoved(QGraphicsSceneMouseEvent &e) noexceptoverride
Definition: packageeditorstate_addholes.cpp:107
bool exit() noexceptoverride
Definition: packageeditorstate_addholes.cpp:91
bool entry() noexceptoverride
Definition: packageeditorstate_addholes.cpp:67
type_safe::constrained_type< Length, PositiveLengthConstraint, PositiveLengthVerifier > PositiveLength
Definition: length.h:780