LibrePCB Developers Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
packageeditorstate_addpads.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_PACKAGEEDITORSTATE_ADDPADS_H
21 #define LIBREPCB_LIBRARY_EDITOR_PACKAGEEDITORSTATE_ADDPADS_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
26 #include "packageeditorstate.h"
27 
29 
30 #include <QtCore>
31 #include <QtWidgets>
32 
33 /*******************************************************************************
34  * Namespace / Forward Declarations
35  ******************************************************************************/
36 namespace librepcb {
37 namespace library {
38 
39 class PackagePad;
40 class CmdFootprintPadEdit;
41 
42 namespace editor {
43 
44 class PackagePadComboBox;
45 
46 /*******************************************************************************
47  * Class PackageEditorState_AddPads
48  ******************************************************************************/
49 
57  Q_OBJECT
58 
59 public:
60  // Types
61  enum class PadType { THT, SMT };
62 
63  // Constructors / Destructor
64  PackageEditorState_AddPads() = delete;
66  explicit PackageEditorState_AddPads(Context& context, PadType type) noexcept;
67  virtual ~PackageEditorState_AddPads() noexcept;
68 
69  // General Methods
70  virtual bool entry() noexcept override;
71  virtual bool exit() noexcept override;
72 
73  // Event Handlers
74  virtual bool processGraphicsSceneMouseMoved(
75  QGraphicsSceneMouseEvent& e) noexcept override;
77  QGraphicsSceneMouseEvent& e) noexcept override;
79  QGraphicsSceneMouseEvent& e) noexcept override;
80  virtual bool processRotateCw() noexcept override;
81  virtual bool processRotateCcw() noexcept override;
82 
83  // Operator Overloadings
85  delete;
86 
87 private: // Methods
88  bool startAddPad(const Point& pos) noexcept;
89  bool finishAddPad(const Point& pos) noexcept;
90  bool abortAddPad() noexcept;
93  FootprintPad::BoardSide side) noexcept;
94  void shapeSelectorCurrentShapeChanged(FootprintPad::Shape shape) noexcept;
95  void widthSpinBoxValueChanged(double value) noexcept;
96  void heightSpinBoxValueChanged(double value) noexcept;
97  void drillDiameterSpinBoxValueChanged(double value) noexcept;
98 
99 private: // Types / Data
102  QScopedPointer<CmdFootprintPadEdit> mEditCmd;
103  std::shared_ptr<FootprintPad> mCurrentPad;
106 
107  // parameter memory
109 };
110 
111 /*******************************************************************************
112  * Class PackageEditorState_AddPadsTht
113  ******************************************************************************/
114 
122  Q_OBJECT
123 
124 public:
125  // Constructors / Destructor
128  delete;
129  explicit PackageEditorState_AddPadsTht(Context& context) noexcept
132 
133  // Operator Overloadings
135  const PackageEditorState_AddPadsTht& rhs) = delete;
136 };
137 
138 /*******************************************************************************
139  * Class PackageEditorState_AddPadsSmt
140  ******************************************************************************/
141 
149  Q_OBJECT
150 
151 public:
152  // Constructors / Destructor
155  delete;
156  explicit PackageEditorState_AddPadsSmt(Context& context) noexcept
159 
160  // Operator Overloadings
162  const PackageEditorState_AddPadsSmt& rhs) = delete;
163 };
164 
165 /*******************************************************************************
166  * End of File
167  ******************************************************************************/
168 
169 } // namespace editor
170 } // namespace library
171 } // namespace librepcb
172 
173 #endif // LIBREPCB_LIBRARY_EDITOR_PACKAGEEDITORSTATE_ADDPADS_H
PadType
Definition: packageeditorstate_addpads.h:61
Point mStartPos
Definition: packageeditorstate_addpads.h:101
The PackageEditorState_AddPads class.
Definition: packageeditorstate_addpads.h:56
FootprintPadGraphicsItem * mCurrentGraphicsItem
Definition: packageeditorstate_addpads.h:104
virtual bool processGraphicsSceneRightMouseButtonReleased(QGraphicsSceneMouseEvent &e) noexceptoverride
Definition: packageeditorstate_addpads.cpp:210
~PackageEditorState_AddPadsTht() noexcept
Definition: packageeditorstate_addpads.h:131
The CmdFootprintPadEdit class.
Definition: cmdfootprintpadedit.h:45
bool abortAddPad() noexcept
Definition: packageeditorstate_addpads.cpp:284
void boardSideSelectorCurrentSideChanged(FootprintPad::BoardSide side) noexcept
Definition: packageeditorstate_addpads.cpp:309
PackagePadComboBox * mPackagePadComboBox
Definition: packageeditorstate_addpads.h:105
PackageEditorState_AddPadsTht(Context &context) noexcept
Definition: packageeditorstate_addpads.h:129
PackageEditorState_AddPadsSmt(Context &context) noexcept
Definition: packageeditorstate_addpads.h:156
virtual bool processRotateCw() noexceptoverride
Definition: packageeditorstate_addpads.cpp:216
virtual ~PackageEditorState_AddPads() noexcept
Definition: packageeditorstate_addpads.cpp:71
virtual bool exit() noexceptoverride
Definition: packageeditorstate_addpads.cpp:171
The PackagePadComboBox class.
Definition: packagepadcombobox.h:48
void packagePadComboBoxCurrentPadChanged(PackagePad *pad) noexcept
Definition: packageeditorstate_addpads.cpp:299
virtual bool processGraphicsSceneMouseMoved(QGraphicsSceneMouseEvent &e) noexceptoverride
Definition: packageeditorstate_addpads.cpp:188
std::shared_ptr< FootprintPad > mCurrentPad
Definition: packageeditorstate_addpads.h:103
virtual bool processGraphicsSceneLeftMouseButtonPressed(QGraphicsSceneMouseEvent &e) noexceptoverride
Definition: packageeditorstate_addpads.cpp:200
void shapeSelectorCurrentShapeChanged(FootprintPad::Shape shape) noexcept
Definition: packageeditorstate_addpads.cpp:317
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5...
Definition: point.h:81
PadType mPadType
Definition: packageeditorstate_addpads.h:100
The PackageEditorState class is the base class of all package editor FSM states.
Definition: packageeditorstate.h:52
bool finishAddPad(const Point &pos) noexcept
Definition: packageeditorstate_addpads.cpp:263
FootprintPad mLastPad
Definition: packageeditorstate_addpads.h:108
The FootprintPad class represents a pad of a footprint.
Definition: footprintpad.h:52
The PackageEditorState_AddPadsTht class.
Definition: packageeditorstate_addpads.h:121
virtual bool entry() noexceptoverride
Definition: packageeditorstate_addpads.cpp:81
The FootprintPadGraphicsItem class.
Definition: footprintpadgraphicsitem.h:54
void heightSpinBoxValueChanged(double value) noexcept
Definition: packageeditorstate_addpads.cpp:335
The PackageEditorState_AddPadsSmt class.
Definition: packageeditorstate_addpads.h:148
void drillDiameterSpinBoxValueChanged(double value) noexcept
Definition: packageeditorstate_addpads.cpp:345
~PackageEditorState_AddPadsSmt() noexcept
Definition: packageeditorstate_addpads.h:158
bool startAddPad(const Point &pos) noexcept
Definition: packageeditorstate_addpads.cpp:238
void widthSpinBoxValueChanged(double value) noexcept
Definition: packageeditorstate_addpads.cpp:325
virtual bool processRotateCcw() noexceptoverride
Definition: packageeditorstate_addpads.cpp:225
PackageEditorState_AddPads & operator=(const PackageEditorState_AddPads &rhs)=delete
The PackagePad class represents one logical pad of a package.
Definition: packagepad.h:51
PackageEditorFsm::Context Context
Definition: packageeditorstate.h:56
QScopedPointer< CmdFootprintPadEdit > mEditCmd
Definition: packageeditorstate_addpads.h:102