LibrePCB Developers Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
symboleditorstate_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_SYMBOLEDITORSTATE_DRAWCIRCLE_H
21 #define LIBREPCB_LIBRARY_EDITOR_SYMBOLEDITORSTATE_DRAWCIRCLE_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
26 #include "symboleditorstate.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 SymbolEditorState_DrawCircle
47  ******************************************************************************/
48 
53  Q_OBJECT
54 
55 public:
56  // Constructors / Destructor
59  delete;
60  explicit SymbolEditorState_DrawCircle(const Context& context) noexcept;
62 
63  // General Methods
64  bool entry() noexcept override;
65  bool exit() noexcept override;
66 
67  // Event Handlers
69  QGraphicsSceneMouseEvent& e) noexcept override;
71  QGraphicsSceneMouseEvent& e) noexcept override;
72  bool processAbortCommand() noexcept override;
73 
74  // Operator Overloadings
76  const SymbolEditorState_DrawCircle& rhs) = delete;
77 
78 private: // Methods
79  bool startAddCircle(const Point& pos) noexcept;
80  bool updateCircleDiameter(const Point& pos) noexcept;
81  bool finishAddCircle(const Point& pos) noexcept;
82  bool abortAddCircle() noexcept;
83 
84  void layerComboBoxValueChanged(const QString& layerName) noexcept;
85  void lineWidthSpinBoxValueChanged(double value) noexcept;
86  void fillCheckBoxCheckedChanged(bool checked) noexcept;
87  void grabAreaCheckBoxCheckedChanged(bool checked) noexcept;
88 
89 private: // Types / Data
90  QScopedPointer<CmdCircleEdit> mEditCmd;
93 
94  // parameter memory
97  bool mLastFill;
99 };
100 
101 /*******************************************************************************
102  * End of File
103  ******************************************************************************/
104 
105 } // namespace editor
106 } // namespace library
107 } // namespace librepcb
108 
109 #endif // LIBREPCB_LIBRARY_EDITOR_SYMBOLEDITORSTATE_DRAWCIRCLE_H
bool processGraphicsSceneLeftMouseButtonPressed(QGraphicsSceneMouseEvent &e) noexceptoverride
Definition: symboleditorstate_drawcircle.cpp:141
void grabAreaCheckBoxCheckedChanged(bool checked) noexcept
Definition: symboleditorstate_drawcircle.cpp:258
The SymbolEditorState class is the base class of all symbol editor FSM states.
Definition: symboleditorstate.h:49
void fillCheckBoxCheckedChanged(bool checked) noexcept
Definition: symboleditorstate_drawcircle.cpp:250
type_safe::constrained_type< QString, GraphicsLayerNameConstraint, GraphicsLayerNameVerifier > GraphicsLayerName
Definition: graphicslayername.h:78
Circle * mCurrentCircle
Definition: symboleditorstate_drawcircle.h:91
QScopedPointer< CmdCircleEdit > mEditCmd
Definition: symboleditorstate_drawcircle.h:90
void lineWidthSpinBoxValueChanged(double value) noexcept
Definition: symboleditorstate_drawcircle.cpp:242
bool mLastFill
Definition: symboleditorstate_drawcircle.h:97
bool mLastGrabArea
Definition: symboleditorstate_drawcircle.h:98
CircleGraphicsItem * mCurrentGraphicsItem
Definition: symboleditorstate_drawcircle.h:92
UnsignedLength mLastLineWidth
Definition: symboleditorstate_drawcircle.h:96
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5...
Definition: point.h:78
bool entry() noexceptoverride
Definition: symboleditorstate_drawcircle.cpp:71
bool processAbortCommand() noexceptoverride
Definition: symboleditorstate_drawcircle.cpp:152
bool finishAddCircle(const Point &pos) noexcept
Definition: symboleditorstate_drawcircle.cpp:198
~SymbolEditorState_DrawCircle() noexcept
Definition: symboleditorstate_drawcircle.cpp:61
bool exit() noexceptoverride
Definition: symboleditorstate_drawcircle.cpp:114
The Circle class.
Definition: circle.h:47
bool abortAddCircle() noexcept
Definition: symboleditorstate_drawcircle.cpp:217
The SymbolEditorState_DrawCircle class.
Definition: symboleditorstate_drawcircle.h:52
The CircleGraphicsItem class.
Definition: circlegraphicsitem.h:46
GraphicsLayerName mLastLayerName
Definition: symboleditorstate_drawcircle.h:95
bool processGraphicsSceneMouseMoved(QGraphicsSceneMouseEvent &e) noexceptoverride
Definition: symboleditorstate_drawcircle.cpp:130
void layerComboBoxValueChanged(const QString &layerName) noexcept
Definition: symboleditorstate_drawcircle.cpp:231
SymbolEditorState_DrawCircle & operator=(const SymbolEditorState_DrawCircle &rhs)=delete
bool startAddCircle(const Point &pos) noexcept
Definition: symboleditorstate_drawcircle.cpp:164
bool updateCircleDiameter(const Point &pos) noexcept
Definition: symboleditorstate_drawcircle.cpp:187
type_safe::constrained_type< Length, UnsignedLengthConstraint, UnsignedLengthVerifier > UnsignedLength
Definition: length.h:659