LibrePCB Developers Documentation
Loading...
Searching...
No Matches
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
29
30#include <QtCore>
31
32#include <memory>
33
34/*******************************************************************************
35 * Namespace / Forward Declarations
36 ******************************************************************************/
37namespace librepcb {
38namespace editor {
39
40class CmdSymbolPinEdit;
41class SymbolPinGraphicsItem;
42
43/*******************************************************************************
44 * Class SymbolEditorState_AddPins
45 ******************************************************************************/
46
51 Q_OBJECT
52
53public:
54 // Constructors / Destructor
57 explicit SymbolEditorState_AddPins(const Context& context) noexcept;
59
60 // General Methods
61 bool entry() noexcept override;
62 bool exit() noexcept override;
63
64 // Event Handlers
66 const GraphicsSceneMouseEvent& e) noexcept override;
68 const GraphicsSceneMouseEvent& e) noexcept override;
70 const GraphicsSceneMouseEvent& e) noexcept override;
71 bool processRotate(const Angle& rotation) noexcept override;
72 bool processMirror(Qt::Orientation orientation) noexcept override;
73 bool processImportPins() noexcept override;
74
75 // Connection to UI
76 const CircuitIdentifier& getName() const noexcept {
78 }
79 void setName(const CircuitIdentifier& name) noexcept;
80 const UnsignedLength& getLength() const noexcept {
82 }
83 void setLength(const UnsignedLength& length) noexcept;
84
85 // Operator Overloadings
87 delete;
88
89signals:
90 void nameChanged(const CircuitIdentifier& name);
91 void lengthChanged(const UnsignedLength& length);
92
93private: // Methods
94 bool addNextPin(const Point& pos) noexcept;
96 bool hasPin(const QString& name) const noexcept;
97
98private:
100
104};
105
106/*******************************************************************************
107 * End of File
108 ******************************************************************************/
109
110} // namespace editor
111} // namespace librepcb
112
113#endif
The Angle class is used to represent an angle (for example 12.75 degrees)
Definition angle.h:76
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5....
Definition point.h:78
The SymbolPin class represents one pin of a symbol.
Definition symbolpin.h:51
const CircuitIdentifier & getName() const noexcept
Definition symbolpin.h:84
const UnsignedLength & getLength() const noexcept
Definition symbolpin.h:86
The CmdSymbolPinEdit class.
Definition cmdsymbolpinedit.h:48
The SymbolEditorState_AddPins class.
Definition symboleditorstate_addpins.h:50
void lengthChanged(const UnsignedLength &length)
bool hasPin(const QString &name) const noexcept
Definition symboleditorstate_addpins.cpp:256
bool processGraphicsSceneMouseMoved(const GraphicsSceneMouseEvent &e) noexcept override
Definition symboleditorstate_addpins.cpp:140
SymbolEditorState_AddPins(const SymbolEditorState_AddPins &other)=delete
void nameChanged(const CircuitIdentifier &name)
bool processGraphicsSceneRightMouseButtonReleased(const GraphicsSceneMouseEvent &e) noexcept override
Definition symboleditorstate_addpins.cpp:168
std::shared_ptr< SymbolPinGraphicsItem > mCurrentGraphicsItem
Definition symboleditorstate_addpins.h:102
std::unique_ptr< CmdSymbolPinEdit > mCurrentEditCmd
Definition symboleditorstate_addpins.h:103
bool processGraphicsSceneLeftMouseButtonPressed(const GraphicsSceneMouseEvent &e) noexcept override
Definition symboleditorstate_addpins.cpp:149
~SymbolEditorState_AddPins() noexcept
Definition symboleditorstate_addpins.cpp:66
void setLength(const UnsignedLength &length) noexcept
Definition symboleditorstate_addpins.cpp:120
SymbolPin mCurrentProperties
Definition symboleditorstate_addpins.h:99
const CircuitIdentifier & getName() const noexcept
Definition symboleditorstate_addpins.h:76
bool processImportPins() noexcept override
Definition symboleditorstate_addpins.cpp:191
CircuitIdentifier determineNextPinName() const noexcept
Definition symboleditorstate_addpins.cpp:249
bool processRotate(const Angle &rotation) noexcept override
Definition symboleditorstate_addpins.cpp:174
SymbolEditorState_AddPins & operator=(const SymbolEditorState_AddPins &rhs)=delete
const UnsignedLength & getLength() const noexcept
Definition symboleditorstate_addpins.h:80
void setName(const CircuitIdentifier &name) noexcept
Definition symboleditorstate_addpins.cpp:109
bool exit() noexcept override
Definition symboleditorstate_addpins.cpp:87
std::shared_ptr< SymbolPin > mCurrentPin
Definition symboleditorstate_addpins.h:101
bool processMirror(Qt::Orientation orientation) noexcept override
Definition symboleditorstate_addpins.cpp:182
bool addNextPin(const Point &pos) noexcept
Definition symboleditorstate_addpins.cpp:223
bool entry() noexcept override
Definition symboleditorstate_addpins.cpp:73
The SymbolEditorState class is the base class of all symbol editor FSM states.
Definition symboleditorstate.h:56
The SymbolPinGraphicsItem class.
Definition symbolpingraphicsitem.h:53
Definition occmodel.cpp:77
type_safe::constrained_type< QString, CircuitIdentifierConstraint, CircuitIdentifierVerifier > CircuitIdentifier
Definition circuitidentifier.h:88
type_safe::constrained_type< Length, UnsignedLengthConstraint, UnsignedLengthVerifier > UnsignedLength
Definition length.h:694
Definition uuid.h:186
Definition graphicsscene.h:45
Definition symboleditorfsm.h:75