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  ******************************************************************************/
39 namespace librepcb {
40 
41 class Point;
42 class SymbolPin;
43 
44 namespace editor {
45 
46 class CmdSymbolPinEdit;
47 class SymbolPinGraphicsItem;
48 
49 /*******************************************************************************
50  * Class SymbolEditorState_AddPins
51  ******************************************************************************/
52 
57  Q_OBJECT
58 
59 public:
60  // Constructors / Destructor
61  SymbolEditorState_AddPins() = delete;
63  explicit SymbolEditorState_AddPins(const Context& context) noexcept;
64  ~SymbolEditorState_AddPins() noexcept;
65 
66  // General Methods
67  bool entry() noexcept override;
68  bool exit() noexcept override;
69  QSet<EditorWidgetBase::Feature> getAvailableFeatures()
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 
86 private: // 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 
93 private: // Types / Data
94  std::shared_ptr<SymbolPin> mCurrentPin;
95  std::shared_ptr<SymbolPinGraphicsItem> mCurrentGraphicsItem;
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 SymbolEditorState class is the base class of all symbol editor FSM states.
Definition: symboleditorstate.h:52
QSet< EditorWidgetBase::Feature > getAvailableFeatures() const noexcept override
Definition: symboleditorstate_addpins.cpp:122
bool entry() noexcept override
Definition: symboleditorstate_addpins.cpp:66
SymbolEditorState_AddPins & operator=(const SymbolEditorState_AddPins &rhs)=delete
std::shared_ptr< SymbolPin > mCurrentPin
Definition: symboleditorstate_addpins.h:94
bool processGraphicsSceneRightMouseButtonReleased(QGraphicsSceneMouseEvent &e) noexcept override
Definition: symboleditorstate_addpins.cpp:164
QScopedPointer< CmdSymbolPinEdit > mEditCmd
Definition: symboleditorstate_addpins.h:96
Definition: occmodel.cpp:77
void nameLineEditTextChanged(const QString &text) noexcept
Definition: symboleditorstate_addpins.cpp:218
UnsignedLength mLastLength
Definition: symboleditorstate_addpins.h:101
bool processGraphicsSceneMouseMoved(QGraphicsSceneMouseEvent &e) noexcept override
Definition: symboleditorstate_addpins.cpp:134
std::shared_ptr< SymbolPinGraphicsItem > mCurrentGraphicsItem
Definition: symboleditorstate_addpins.h:95
The Angle class is used to represent an angle (for example 12.75 degrees)
Definition: angle.h:78
The SymbolEditorState_AddPins class.
Definition: symboleditorstate_addpins.h:56
QLineEdit * mNameLineEdit
Definition: symboleditorstate_addpins.h:97
bool processRotate(const Angle &rotation) noexcept override
Definition: symboleditorstate_addpins.cpp:170
bool processMirror(Qt::Orientation orientation) noexcept override
Definition: symboleditorstate_addpins.cpp:178
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5...
Definition: point.h:79
bool addNextPin(const Point &pos) noexcept
Definition: symboleditorstate_addpins.cpp:191
bool processGraphicsSceneLeftMouseButtonPressed(QGraphicsSceneMouseEvent &e) noexcept override
Definition: symboleditorstate_addpins.cpp:144
void lengthEditValueChanged(const UnsignedLength &value) noexcept
Definition: symboleditorstate_addpins.cpp:229
Definition: symboleditorfsm.h:76
bool hasPin(const QString &name) const noexcept
Definition: symboleditorstate_addpins.cpp:245
Angle mLastRotation
Definition: symboleditorstate_addpins.h:100
bool exit() noexcept override
Definition: symboleditorstate_addpins.cpp:101
~SymbolEditorState_AddPins() noexcept
Definition: symboleditorstate_addpins.cpp:59
QString determineNextPinName() const noexcept
Definition: symboleditorstate_addpins.cpp:239
type_safe::constrained_type< Length, UnsignedLengthConstraint, UnsignedLengthVerifier > UnsignedLength
Definition: length.h:696