LibrePCB Developers Documentation
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_EDITOR_SYMBOLEDITORSTATE_DRAWCIRCLE_H
21#define LIBREPCB_EDITOR_SYMBOLEDITORSTATE_DRAWCIRCLE_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "symboleditorstate.h"
27
28#include <QtCore>
29#include <QtWidgets>
30
31#include <memory>
32
33/*******************************************************************************
34 * Namespace / Forward Declarations
35 ******************************************************************************/
36namespace librepcb {
37
38class Circle;
39class Layer;
40
41namespace editor {
42
43class CircleGraphicsItem;
44class CmdCircleEdit;
45
46/*******************************************************************************
47 * Class SymbolEditorState_DrawCircle
48 ******************************************************************************/
49
54 Q_OBJECT
55
56public:
57 // Constructors / Destructor
60 delete;
61 explicit SymbolEditorState_DrawCircle(const Context& context) noexcept;
63
64 // General Methods
65 bool entry() noexcept override;
66 bool exit() noexcept override;
68 const 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 SymbolEditorState_DrawCircle& rhs) = delete;
80
81private: // 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 Layer& layer) noexcept;
88 void lineWidthEditValueChanged(const UnsignedLength& value) noexcept;
89 void fillCheckBoxCheckedChanged(bool checked) noexcept;
90 void grabAreaCheckBoxCheckedChanged(bool checked) noexcept;
91
92private: // Types / Data
93 QScopedPointer<CmdCircleEdit> mEditCmd;
94 std::shared_ptr<Circle> mCurrentCircle;
96
97 // parameter memory
102};
103
104/*******************************************************************************
105 * End of File
106 ******************************************************************************/
107
108} // namespace editor
109} // namespace librepcb
110
111#endif
The Circle class.
Definition: circle.h:46
The Layer class provides all supported geometry layers.
Definition: layer.h:40
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5....
Definition: point.h:79
The CircleGraphicsItem class.
Definition: circlegraphicsitem.h:48
The CmdCircleEdit class.
Definition: cmdcircleedit.h:51
The EditorWidgetBase class.
Definition: editorwidgetbase.h:62
The SymbolEditorState_DrawCircle class.
Definition: symboleditorstate_drawcircle.h:53
bool processGraphicsSceneMouseMoved(QGraphicsSceneMouseEvent &e) noexcept override
Definition: symboleditorstate_drawcircle.cpp:141
bool updateCircleDiameter(const Point &pos) noexcept
Definition: symboleditorstate_drawcircle.cpp:198
std::shared_ptr< Circle > mCurrentCircle
Definition: symboleditorstate_drawcircle.h:94
const Layer * mLastLayer
Definition: symboleditorstate_drawcircle.h:98
~SymbolEditorState_DrawCircle() noexcept
Definition: symboleditorstate_drawcircle.cpp:62
QScopedPointer< CmdCircleEdit > mEditCmd
Definition: symboleditorstate_drawcircle.h:93
bool mLastFill
Definition: symboleditorstate_drawcircle.h:100
bool startAddCircle(const Point &pos) noexcept
Definition: symboleditorstate_drawcircle.cpp:175
bool processAbortCommand() noexcept override
Definition: symboleditorstate_drawcircle.cpp:163
void fillCheckBoxCheckedChanged(bool checked) noexcept
Definition: symboleditorstate_drawcircle.cpp:258
bool abortAddCircle() noexcept
Definition: symboleditorstate_drawcircle.cpp:228
void grabAreaCheckBoxCheckedChanged(bool checked) noexcept
Definition: symboleditorstate_drawcircle.cpp:266
std::shared_ptr< CircleGraphicsItem > mCurrentGraphicsItem
Definition: symboleditorstate_drawcircle.h:95
bool mLastGrabArea
Definition: symboleditorstate_drawcircle.h:101
void layerComboBoxValueChanged(const Layer &layer) noexcept
Definition: symboleditorstate_drawcircle.cpp:242
bool exit() noexcept override
Definition: symboleditorstate_drawcircle.cpp:118
UnsignedLength mLastLineWidth
Definition: symboleditorstate_drawcircle.h:99
bool finishAddCircle(const Point &pos) noexcept
Definition: symboleditorstate_drawcircle.cpp:209
QSet< EditorWidgetBase::Feature > getAvailableFeatures() const noexcept override
Definition: symboleditorstate_drawcircle.cpp:131
void lineWidthEditValueChanged(const UnsignedLength &value) noexcept
Definition: symboleditorstate_drawcircle.cpp:250
bool processGraphicsSceneLeftMouseButtonPressed(QGraphicsSceneMouseEvent &e) noexcept override
Definition: symboleditorstate_drawcircle.cpp:152
bool entry() noexcept override
Definition: symboleditorstate_drawcircle.cpp:70
SymbolEditorState_DrawCircle(const SymbolEditorState_DrawCircle &other)=delete
The SymbolEditorState class is the base class of all symbol editor FSM states.
Definition: symboleditorstate.h:52
Definition: occmodel.cpp:77
type_safe::constrained_type< Length, UnsignedLengthConstraint, UnsignedLengthVerifier > UnsignedLength
Definition: length.h:696
Definition: symboleditorfsm.h:76