LibrePCB Developers Documentation
symboleditorstate_addpins.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_ADDPINS_H
21#define LIBREPCB_EDITOR_SYMBOLEDITORSTATE_ADDPINS_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "symboleditorstate.h"
27
30
31#include <QtCore>
32#include <QtWidgets>
33
34#include <memory>
35
36/*******************************************************************************
37 * Namespace / Forward Declarations
38 ******************************************************************************/
39namespace librepcb {
40
41class Point;
42class SymbolPin;
43
44namespace editor {
45
46class CmdSymbolPinEdit;
47class SymbolPinGraphicsItem;
48
49/*******************************************************************************
50 * Class SymbolEditorState_AddPins
51 ******************************************************************************/
52
57 Q_OBJECT
58
59public:
60 // Constructors / Destructor
63 explicit SymbolEditorState_AddPins(const Context& context) noexcept;
65
66 // General Methods
67 bool entry() noexcept override;
68 bool exit() noexcept override;
70 const noexcept override;
71
72 // Event Handlers
74 QGraphicsSceneMouseEvent& e) noexcept override;
76 QGraphicsSceneMouseEvent& e) noexcept override;
78 QGraphicsSceneMouseEvent& e) noexcept override;
79 bool processRotate(const Angle& rotation) noexcept override;
80 bool processMirror(Qt::Orientation orientation) noexcept override;
81
82 // Operator Overloadings
84 delete;
85
86private: // Methods
87 bool addNextPin(const Point& pos) noexcept;
88 void nameLineEditTextChanged(const QString& text) noexcept;
89 void lengthEditValueChanged(const UnsignedLength& value) noexcept;
90 QString determineNextPinName() const noexcept;
91 bool hasPin(const QString& name) const noexcept;
92
93private: // Types / Data
94 std::shared_ptr<SymbolPin> mCurrentPin;
96 QScopedPointer<CmdSymbolPinEdit> mEditCmd;
97 QLineEdit* mNameLineEdit;
98
99 // parameter memory
102};
103
104/*******************************************************************************
105 * End of File
106 ******************************************************************************/
107
108} // namespace editor
109} // namespace librepcb
110
111#endif
The Angle class is used to represent an angle (for example 12.75 degrees)
Definition: angle.h:78
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5....
Definition: point.h:79
The SymbolPin class represents one pin of a symbol.
Definition: symbolpin.h:51
The CmdSymbolPinEdit class.
Definition: cmdsymbolpinedit.h:48
The EditorWidgetBase class.
Definition: editorwidgetbase.h:62
The SymbolEditorState_AddPins class.
Definition: symboleditorstate_addpins.h:56
bool processGraphicsSceneMouseMoved(QGraphicsSceneMouseEvent &e) noexcept override
Definition: symboleditorstate_addpins.cpp:134
bool hasPin(const QString &name) const noexcept
Definition: symboleditorstate_addpins.cpp:245
QLineEdit * mNameLineEdit
Definition: symboleditorstate_addpins.h:97
SymbolEditorState_AddPins(const SymbolEditorState_AddPins &other)=delete
std::shared_ptr< SymbolPinGraphicsItem > mCurrentGraphicsItem
Definition: symboleditorstate_addpins.h:95
QString determineNextPinName() const noexcept
Definition: symboleditorstate_addpins.cpp:239
~SymbolEditorState_AddPins() noexcept
Definition: symboleditorstate_addpins.cpp:59
bool processRotate(const Angle &rotation) noexcept override
Definition: symboleditorstate_addpins.cpp:170
Angle mLastRotation
Definition: symboleditorstate_addpins.h:100
bool exit() noexcept override
Definition: symboleditorstate_addpins.cpp:101
std::shared_ptr< SymbolPin > mCurrentPin
Definition: symboleditorstate_addpins.h:94
void lengthEditValueChanged(const UnsignedLength &value) noexcept
Definition: symboleditorstate_addpins.cpp:229
void nameLineEditTextChanged(const QString &text) noexcept
Definition: symboleditorstate_addpins.cpp:218
bool processGraphicsSceneRightMouseButtonReleased(QGraphicsSceneMouseEvent &e) noexcept override
Definition: symboleditorstate_addpins.cpp:164
QScopedPointer< CmdSymbolPinEdit > mEditCmd
Definition: symboleditorstate_addpins.h:96
bool processMirror(Qt::Orientation orientation) noexcept override
Definition: symboleditorstate_addpins.cpp:178
QSet< EditorWidgetBase::Feature > getAvailableFeatures() const noexcept override
Definition: symboleditorstate_addpins.cpp:122
bool addNextPin(const Point &pos) noexcept
Definition: symboleditorstate_addpins.cpp:191
bool processGraphicsSceneLeftMouseButtonPressed(QGraphicsSceneMouseEvent &e) noexcept override
Definition: symboleditorstate_addpins.cpp:144
bool entry() noexcept override
Definition: symboleditorstate_addpins.cpp:66
UnsignedLength mLastLength
Definition: symboleditorstate_addpins.h:101
The SymbolEditorState class is the base class of all symbol editor FSM states.
Definition: symboleditorstate.h:52
The SymbolPinGraphicsItem class.
Definition: symbolpingraphicsitem.h:53
Definition: occmodel.cpp:77
type_safe::constrained_type< Length, UnsignedLengthConstraint, UnsignedLengthVerifier > UnsignedLength
Definition: length.h:696
Definition: symboleditorfsm.h:76