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 void execMassImport() noexcept;
91 QString determineNextPinName() const noexcept;
92 bool hasPin(const QString& name) const noexcept;
93
94private: // Types / Data
95 std::shared_ptr<SymbolPin> mCurrentPin;
97 QScopedPointer<CmdSymbolPinEdit> mEditCmd;
98 QLineEdit* mNameLineEdit;
99
100 // parameter memory
103};
104
105/*******************************************************************************
106 * End of File
107 ******************************************************************************/
108
109} // namespace editor
110} // namespace librepcb
111
112#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:144
bool hasPin(const QString &name) const noexcept
Definition: symboleditorstate_addpins.cpp:283
QLineEdit * mNameLineEdit
Definition: symboleditorstate_addpins.h:98
SymbolEditorState_AddPins(const SymbolEditorState_AddPins &other)=delete
std::shared_ptr< SymbolPinGraphicsItem > mCurrentGraphicsItem
Definition: symboleditorstate_addpins.h:96
QString determineNextPinName() const noexcept
Definition: symboleditorstate_addpins.cpp:277
~SymbolEditorState_AddPins() noexcept
Definition: symboleditorstate_addpins.cpp:61
void execMassImport() noexcept
Definition: symboleditorstate_addpins.cpp:249
bool processRotate(const Angle &rotation) noexcept override
Definition: symboleditorstate_addpins.cpp:180
Angle mLastRotation
Definition: symboleditorstate_addpins.h:101
bool exit() noexcept override
Definition: symboleditorstate_addpins.cpp:111
std::shared_ptr< SymbolPin > mCurrentPin
Definition: symboleditorstate_addpins.h:95
void lengthEditValueChanged(const UnsignedLength &value) noexcept
Definition: symboleditorstate_addpins.cpp:239
void nameLineEditTextChanged(const QString &text) noexcept
Definition: symboleditorstate_addpins.cpp:228
bool processGraphicsSceneRightMouseButtonReleased(QGraphicsSceneMouseEvent &e) noexcept override
Definition: symboleditorstate_addpins.cpp:174
QScopedPointer< CmdSymbolPinEdit > mEditCmd
Definition: symboleditorstate_addpins.h:97
bool processMirror(Qt::Orientation orientation) noexcept override
Definition: symboleditorstate_addpins.cpp:188
QSet< EditorWidgetBase::Feature > getAvailableFeatures() const noexcept override
Definition: symboleditorstate_addpins.cpp:132
bool addNextPin(const Point &pos) noexcept
Definition: symboleditorstate_addpins.cpp:201
bool processGraphicsSceneLeftMouseButtonPressed(QGraphicsSceneMouseEvent &e) noexcept override
Definition: symboleditorstate_addpins.cpp:154
bool entry() noexcept override
Definition: symboleditorstate_addpins.cpp:68
UnsignedLength mLastLength
Definition: symboleditorstate_addpins.h:102
The SymbolEditorState class is the base class of all symbol editor FSM states.
Definition: symboleditorstate.h:54
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