LibrePCB Developers Documentation
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_EDITOR_PACKAGEEDITORSTATE_DRAWCIRCLE_H
21#define LIBREPCB_EDITOR_PACKAGEEDITORSTATE_DRAWCIRCLE_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "packageeditorstate.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 PackageEditorState_DrawCircle
48 ******************************************************************************/
49
54 Q_OBJECT
55
56public:
57 // Constructors / Destructor
60 delete;
61 explicit PackageEditorState_DrawCircle(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 PackageEditorState_DrawCircle& rhs) = delete;
80
81signals:
82 void requestLineWidth(const UnsignedLength& value);
83
84private: // Methods
85 bool startAddCircle(const Point& pos) noexcept;
86 bool updateCircleDiameter(const Point& pos) noexcept;
87 bool finishAddCircle(const Point& pos) noexcept;
88 bool abortAddCircle() noexcept;
89
90 void layerComboBoxValueChanged(const Layer& layer) noexcept;
91 void lineWidthEditValueChanged(const UnsignedLength& value) noexcept;
92 void fillCheckBoxCheckedChanged(bool checked) noexcept;
93 void grabAreaCheckBoxCheckedChanged(bool checked) noexcept;
94
95private: // Types / Data
96 QScopedPointer<CmdCircleEdit> mEditCmd;
97 std::shared_ptr<Circle> mCurrentCircle;
99
100 // parameter memory
106};
107
108/*******************************************************************************
109 * End of File
110 ******************************************************************************/
111
112} // namespace editor
113} // namespace librepcb
114
115#endif
The Circle class.
Definition: circle.h:46
The Layer class provides all supported geometry layers.
Definition: layer.h:42
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 PackageEditorState_DrawCircle class.
Definition: packageeditorstate_drawcircle.h:53
bool processGraphicsSceneMouseMoved(QGraphicsSceneMouseEvent &e) noexcept override
Definition: packageeditorstate_drawcircle.cpp:143
bool updateCircleDiameter(const Point &pos) noexcept
Definition: packageeditorstate_drawcircle.cpp:200
std::shared_ptr< Circle > mCurrentCircle
Definition: packageeditorstate_drawcircle.h:97
const Layer * mLastLayer
Definition: packageeditorstate_drawcircle.h:101
void requestLineWidth(const UnsignedLength &value)
QScopedPointer< CmdCircleEdit > mEditCmd
Definition: packageeditorstate_drawcircle.h:96
bool mLastFill
Definition: packageeditorstate_drawcircle.h:103
bool startAddCircle(const Point &pos) noexcept
Definition: packageeditorstate_drawcircle.cpp:177
QHash< const Layer *, UnsignedLength > mUsedLineWidths
Definition: packageeditorstate_drawcircle.h:105
bool processAbortCommand() noexcept override
Definition: packageeditorstate_drawcircle.cpp:165
void fillCheckBoxCheckedChanged(bool checked) noexcept
Definition: packageeditorstate_drawcircle.cpp:270
bool abortAddCircle() noexcept
Definition: packageeditorstate_drawcircle.cpp:230
void grabAreaCheckBoxCheckedChanged(bool checked) noexcept
Definition: packageeditorstate_drawcircle.cpp:278
std::shared_ptr< CircleGraphicsItem > mCurrentGraphicsItem
Definition: packageeditorstate_drawcircle.h:98
bool mLastGrabArea
Definition: packageeditorstate_drawcircle.h:104
~PackageEditorState_DrawCircle() noexcept
Definition: packageeditorstate_drawcircle.cpp:62
void layerComboBoxValueChanged(const Layer &layer) noexcept
Definition: packageeditorstate_drawcircle.cpp:244
bool exit() noexcept override
Definition: packageeditorstate_drawcircle.cpp:120
UnsignedLength mLastLineWidth
Definition: packageeditorstate_drawcircle.h:102
bool finishAddCircle(const Point &pos) noexcept
Definition: packageeditorstate_drawcircle.cpp:211
QSet< EditorWidgetBase::Feature > getAvailableFeatures() const noexcept override
Definition: packageeditorstate_drawcircle.cpp:133
void lineWidthEditValueChanged(const UnsignedLength &value) noexcept
Definition: packageeditorstate_drawcircle.cpp:261
bool processGraphicsSceneLeftMouseButtonPressed(QGraphicsSceneMouseEvent &e) noexcept override
Definition: packageeditorstate_drawcircle.cpp:154
PackageEditorState_DrawCircle(const PackageEditorState_DrawCircle &other)=delete
bool entry() noexcept override
Definition: packageeditorstate_drawcircle.cpp:70
The PackageEditorState class is the base class of all package editor FSM states.
Definition: packageeditorstate.h:52
Definition: occmodel.cpp:77
type_safe::constrained_type< Length, UnsignedLengthConstraint, UnsignedLengthVerifier > UnsignedLength
Definition: length.h:696
Definition: packageeditorfsm.h:90