LibrePCB Developers Documentation
Loading...
Searching...
No Matches
cmddragselectedfootprintitems.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_CMDDRAGSELECTEDFOOTPRINTITEMS_H
21
#define LIBREPCB_EDITOR_CMDDRAGSELECTEDFOOTPRINTITEMS_H
22
23
/*******************************************************************************
24
* Includes
25
******************************************************************************/
26
#include "../../undocommandgroup.h"
27
#include "../pkg/fsm/packageeditorstate.h"
28
29
#include <
librepcb/core/types/angle.h
>
30
#include <
librepcb/core/types/point.h
>
31
32
#include <QtCore>
33
34
/*******************************************************************************
35
* Namespace / Forward Declarations
36
******************************************************************************/
37
namespace
librepcb
{
38
namespace
editor {
39
40
class
CmdCircleEdit;
41
class
CmdFootprintPadEdit;
42
class
CmdHoleEdit;
43
class
CmdPolygonEdit;
44
class
CmdStrokeTextEdit;
45
class
CmdZoneEdit;
46
47
/*******************************************************************************
48
* Class CmdDragSelectedFootprintItems
49
******************************************************************************/
50
54
class
CmdDragSelectedFootprintItems
final :
public
UndoCommandGroup
{
55
public
:
56
// Constructors / Destructor
57
CmdDragSelectedFootprintItems
() =
delete
;
58
CmdDragSelectedFootprintItems
(
const
CmdDragSelectedFootprintItems
& other) =
59
delete
;
60
explicit
CmdDragSelectedFootprintItems
(
61
const
PackageEditorState::Context
& context)
noexcept
;
62
~CmdDragSelectedFootprintItems
() noexcept;
63
64
// Getters
65
int
getSelectedItemsCount
() const noexcept;
66
bool
hasOffTheGridElements
() const noexcept {
return
mHasOffTheGridElements
; }
67
const
QList<Point>&
getPositions
() const noexcept {
return
mPositions
; }
68
69
// General Methods
70
void
snapToGrid
() noexcept;
71
void
setDeltaToStartPos
(const
Point
& delta) noexcept;
72
void
setNewPositions
(QList<
Point
> positions);
73
void
translate
(const
Point
& deltaPos) noexcept;
74
void
rotate
(const
Angle
& angle) noexcept;
75
void
mirrorGeometry
(Qt::Orientation orientation) noexcept;
76
void
mirrorLayer
() noexcept;
77
78
// Operator Overloadings
79
CmdDragSelectedFootprintItems
& operator=(
80
const
CmdDragSelectedFootprintItems
& rhs) = delete;
81
82
private:
83
// Private Methods
84
86
bool
performExecute
() override;
87
88
void
deleteAllCommands
() noexcept;
89
90
// Private Member Variables
91
const
PackageEditorState
::Context&
mContext
;
92
QList<
Point
>
mPositions
;
93
Point
mCenterPos
;
94
Point
mDeltaPos
;
95
Angle
mDeltaRot
;
96
bool
mMirroredGeometry
;
97
bool
mMirroredLayer
;
98
bool
mSnappedToGrid
;
99
bool
mNewPositionsSet
;
100
bool
mHasOffTheGridElements
;
101
102
// Move commands
103
QList<
CmdFootprintPadEdit
*>
mPadEditCmds
;
104
QList<
CmdCircleEdit
*>
mCircleEditCmds
;
105
QList<
CmdPolygonEdit
*>
mPolygonEditCmds
;
106
QList<
CmdStrokeTextEdit
*>
mTextEditCmds
;
107
QList<
CmdZoneEdit
*>
mZoneEditCmds
;
108
QList<
CmdHoleEdit
*>
mHoleEditCmds
;
109
};
110
111
/*******************************************************************************
112
* End of File
113
******************************************************************************/
114
115
}
// namespace editor
116
}
// namespace librepcb
117
118
#endif
angle.h
librepcb::Angle
The Angle class is used to represent an angle (for example 12.75 degrees)
Definition
angle.h:76
librepcb::Point
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5....
Definition
point.h:78
librepcb::editor::CmdCircleEdit
The CmdCircleEdit class.
Definition
cmdcircleedit.h:51
librepcb::editor::CmdDragSelectedFootprintItems
The CmdDragSelectedFootprintItems class.
Definition
cmddragselectedfootprintitems.h:54
librepcb::editor::CmdDragSelectedFootprintItems::mPositions
QList< Point > mPositions
Definition
cmddragselectedfootprintitems.h:92
librepcb::editor::CmdDragSelectedFootprintItems::mMirroredLayer
bool mMirroredLayer
Definition
cmddragselectedfootprintitems.h:97
librepcb::editor::CmdDragSelectedFootprintItems::mNewPositionsSet
bool mNewPositionsSet
Definition
cmddragselectedfootprintitems.h:99
librepcb::editor::CmdDragSelectedFootprintItems::mDeltaPos
Point mDeltaPos
Definition
cmddragselectedfootprintitems.h:94
librepcb::editor::CmdDragSelectedFootprintItems::mHasOffTheGridElements
bool mHasOffTheGridElements
Definition
cmddragselectedfootprintitems.h:100
librepcb::editor::CmdDragSelectedFootprintItems::translate
void translate(const Point &deltaPos) noexcept
Definition
cmddragselectedfootprintitems.cpp:232
librepcb::editor::CmdDragSelectedFootprintItems::mPadEditCmds
QList< CmdFootprintPadEdit * > mPadEditCmds
Definition
cmddragselectedfootprintitems.h:103
librepcb::editor::CmdDragSelectedFootprintItems::CmdDragSelectedFootprintItems
CmdDragSelectedFootprintItems()=delete
librepcb::editor::CmdDragSelectedFootprintItems::mirrorLayer
void mirrorLayer() noexcept
Definition
cmddragselectedfootprintitems.cpp:302
librepcb::editor::CmdDragSelectedFootprintItems::mZoneEditCmds
QList< CmdZoneEdit * > mZoneEditCmds
Definition
cmddragselectedfootprintitems.h:107
librepcb::editor::CmdDragSelectedFootprintItems::getPositions
const QList< Point > & getPositions() const noexcept
Definition
cmddragselectedfootprintitems.h:67
librepcb::editor::CmdDragSelectedFootprintItems::CmdDragSelectedFootprintItems
CmdDragSelectedFootprintItems(const CmdDragSelectedFootprintItems &other)=delete
librepcb::editor::CmdDragSelectedFootprintItems::mMirroredGeometry
bool mMirroredGeometry
Definition
cmddragselectedfootprintitems.h:96
librepcb::editor::CmdDragSelectedFootprintItems::~CmdDragSelectedFootprintItems
~CmdDragSelectedFootprintItems() noexcept
Definition
cmddragselectedfootprintitems.cpp:160
librepcb::editor::CmdDragSelectedFootprintItems::mDeltaRot
Angle mDeltaRot
Definition
cmddragselectedfootprintitems.h:95
librepcb::editor::CmdDragSelectedFootprintItems::mPolygonEditCmds
QList< CmdPolygonEdit * > mPolygonEditCmds
Definition
cmddragselectedfootprintitems.h:105
librepcb::editor::CmdDragSelectedFootprintItems::hasOffTheGridElements
bool hasOffTheGridElements() const noexcept
Definition
cmddragselectedfootprintitems.h:66
librepcb::editor::CmdDragSelectedFootprintItems::mTextEditCmds
QList< CmdStrokeTextEdit * > mTextEditCmds
Definition
cmddragselectedfootprintitems.h:106
librepcb::editor::CmdDragSelectedFootprintItems::mirrorGeometry
void mirrorGeometry(Qt::Orientation orientation) noexcept
Definition
cmddragselectedfootprintitems.cpp:279
librepcb::editor::CmdDragSelectedFootprintItems::mSnappedToGrid
bool mSnappedToGrid
Definition
cmddragselectedfootprintitems.h:98
librepcb::editor::CmdDragSelectedFootprintItems::getSelectedItemsCount
int getSelectedItemsCount() const noexcept
Definition
cmddragselectedfootprintitems.cpp:168
librepcb::editor::CmdDragSelectedFootprintItems::snapToGrid
void snapToGrid() noexcept
Definition
cmddragselectedfootprintitems.cpp:178
librepcb::editor::CmdDragSelectedFootprintItems::mHoleEditCmds
QList< CmdHoleEdit * > mHoleEditCmds
Definition
cmddragselectedfootprintitems.h:108
librepcb::editor::CmdDragSelectedFootprintItems::performExecute
bool performExecute() override
Execute the command the first time.
Definition
cmddragselectedfootprintitems.cpp:325
librepcb::editor::CmdDragSelectedFootprintItems::mCircleEditCmds
QList< CmdCircleEdit * > mCircleEditCmds
Definition
cmddragselectedfootprintitems.h:104
librepcb::editor::CmdDragSelectedFootprintItems::setNewPositions
void setNewPositions(QList< Point > positions)
Definition
cmddragselectedfootprintitems.cpp:206
librepcb::editor::CmdDragSelectedFootprintItems::rotate
void rotate(const Angle &angle) noexcept
Definition
cmddragselectedfootprintitems.cpp:257
librepcb::editor::CmdDragSelectedFootprintItems::setDeltaToStartPos
void setDeltaToStartPos(const Point &delta) noexcept
Definition
cmddragselectedfootprintitems.cpp:201
librepcb::editor::CmdDragSelectedFootprintItems::mCenterPos
Point mCenterPos
Definition
cmddragselectedfootprintitems.h:93
librepcb::editor::CmdDragSelectedFootprintItems::mContext
const PackageEditorState::Context & mContext
Definition
cmddragselectedfootprintitems.h:91
librepcb::editor::CmdDragSelectedFootprintItems::deleteAllCommands
void deleteAllCommands() noexcept
Definition
cmddragselectedfootprintitems.cpp:361
librepcb::editor::CmdFootprintPadEdit
The CmdFootprintPadEdit class.
Definition
cmdfootprintpadedit.h:48
librepcb::editor::CmdHoleEdit
The CmdHoleEdit class.
Definition
cmdholeedit.h:53
librepcb::editor::CmdPolygonEdit
The CmdPolygonEdit class.
Definition
cmdpolygonedit.h:51
librepcb::editor::CmdStrokeTextEdit
The CmdStrokeTextEdit class.
Definition
cmdstroketextedit.h:51
librepcb::editor::CmdZoneEdit
The CmdZoneEdit class.
Definition
cmdzoneedit.h:48
librepcb::editor::PackageEditorState
The PackageEditorState class is the base class of all package editor FSM states.
Definition
packageeditorstate.h:52
librepcb::editor::UndoCommandGroup
The UndoCommandGroup class makes it possible to pack multiple undo commands together (it acts as a pa...
Definition
undocommandgroup.h:44
librepcb
Definition
occmodel.cpp:76
point.h
librepcb::editor::PackageEditorFsm::Context
Definition
packageeditorfsm.h:90
libs
librepcb
editor
library
cmd
cmddragselectedfootprintitems.h
Generated on Wed Dec 18 2024 20:12:48 for LibrePCB Developers Documentation by
1.9.8