LibrePCB Developers Documentation
cmddragselectedsymbolitems.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_CMDDRAGSELECTEDSYMBOLITEMS_H
21 #define LIBREPCB_EDITOR_CMDDRAGSELECTEDSYMBOLITEMS_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
26 #include "../../undocommandgroup.h"
27 #include "../sym/fsm/symboleditorstate.h"
28 
31 
32 #include <QtCore>
33 
34 /*******************************************************************************
35  * Namespace / Forward Declarations
36  ******************************************************************************/
37 namespace librepcb {
38 namespace editor {
39 
40 class CmdCircleEdit;
41 class CmdPolygonEdit;
42 class CmdSymbolPinEdit;
43 class CmdTextEdit;
44 
45 /*******************************************************************************
46  * Class CmdDragSelectedSymbolItems
47  ******************************************************************************/
48 
53 public:
54  // Constructors / Destructor
55  CmdDragSelectedSymbolItems() = delete;
58  const SymbolEditorState::Context& context) noexcept;
59  ~CmdDragSelectedSymbolItems() noexcept;
60 
61  // Getters
62  int getSelectedItemsCount() const noexcept;
63  bool hasOffTheGridElements() const noexcept { return mHasOffTheGridElements; }
64 
65  // General Methods
66  void snapToGrid() noexcept;
67  void setDeltaToStartPos(const Point& delta) noexcept;
68  void translate(const Point& deltaPos) noexcept;
69  void rotate(const Angle& angle) noexcept;
70  void mirror(Qt::Orientation orientation) noexcept;
71 
72  // Operator Overloadings
74  delete;
75 
76 private:
77  // Private Methods
78 
80  bool performExecute() override;
81 
82  void deleteAllCommands() noexcept;
83 
84  // Private Member Variables
89  bool mMirrored;
92 
93  // Move commands
94  QList<CmdSymbolPinEdit*> mPinEditCmds;
95  QList<CmdCircleEdit*> mCircleEditCmds;
96  QList<CmdPolygonEdit*> mPolygonEditCmds;
97  QList<CmdTextEdit*> mTextEditCmds;
98 };
99 
100 /*******************************************************************************
101  * End of File
102  ******************************************************************************/
103 
104 } // namespace editor
105 } // namespace librepcb
106 
107 #endif
bool mSnappedToGrid
Definition: cmddragselectedsymbolitems.h:90
bool performExecute() override
Execute the command the first time.
Definition: cmddragselectedsymbolitems.cpp:213
QList< CmdPolygonEdit * > mPolygonEditCmds
Definition: cmddragselectedsymbolitems.h:96
The UndoCommandGroup class makes it possible to pack multiple undo commands together (it acts as a pa...
Definition: undocommandgroup.h:44
void snapToGrid() noexcept
Definition: cmddragselectedsymbolitems.cpp:136
Definition: occmodel.cpp:77
QList< CmdCircleEdit * > mCircleEditCmds
Definition: cmddragselectedsymbolitems.h:95
The Angle class is used to represent an angle (for example 12.75 degrees)
Definition: angle.h:78
void rotate(const Angle &angle) noexcept
Definition: cmddragselectedsymbolitems.cpp:177
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5...
Definition: point.h:79
Point mCenterPos
Definition: cmddragselectedsymbolitems.h:86
const SymbolEditorState::Context & mContext
Definition: cmddragselectedsymbolitems.h:85
bool mMirrored
Definition: cmddragselectedsymbolitems.h:89
int getSelectedItemsCount() const noexcept
Definition: cmddragselectedsymbolitems.cpp:127
Point mDeltaPos
Definition: cmddragselectedsymbolitems.h:87
QList< CmdSymbolPinEdit * > mPinEditCmds
Definition: cmddragselectedsymbolitems.h:94
void translate(const Point &deltaPos) noexcept
Definition: cmddragselectedsymbolitems.cpp:158
bool hasOffTheGridElements() const noexcept
Definition: cmddragselectedsymbolitems.h:63
Definition: symboleditorfsm.h:76
~CmdDragSelectedSymbolItems() noexcept
Definition: cmddragselectedsymbolitems.cpp:119
void setDeltaToStartPos(const Point &delta) noexcept
Definition: cmddragselectedsymbolitems.cpp:153
QList< CmdTextEdit * > mTextEditCmds
Definition: cmddragselectedsymbolitems.h:97
The CmdDragSelectedSymbolItems class.
Definition: cmddragselectedsymbolitems.h:52
Angle mDeltaRot
Definition: cmddragselectedsymbolitems.h:88
void mirror(Qt::Orientation orientation) noexcept
Definition: cmddragselectedsymbolitems.cpp:193
bool mHasOffTheGridElements
Definition: cmddragselectedsymbolitems.h:91
void deleteAllCommands() noexcept
Definition: cmddragselectedsymbolitems.cpp:243
CmdDragSelectedSymbolItems & operator=(const CmdDragSelectedSymbolItems &rhs)=delete