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 
51  Q_OBJECT
52 
53 public:
54  // Constructors / Destructor
55  SymbolEditorState_AddPins() = delete;
57  explicit SymbolEditorState_AddPins(const Context& context) noexcept;
58  ~SymbolEditorState_AddPins() noexcept;
59 
60  // General Methods
61  bool entry() noexcept override;
62  bool exit() noexcept override;
63 
64  // Event Handlers
66  QGraphicsSceneMouseEvent& e) noexcept override;
68  QGraphicsSceneMouseEvent& e) noexcept override;
70  QGraphicsSceneMouseEvent& e) noexcept override;
71  bool processRotateCw() noexcept override;
72  bool processRotateCcw() noexcept override;
73 
74  // Operator Overloadings
76  delete;
77 
78 private: // Methods
79  bool addNextPin(const Point& pos, const Angle& rot) noexcept;
80  void nameLineEditTextChanged(const QString& text) noexcept;
81  void lengthEditValueChanged(const UnsignedLength& value) noexcept;
82  QString determineNextPinName() const noexcept;
83  bool hasPin(const QString& name) const noexcept;
84 
85 private: // Types / Data
86  QScopedPointer<CmdSymbolPinEdit> mEditCmd;
89  QLineEdit* mNameLineEdit;
90 
91  // parameter memory
93 };
94 
95 /*******************************************************************************
96  * End of File
97  ******************************************************************************/
98 
99 } // namespace editor
100 } // namespace library
101 } // namespace librepcb
102 
103 #endif // LIBREPCB_LIBRARY_EDITOR_SYMBOLEDITORSTATE_ADDPINS_H
~SymbolEditorState_AddPins() noexcept
Definition: symboleditorstate_addpins.cpp:59
The SymbolEditorState class is the base class of all symbol editor FSM states.
Definition: symboleditorstate.h:49
bool processGraphicsSceneLeftMouseButtonPressed(QGraphicsSceneMouseEvent &e) noexceptoverride
Definition: symboleditorstate_addpins.cpp:128
bool hasPin(const QString &name) const noexcept
Definition: symboleditorstate_addpins.cpp:218
SymbolPin * mCurrentPin
Definition: symboleditorstate_addpins.h:87
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:50
bool entry() noexceptoverride
Definition: symboleditorstate_addpins.cpp:69
bool processGraphicsSceneRightMouseButtonReleased(QGraphicsSceneMouseEvent &e) noexceptoverride
Definition: symboleditorstate_addpins.cpp:147
bool processRotateCcw() noexceptoverride
Definition: symboleditorstate_addpins.cpp:158
bool processGraphicsSceneMouseMoved(QGraphicsSceneMouseEvent &e) noexceptoverride
Definition: symboleditorstate_addpins.cpp:120
bool exit() noexceptoverride
Definition: symboleditorstate_addpins.cpp:96
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5...
Definition: point.h:78
The SymbolPinGraphicsItem class.
Definition: symbolpingraphicsitem.h:53
void nameLineEditTextChanged(const QString &text) noexcept
Definition: symboleditorstate_addpins.cpp:193
bool addNextPin(const Point &pos, const Angle &rot) noexcept
Definition: symboleditorstate_addpins.cpp:167
QString determineNextPinName() const noexcept
Definition: symboleditorstate_addpins.cpp:212
QScopedPointer< CmdSymbolPinEdit > mEditCmd
Definition: symboleditorstate_addpins.h:86
QLineEdit * mNameLineEdit
Definition: symboleditorstate_addpins.h:89
void lengthEditValueChanged(const UnsignedLength &value) noexcept
Definition: symboleditorstate_addpins.cpp:204
SymbolEditorState_AddPins & operator=(const SymbolEditorState_AddPins &rhs)=delete
UnsignedLength mLastLength
Definition: symboleditorstate_addpins.h:92
The SymbolPin class represents one pin of a symbol.
Definition: symbolpin.h:54
SymbolPinGraphicsItem * mCurrentGraphicsItem
Definition: symboleditorstate_addpins.h:88
bool processRotateCw() noexceptoverride
Definition: symboleditorstate_addpins.cpp:153
type_safe::constrained_type< Length, UnsignedLengthConstraint, UnsignedLengthVerifier > UnsignedLength
Definition: length.h:659