LibrePCB Developers Documentation
packageeditorstate_renumberpads.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_RENUMBERPADS_H
21#define LIBREPCB_EDITOR_PACKAGEEDITORSTATE_RENUMBERPADS_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "packageeditorstate.h"
27
28#include <QtCore>
29#include <QtWidgets>
30
31#include <memory>
32
33/*******************************************************************************
34 * Namespace / Forward Declarations
35 ******************************************************************************/
36namespace librepcb {
37
38class PackagePad;
39
40namespace editor {
41
42class FootprintPadGraphicsItem;
43
44/*******************************************************************************
45 * Class PackageEditorState_ReNumberPads
46 ******************************************************************************/
47
52 Q_OBJECT
53
54public:
55 // Constructors / Destructor
58 const PackageEditorState_ReNumberPads& other) = delete;
59 explicit PackageEditorState_ReNumberPads(Context& context) noexcept;
61
62 // General Methods
63 bool entry() noexcept override;
64 bool exit() noexcept override;
66 const noexcept override;
67
68 // Event Handlers
69 bool processKeyPressed(const QKeyEvent& e) noexcept override;
70 bool processKeyReleased(const QKeyEvent& e) noexcept override;
72 QGraphicsSceneMouseEvent& e) noexcept override;
74 QGraphicsSceneMouseEvent& e) noexcept override;
75
76 // Operator Overloadings
78 const PackageEditorState_ReNumberPads& rhs) = delete;
79
80private: // Methods
81 bool start() noexcept;
82 void updateCurrentPad(bool force = false) noexcept;
83 bool commitCurrentPad() noexcept;
84 void finish() noexcept;
85 int findIndexOfPad(const Uuid& uuid) const noexcept;
86
87private: // Data
90
91 QVector<std::shared_ptr<PackagePad>> mPackagePads;
92
95 QScopedPointer<UndoCommandGroup> mTmpCmd;
96
98 Qt::KeyboardModifiers mCurrentModifiers;
99};
100
101/*******************************************************************************
102 * End of File
103 ******************************************************************************/
104
105} // namespace editor
106} // namespace librepcb
107
108#endif
The PackagePad class represents one logical pad of a package.
Definition: packagepad.h:47
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 EditorWidgetBase class.
Definition: editorwidgetbase.h:62
The FootprintPadGraphicsItem class.
Definition: footprintpadgraphicsitem.h:50
The PackageEditorState_ReNumberPads class.
Definition: packageeditorstate_renumberpads.h:51
bool processGraphicsSceneMouseMoved(QGraphicsSceneMouseEvent &e) noexcept override
Definition: packageeditorstate_renumberpads.cpp:148
void finish() noexcept
Definition: packageeditorstate_renumberpads.cpp:356
void updateCurrentPad(bool force=false) noexcept
Definition: packageeditorstate_renumberpads.cpp:222
int findIndexOfPad(const Uuid &uuid) const noexcept
Definition: packageeditorstate_renumberpads.cpp:368
~PackageEditorState_ReNumberPads() noexcept
Definition: packageeditorstate_renumberpads.cpp:58
std::shared_ptr< FootprintPadGraphicsItem > mCurrentPad
Definition: packageeditorstate_renumberpads.h:94
bool processKeyPressed(const QKeyEvent &e) noexcept override
Definition: packageeditorstate_renumberpads.cpp:129
Qt::KeyboardModifiers mCurrentModifiers
Definition: packageeditorstate_renumberpads.h:98
bool mUndoCmdActive
Definition: packageeditorstate_renumberpads.h:88
Point mCurrentPos
Definition: packageeditorstate_renumberpads.h:97
PackageEditorState_ReNumberPads(const PackageEditorState_ReNumberPads &other)=delete
QScopedPointer< UndoCommandGroup > mTmpCmd
Definition: packageeditorstate_renumberpads.h:95
bool start() noexcept
Definition: packageeditorstate_renumberpads.cpp:179
int mAssignedFootprintPadCount
Definition: packageeditorstate_renumberpads.h:89
bool exit() noexcept override
Definition: packageeditorstate_renumberpads.cpp:93
bool commitCurrentPad() noexcept
Definition: packageeditorstate_renumberpads.cpp:339
std::shared_ptr< FootprintPadGraphicsItem > mPreviousPad
Definition: packageeditorstate_renumberpads.h:93
QSet< EditorWidgetBase::Feature > getAvailableFeatures() const noexcept override
Definition: packageeditorstate_renumberpads.cpp:119
bool processKeyReleased(const QKeyEvent &e) noexcept override
Definition: packageeditorstate_renumberpads.cpp:143
bool processGraphicsSceneLeftMouseButtonPressed(QGraphicsSceneMouseEvent &e) noexcept override
Definition: packageeditorstate_renumberpads.cpp:158
QVector< std::shared_ptr< PackagePad > > mPackagePads
Definition: packageeditorstate_renumberpads.h:91
bool entry() noexcept override
Definition: packageeditorstate_renumberpads.cpp:65
The PackageEditorState class is the base class of all package editor FSM states.
Definition: packageeditorstate.h:52
The UndoCommandGroup class makes it possible to pack multiple undo commands together (it acts as a pa...
Definition: undocommandgroup.h:44
Definition: occmodel.cpp:77
Definition: packageeditorfsm.h:90