LibrePCB Developers Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
packageeditorstate_drawcircle.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_DRAWCIRCLE_H
21 #define LIBREPCB_LIBRARY_EDITOR_PACKAGEEDITORSTATE_DRAWCIRCLE_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
26 #include "packageeditorstate.h"
27 
29 
30 #include <QtCore>
31 #include <QtWidgets>
32 
33 /*******************************************************************************
34  * Namespace / Forward Declarations
35  ******************************************************************************/
36 namespace librepcb {
37 
38 class Circle;
39 class CircleGraphicsItem;
40 class CmdCircleEdit;
41 
42 namespace library {
43 namespace editor {
44 
45 /*******************************************************************************
46  * Class PackageEditorState_DrawCircle
47  ******************************************************************************/
48 
56  Q_OBJECT
57 
58 public:
59  // Constructors / Destructor
62  delete;
63  explicit PackageEditorState_DrawCircle(Context& context) noexcept;
65 
66  // General Methods
67  bool entry() noexcept override;
68  bool exit() noexcept override;
69 
70  // Event Handlers
72  QGraphicsSceneMouseEvent& e) noexcept override;
74  QGraphicsSceneMouseEvent& e) noexcept override;
75  bool processAbortCommand() noexcept override;
76 
77  // Operator Overloadings
79  const PackageEditorState_DrawCircle& rhs) = delete;
80 
81 private: // Methods
82  bool startAddCircle(const Point& pos) noexcept;
83  bool updateCircleDiameter(const Point& pos) noexcept;
84  bool finishAddCircle(const Point& pos) noexcept;
85  bool abortAddCircle() noexcept;
86 
87  void layerComboBoxValueChanged(const QString& layerName) noexcept;
88  void lineWidthSpinBoxValueChanged(double value) noexcept;
89  void fillCheckBoxCheckedChanged(bool checked) noexcept;
90  void grabAreaCheckBoxCheckedChanged(bool checked) noexcept;
91 
92 private: // Types / Data
93  QScopedPointer<CmdCircleEdit> mEditCmd;
96 
97  // parameter memory
100  bool mLastFill;
102 };
103 
104 /*******************************************************************************
105  * End of File
106  ******************************************************************************/
107 
108 } // namespace editor
109 } // namespace library
110 } // namespace librepcb
111 
112 #endif // LIBREPCB_LIBRARY_EDITOR_PACKAGEEDITORSTATE_DRAWCIRCLE_H
bool abortAddCircle() noexcept
Definition: packageeditorstate_drawcircle.cpp:218
CircleGraphicsItem * mCurrentGraphicsItem
Definition: packageeditorstate_drawcircle.h:95
type_safe::constrained_type< QString, GraphicsLayerNameConstraint, GraphicsLayerNameVerifier > GraphicsLayerName
Definition: graphicslayername.h:78
PackageEditorState_DrawCircle & operator=(const PackageEditorState_DrawCircle &rhs)=delete
bool entry() noexceptoverride
Definition: packageeditorstate_drawcircle.cpp:71
void layerComboBoxValueChanged(const QString &layerName) noexcept
Definition: packageeditorstate_drawcircle.cpp:232
GraphicsLayerName mLastLayerName
Definition: packageeditorstate_drawcircle.h:98
bool mLastFill
Definition: packageeditorstate_drawcircle.h:100
QScopedPointer< CmdCircleEdit > mEditCmd
Definition: packageeditorstate_drawcircle.h:93
bool mLastGrabArea
Definition: packageeditorstate_drawcircle.h:101
bool startAddCircle(const Point &pos) noexcept
Definition: packageeditorstate_drawcircle.cpp:164
void lineWidthSpinBoxValueChanged(double value) noexcept
Definition: packageeditorstate_drawcircle.cpp:243
bool processGraphicsSceneLeftMouseButtonPressed(QGraphicsSceneMouseEvent &e) noexceptoverride
Definition: packageeditorstate_drawcircle.cpp:141
bool updateCircleDiameter(const Point &pos) noexcept
Definition: packageeditorstate_drawcircle.cpp:188
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5...
Definition: point.h:81
~PackageEditorState_DrawCircle() noexcept
Definition: packageeditorstate_drawcircle.cpp:61
bool processGraphicsSceneMouseMoved(QGraphicsSceneMouseEvent &e) noexceptoverride
Definition: packageeditorstate_drawcircle.cpp:130
The Circle class.
Definition: circle.h:76
The PackageEditorState class is the base class of all package editor FSM states.
Definition: packageeditorstate.h:52
Circle * mCurrentCircle
Definition: packageeditorstate_drawcircle.h:94
bool finishAddCircle(const Point &pos) noexcept
Definition: packageeditorstate_drawcircle.cpp:199
The CircleGraphicsItem class.
Definition: circlegraphicsitem.h:49
UnsignedLength mLastLineWidth
Definition: packageeditorstate_drawcircle.h:99
The PackageEditorState_DrawCircle class.
Definition: packageeditorstate_drawcircle.h:55
void grabAreaCheckBoxCheckedChanged(bool checked) noexcept
Definition: packageeditorstate_drawcircle.cpp:259
void fillCheckBoxCheckedChanged(bool checked) noexcept
Definition: packageeditorstate_drawcircle.cpp:251
bool exit() noexceptoverride
Definition: packageeditorstate_drawcircle.cpp:114
type_safe::constrained_type< Length, UnsignedLengthConstraint, UnsignedLengthVerifier > UnsignedLength
Definition: length.h:662
bool processAbortCommand() noexceptoverride
Definition: packageeditorstate_drawcircle.cpp:152