LibrePCB Developers Documentation
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_EDITOR_PACKAGEEDITORSTATE_ADDPADS_H
21#define LIBREPCB_EDITOR_PACKAGEEDITORSTATE_ADDPADS_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "packageeditorstate.h"
27
29
30#include <QtCore>
31#include <QtWidgets>
32
33#include <memory>
34
35/*******************************************************************************
36 * Namespace / Forward Declarations
37 ******************************************************************************/
38namespace librepcb {
39
40class PackagePad;
41
42namespace editor {
43
44class CmdFootprintPadEdit;
45class FootprintPadGraphicsItem;
46class PackagePadComboBox;
47
48/*******************************************************************************
49 * Class PackageEditorState_AddPads
50 ******************************************************************************/
51
56 Q_OBJECT
57
58public:
59 // Types
60 enum class PadType { THT, SMT };
61
62 // Constructors / Destructor
65 explicit PackageEditorState_AddPads(Context& context, PadType type,
66 FootprintPad::Function function) noexcept;
67 virtual ~PackageEditorState_AddPads() noexcept;
68
69 // General Methods
70 virtual bool entry() noexcept override;
71 virtual bool exit() noexcept override;
73 const noexcept override;
74
75 // Event Handlers
77 QGraphicsSceneMouseEvent& e) noexcept override;
79 QGraphicsSceneMouseEvent& e) noexcept override;
81 QGraphicsSceneMouseEvent& e) noexcept override;
82 virtual bool processRotate(const Angle& rotation) noexcept override;
83
84 // Operator Overloadings
86 delete;
87
88private: // Methods
89 bool startAddPad(const Point& pos) noexcept;
90 bool finishAddPad(const Point& pos) noexcept;
91 bool abortAddPad() noexcept;
92 void selectNextFreePadInComboBox() noexcept;
93 void packagePadComboBoxCurrentPadChanged(tl::optional<Uuid> pad) noexcept;
95 FootprintPad::ComponentSide side) noexcept;
97 const UnsignedLimitedRatio& radius,
98 bool customRadius) noexcept;
99 void widthEditValueChanged(const PositiveLength& value) noexcept;
100 void heightEditValueChanged(const PositiveLength& value) noexcept;
101 void drillDiameterEditValueChanged(const PositiveLength& value) noexcept;
102 void fiducialClearanceEditValueChanged(const UnsignedLength& value) noexcept;
103 void radiusEditValueChanged(const UnsignedLimitedRatio& value) noexcept;
104 void pressFitCheckedChanged(bool value) noexcept;
105 void applyRecommendedRoundedRectRadius() noexcept;
106
107signals:
108 void requestRadiusInputEnabled(bool enabled);
110
111private: // Types / Data
114 std::shared_ptr<FootprintPad> mCurrentPad;
117
118 // parameter memory
120};
121
122/*******************************************************************************
123 * End of File
124 ******************************************************************************/
125
126} // namespace editor
127} // namespace librepcb
128
129#endif
The Angle class is used to represent an angle (for example 12.75 degrees)
Definition: angle.h:78
The FootprintPad class represents a pad of a footprint.
Definition: footprintpad.h:55
Function
Definition: footprintpad.h:71
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5....
Definition: point.h:79
The Uuid class is a replacement for QUuid to get UUID strings without {} braces.
Definition: uuid.h:58
The CmdFootprintPadEdit class.
Definition: cmdfootprintpadedit.h:48
The EditorWidgetBase class.
Definition: editorwidgetbase.h:62
The FootprintPadGraphicsItem class.
Definition: footprintpadgraphicsitem.h:50
The PackageEditorState_AddPads class.
Definition: packageeditorstate_addpads.h:55
virtual bool processGraphicsSceneMouseMoved(QGraphicsSceneMouseEvent &e) noexcept override
Definition: packageeditorstate_addpads.cpp:386
PadType mPadType
Definition: packageeditorstate_addpads.h:112
std::shared_ptr< FootprintPad > mCurrentPad
Definition: packageeditorstate_addpads.h:114
PadType
Definition: packageeditorstate_addpads.h:60
void selectNextFreePadInComboBox() noexcept
Definition: packageeditorstate_addpads.cpp:491
bool finishAddPad(const Point &pos) noexcept
Definition: packageeditorstate_addpads.cpp:459
void boardSideSelectorCurrentSideChanged(FootprintPad::ComponentSide side) noexcept
Definition: packageeditorstate_addpads.cpp:518
void heightEditValueChanged(const PositiveLength &value) noexcept
Definition: packageeditorstate_addpads.cpp:547
void widthEditValueChanged(const PositiveLength &value) noexcept
Definition: packageeditorstate_addpads.cpp:538
std::shared_ptr< FootprintPadGraphicsItem > mCurrentGraphicsItem
Definition: packageeditorstate_addpads.h:115
void drillDiameterEditValueChanged(const PositiveLength &value) noexcept
Definition: packageeditorstate_addpads.cpp:556
void requestRadius(const UnsignedLimitedRatio &radius)
void fiducialClearanceEditValueChanged(const UnsignedLength &value) noexcept
Definition: packageeditorstate_addpads.cpp:566
bool abortAddPad() noexcept
Definition: packageeditorstate_addpads.cpp:476
void shapeSelectorCurrentShapeChanged(FootprintPad::Shape shape, const UnsignedLimitedRatio &radius, bool customRadius) noexcept
Definition: packageeditorstate_addpads.cpp:526
virtual bool processRotate(const Angle &rotation) noexcept override
Definition: packageeditorstate_addpads.cpp:414
FootprintPad mLastPad
Definition: packageeditorstate_addpads.h:119
bool startAddPad(const Point &pos) noexcept
Definition: packageeditorstate_addpads.cpp:427
void radiusEditValueChanged(const UnsignedLimitedRatio &value) noexcept
Definition: packageeditorstate_addpads.cpp:574
virtual bool exit() noexcept override
Definition: packageeditorstate_addpads.cpp:361
PackageEditorState_AddPads(const PackageEditorState_AddPads &other)=delete
void pressFitCheckedChanged(bool value) noexcept
Definition: packageeditorstate_addpads.cpp:582
QScopedPointer< CmdFootprintPadEdit > mEditCmd
Definition: packageeditorstate_addpads.h:113
void applyRecommendedRoundedRectRadius() noexcept
Definition: packageeditorstate_addpads.cpp:590
virtual bool processGraphicsSceneRightMouseButtonReleased(QGraphicsSceneMouseEvent &e) noexcept override
Definition: packageeditorstate_addpads.cpp:408
PackagePadComboBox * mPackagePadComboBox
Definition: packageeditorstate_addpads.h:116
QSet< EditorWidgetBase::Feature > getAvailableFeatures() const noexcept override
Definition: packageeditorstate_addpads.cpp:375
virtual ~PackageEditorState_AddPads() noexcept
Definition: packageeditorstate_addpads.cpp:120
virtual bool processGraphicsSceneLeftMouseButtonPressed(QGraphicsSceneMouseEvent &e) noexcept override
Definition: packageeditorstate_addpads.cpp:398
virtual bool entry() noexcept override
Definition: packageeditorstate_addpads.cpp:128
void packagePadComboBoxCurrentPadChanged(tl::optional< Uuid > pad) noexcept
Definition: packageeditorstate_addpads.cpp:510
The PackageEditorState class is the base class of all package editor FSM states.
Definition: packageeditorstate.h:52
The PackagePadComboBox class.
Definition: packagepadcombobox.h:44
Definition: occmodel.cpp:77
type_safe::constrained_type< Length, PositiveLengthConstraint, PositiveLengthVerifier > PositiveLength
Definition: length.h:812
type_safe::constrained_type< Length, UnsignedLengthConstraint, UnsignedLengthVerifier > UnsignedLength
Definition: length.h:696
type_safe::constrained_type< Ratio, UnsignedLimitedRatioConstraint, UnsignedLimitedRatioVerifier > UnsignedLimitedRatio
Definition: ratio.h:378
Definition: uuid.h:183
Definition: packageeditorfsm.h:89