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 
55  Q_OBJECT
56 
57 public:
58  // Constructors / Destructor
59  PackageEditorState_AddHoles() = delete;
61  delete;
62  explicit PackageEditorState_AddHoles(Context& context) noexcept;
64 
65  // General Methods
66  bool entry() noexcept override;
67  bool exit() noexcept override;
68 
69  // Event Handlers
71  QGraphicsSceneMouseEvent& e) noexcept override;
73  QGraphicsSceneMouseEvent& e) noexcept override;
74 
75  // Operator Overloadings
77  const PackageEditorState_AddHoles& rhs) = delete;
78 
79 private: // Methods
80  bool startAddHole(const Point& pos) noexcept;
81  bool finishAddHole(const Point& pos) noexcept;
82  bool abortAddHole() noexcept;
83  void diameterSpinBoxValueChanged(double value) noexcept;
84 
85 private: // Data
87  QScopedPointer<CmdHoleEdit> mEditCmd;
90 
91  // parameter memory
93 };
94 
95 /*******************************************************************************
96  * End of File
97  ******************************************************************************/
98 
99 } // namespace editor
100 } // namespace library
101 } // namespace librepcb
102 
103 #endif // LIBREPCB_LIBRARY_EDITOR_PACKAGEEDITORSTATE_ADDHOLES_H
Point mStartPos
Definition: packageeditorstate_addholes.h:86
bool finishAddHole(const Point &pos) noexcept
Definition: packageeditorstate_addholes.cpp:156
The Hole class.
Definition: hole.h:69
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::Text.
Definition: holegraphicsitem.h:51
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:92
HoleGraphicsItem * mCurrentGraphicsItem
Definition: packageeditorstate_addholes.h:89
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5...
Definition: point.h:81
QScopedPointer< CmdHoleEdit > mEditCmd
Definition: packageeditorstate_addholes.h:87
bool abortAddHole() noexcept
Definition: packageeditorstate_addholes.cpp:175
The PackageEditorState_AddHoles class.
Definition: packageeditorstate_addholes.h:54
Hole * mCurrentHole
Definition: packageeditorstate_addholes.h:88
The PackageEditorState class is the base class of all package editor FSM states.
Definition: packageeditorstate.h:52
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:783