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 
54  Q_OBJECT
55 
56 public:
57  // Types
58  enum class PadType { THT, SMT };
59 
60  // Constructors / Destructor
61  PackageEditorState_AddPads() = delete;
63  explicit PackageEditorState_AddPads(Context& context, PadType type) noexcept;
64  virtual ~PackageEditorState_AddPads() noexcept;
65 
66  // General Methods
67  virtual bool entry() noexcept override;
68  virtual bool exit() noexcept override;
69 
70  // Event Handlers
71  virtual bool processGraphicsSceneMouseMoved(
72  QGraphicsSceneMouseEvent& e) noexcept override;
74  QGraphicsSceneMouseEvent& e) noexcept override;
76  QGraphicsSceneMouseEvent& e) noexcept override;
77  virtual bool processRotateCw() noexcept override;
78  virtual bool processRotateCcw() noexcept override;
79 
80  // Operator Overloadings
82  delete;
83 
84 private: // Methods
85  bool startAddPad(const Point& pos) noexcept;
86  bool finishAddPad(const Point& pos) noexcept;
87  bool abortAddPad() noexcept;
90  FootprintPad::BoardSide side) noexcept;
91  void shapeSelectorCurrentShapeChanged(FootprintPad::Shape shape) noexcept;
92  void widthEditValueChanged(const PositiveLength& value) noexcept;
93  void heightEditValueChanged(const PositiveLength& value) noexcept;
94  void drillDiameterEditValueChanged(const UnsignedLength& value) noexcept;
95 
96 private: // Types / Data
99  QScopedPointer<CmdFootprintPadEdit> mEditCmd;
100  std::shared_ptr<FootprintPad> mCurrentPad;
103 
104  // parameter memory
106 };
107 
108 /*******************************************************************************
109  * Class PackageEditorState_AddPadsTht
110  ******************************************************************************/
111 
116  Q_OBJECT
117 
118 public:
119  // Constructors / Destructor
122  delete;
123  explicit PackageEditorState_AddPadsTht(Context& context) noexcept
126 
127  // Operator Overloadings
129  const PackageEditorState_AddPadsTht& rhs) = delete;
130 };
131 
132 /*******************************************************************************
133  * Class PackageEditorState_AddPadsSmt
134  ******************************************************************************/
135 
140  Q_OBJECT
141 
142 public:
143  // Constructors / Destructor
146  delete;
147  explicit PackageEditorState_AddPadsSmt(Context& context) noexcept
150 
151  // Operator Overloadings
153  const PackageEditorState_AddPadsSmt& rhs) = delete;
154 };
155 
156 /*******************************************************************************
157  * End of File
158  ******************************************************************************/
159 
160 } // namespace editor
161 } // namespace library
162 } // namespace librepcb
163 
164 #endif // LIBREPCB_LIBRARY_EDITOR_PACKAGEEDITORSTATE_ADDPADS_H
PadType
Definition: packageeditorstate_addpads.h:58
void widthEditValueChanged(const PositiveLength &value) noexcept
Definition: packageeditorstate_addpads.cpp:315
void drillDiameterEditValueChanged(const UnsignedLength &value) noexcept
Definition: packageeditorstate_addpads.cpp:331
Point mStartPos
Definition: packageeditorstate_addpads.h:98
The PackageEditorState_AddPads class.
Definition: packageeditorstate_addpads.h:53
FootprintPadGraphicsItem * mCurrentGraphicsItem
Definition: packageeditorstate_addpads.h:101
virtual bool processGraphicsSceneRightMouseButtonReleased(QGraphicsSceneMouseEvent &e) noexceptoverride
Definition: packageeditorstate_addpads.cpp:200
~PackageEditorState_AddPadsTht() noexcept
Definition: packageeditorstate_addpads.h:125
The CmdFootprintPadEdit class.
Definition: cmdfootprintpadedit.h:45
bool abortAddPad() noexcept
Definition: packageeditorstate_addpads.cpp:274
void boardSideSelectorCurrentSideChanged(FootprintPad::BoardSide side) noexcept
Definition: packageeditorstate_addpads.cpp:299
PackagePadComboBox * mPackagePadComboBox
Definition: packageeditorstate_addpads.h:102
PackageEditorState_AddPadsTht(Context &context) noexcept
Definition: packageeditorstate_addpads.h:123
PackageEditorState_AddPadsSmt(Context &context) noexcept
Definition: packageeditorstate_addpads.h:147
virtual bool processRotateCw() noexceptoverride
Definition: packageeditorstate_addpads.cpp:206
virtual ~PackageEditorState_AddPads() noexcept
Definition: packageeditorstate_addpads.cpp:76
virtual bool exit() noexceptoverride
Definition: packageeditorstate_addpads.cpp:161
The PackagePadComboBox class.
Definition: packagepadcombobox.h:45
void packagePadComboBoxCurrentPadChanged(PackagePad *pad) noexcept
Definition: packageeditorstate_addpads.cpp:289
virtual bool processGraphicsSceneMouseMoved(QGraphicsSceneMouseEvent &e) noexceptoverride
Definition: packageeditorstate_addpads.cpp:178
std::shared_ptr< FootprintPad > mCurrentPad
Definition: packageeditorstate_addpads.h:100
virtual bool processGraphicsSceneLeftMouseButtonPressed(QGraphicsSceneMouseEvent &e) noexceptoverride
Definition: packageeditorstate_addpads.cpp:190
void shapeSelectorCurrentShapeChanged(FootprintPad::Shape shape) noexcept
Definition: packageeditorstate_addpads.cpp:307
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5...
Definition: point.h:78
PadType mPadType
Definition: packageeditorstate_addpads.h:97
The PackageEditorState class is the base class of all package editor FSM states.
Definition: packageeditorstate.h:49
bool finishAddPad(const Point &pos) noexcept
Definition: packageeditorstate_addpads.cpp:253
FootprintPad mLastPad
Definition: packageeditorstate_addpads.h:105
The FootprintPad class represents a pad of a footprint.
Definition: footprintpad.h:52
The PackageEditorState_AddPadsTht class.
Definition: packageeditorstate_addpads.h:115
virtual bool entry() noexceptoverride
Definition: packageeditorstate_addpads.cpp:86
The FootprintPadGraphicsItem class.
Definition: footprintpadgraphicsitem.h:51
The PackageEditorState_AddPadsSmt class.
Definition: packageeditorstate_addpads.h:139
type_safe::constrained_type< Length, PositiveLengthConstraint, PositiveLengthVerifier > PositiveLength
Definition: length.h:780
~PackageEditorState_AddPadsSmt() noexcept
Definition: packageeditorstate_addpads.h:149
bool startAddPad(const Point &pos) noexcept
Definition: packageeditorstate_addpads.cpp:228
virtual bool processRotateCcw() noexceptoverride
Definition: packageeditorstate_addpads.cpp:215
PackageEditorState_AddPads & operator=(const PackageEditorState_AddPads &rhs)=delete
The PackagePad class represents one logical pad of a package.
Definition: packagepad.h:51
void heightEditValueChanged(const PositiveLength &value) noexcept
Definition: packageeditorstate_addpads.cpp:323
PackageEditorFsm::Context Context
Definition: packageeditorstate.h:53
QScopedPointer< CmdFootprintPadEdit > mEditCmd
Definition: packageeditorstate_addpads.h:99
type_safe::constrained_type< Length, UnsignedLengthConstraint, UnsignedLengthVerifier > UnsignedLength
Definition: length.h:659