LibrePCB Developers Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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_LIBRARY_EDITOR_SYMBOLEDITORSTATE_ADDPINS_H
21 #define LIBREPCB_LIBRARY_EDITOR_SYMBOLEDITORSTATE_ADDPINS_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
26 #include "symboleditorstate.h"
27 
28 #include <QtCore>
29 #include <QtWidgets>
30 
31 /*******************************************************************************
32  * Namespace / Forward Declarations
33  ******************************************************************************/
34 namespace librepcb {
35 namespace library {
36 
37 class SymbolPin;
38 class SymbolPinGraphicsItem;
39 class CmdSymbolPinEdit;
40 
41 namespace editor {
42 
43 /*******************************************************************************
44  * Class SymbolEditorState_AddPins
45  ******************************************************************************/
46 
54  Q_OBJECT
55 
56 public:
57  // Constructors / Destructor
58  SymbolEditorState_AddPins() = delete;
60  explicit SymbolEditorState_AddPins(const Context& context) noexcept;
61  ~SymbolEditorState_AddPins() 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;
73  QGraphicsSceneMouseEvent& e) noexcept override;
74  bool processRotateCw() noexcept override;
75  bool processRotateCcw() noexcept override;
76 
77  // Operator Overloadings
79  delete;
80 
81 private: // Methods
82  bool addNextPin(const Point& pos, const Angle& rot) noexcept;
83  void nameLineEditTextChanged(const QString& text) noexcept;
84  void lengthSpinBoxValueChanged(double value) noexcept;
85  QString determineNextPinName() const noexcept;
86  bool hasPin(const QString& name) const noexcept;
87 
88 private: // Types / Data
89  QScopedPointer<CmdSymbolPinEdit> mEditCmd;
92  QLineEdit* mNameLineEdit;
93 
94  // parameter memory
96 };
97 
98 /*******************************************************************************
99  * End of File
100  ******************************************************************************/
101 
102 } // namespace editor
103 } // namespace library
104 } // namespace librepcb
105 
106 #endif // LIBREPCB_LIBRARY_EDITOR_SYMBOLEDITORSTATE_ADDPINS_H
~SymbolEditorState_AddPins() noexcept
Definition: symboleditorstate_addpins.cpp:57
The SymbolEditorState class is the base class of all symbol editor FSM states.
Definition: symboleditorstate.h:52
bool processGraphicsSceneLeftMouseButtonPressed(QGraphicsSceneMouseEvent &e) noexceptoverride
Definition: symboleditorstate_addpins.cpp:131
bool hasPin(const QString &name) const noexcept
Definition: symboleditorstate_addpins.cpp:221
SymbolPin * mCurrentPin
Definition: symboleditorstate_addpins.h:90
The Angle class is used to represent an angle (for example 12.75 degrees)
Definition: angle.h:81
The SymbolEditorState_AddPins class.
Definition: symboleditorstate_addpins.h:53
bool entry() noexceptoverride
Definition: symboleditorstate_addpins.cpp:67
bool processGraphicsSceneRightMouseButtonReleased(QGraphicsSceneMouseEvent &e) noexceptoverride
Definition: symboleditorstate_addpins.cpp:150
bool processRotateCcw() noexceptoverride
Definition: symboleditorstate_addpins.cpp:161
bool processGraphicsSceneMouseMoved(QGraphicsSceneMouseEvent &e) noexceptoverride
Definition: symboleditorstate_addpins.cpp:123
bool exit() noexceptoverride
Definition: symboleditorstate_addpins.cpp:99
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5...
Definition: point.h:81
The SymbolPinGraphicsItem class.
Definition: symbolpingraphicsitem.h:56
void nameLineEditTextChanged(const QString &text) noexcept
Definition: symboleditorstate_addpins.cpp:196
bool addNextPin(const Point &pos, const Angle &rot) noexcept
Definition: symboleditorstate_addpins.cpp:170
QString determineNextPinName() const noexcept
Definition: symboleditorstate_addpins.cpp:215
void lengthSpinBoxValueChanged(double value) noexcept
Definition: symboleditorstate_addpins.cpp:207
QScopedPointer< CmdSymbolPinEdit > mEditCmd
Definition: symboleditorstate_addpins.h:89
QLineEdit * mNameLineEdit
Definition: symboleditorstate_addpins.h:92
SymbolEditorState_AddPins & operator=(const SymbolEditorState_AddPins &rhs)=delete
UnsignedLength mLastLength
Definition: symboleditorstate_addpins.h:95
The SymbolPin class represents one pin of a symbol.
Definition: symbolpin.h:54
SymbolPinGraphicsItem * mCurrentGraphicsItem
Definition: symboleditorstate_addpins.h:91
bool processRotateCw() noexceptoverride
Definition: symboleditorstate_addpins.cpp:156
type_safe::constrained_type< Length, UnsignedLengthConstraint, UnsignedLengthVerifier > UnsignedLength
Definition: length.h:662