LibrePCB Developers Documentation
Loading...
Searching...
No Matches
cmddragselectedboarditems.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_CMDDRAGSELECTEDBOARDITEMS_H
21#define LIBREPCB_EDITOR_CMDDRAGSELECTEDBOARDITEMS_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "../../undocommandgroup.h"
27
30
31#include <QtCore>
32
33/*******************************************************************************
34 * Namespace / Forward Declarations
35 ******************************************************************************/
36namespace librepcb {
37namespace editor {
38
39class BoardGraphicsScene;
40class CmdBoardHoleEdit;
41class CmdBoardNetLineEdit;
42class CmdBoardNetPointEdit;
43class CmdBoardPlaneEdit;
44class CmdBoardPolygonEdit;
45class CmdBoardStrokeTextEdit;
46class CmdBoardViaEdit;
47class CmdBoardZoneEdit;
48class CmdDeviceInstanceEdit;
49class CmdDeviceStrokeTextsReset;
50
51/*******************************************************************************
52 * Class CmdDragSelectedBoardItems
53 ******************************************************************************/
54
59public:
60 // Constructors / Destructor
62 bool includeLockedItems,
63 bool includeNetLines = false,
64 const Point& startPos = Point()) noexcept;
66
67 // Getters
68 bool hasAnythingSelected() const noexcept { return mItemCount > 0; }
69 bool hasTracesSelected() const noexcept {
70 return !mNetLineEditCmds.isEmpty();
71 }
72 bool hasPolygonsSelected() const noexcept {
73 return !mPolygonEditCmds.isEmpty();
74 }
75 bool hasStrokeTextsSelected() const noexcept {
76 return !mStrokeTextEditCmds.isEmpty();
77 }
78 UnsignedLength getMedianLineWidth() const noexcept;
79
80 // General Methods
81 void snapToGrid() noexcept;
82 void setLocked(bool locked) noexcept;
83 void setLineWidth(const UnsignedLength& width) noexcept;
84 void resetAllTexts() noexcept;
85 void setCurrentPosition(const Point& pos,
86 const bool gridIncrement = true) noexcept;
87 void rotate(const Angle& angle, bool aroundCurrentPosition) noexcept;
88
89private:
90 // Private Methods
91
93 bool performExecute() override;
94
95 // Private Member Variables
106
107 // Move commands
118};
119
120/*******************************************************************************
121 * End of File
122 ******************************************************************************/
123
124} // namespace editor
125} // namespace librepcb
126
127#endif
The Angle class is used to represent an angle (for example 12.75 degrees)
Definition angle.h:76
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5....
Definition point.h:78
The BoardGraphicsScene class.
Definition boardgraphicsscene.h:77
The CmdBoardHoleEdit class.
Definition cmdboardholeedit.h:49
The CmdBoardNetLineEdit class.
Definition cmdboardnetlineedit.h:48
The CmdBoardNetPointEdit class.
Definition cmdboardnetpointedit.h:48
The CmdBoardPlaneEdit class.
Definition cmdboardplaneedit.h:50
The CmdBoardPolygonEdit class.
Definition cmdboardpolygonedit.h:49
The CmdBoardStrokeTextEdit class.
Definition cmdboardstroketextedit.h:48
The CmdBoardViaEdit class.
Definition cmdboardviaedit.h:49
The CmdBoardZoneEdit class.
Definition cmdboardzoneedit.h:49
The CmdDeviceInstanceEdit class.
Definition cmddeviceinstanceedit.h:53
The CmdDeviceStrokeTextsReset class.
Definition cmddevicestroketextsreset.h:46
The CmdDragSelectedBoardItems class.
Definition cmddragselectedboarditems.h:58
int mItemCount
Definition cmddragselectedboarditems.h:97
Point mDeltaPos
Definition cmddragselectedboarditems.h:99
QList< CmdBoardStrokeTextEdit * > mStrokeTextEditCmds
Definition cmddragselectedboarditems.h:116
QList< CmdBoardPlaneEdit * > mPlaneEditCmds
Definition cmddragselectedboarditems.h:113
bool hasPolygonsSelected() const noexcept
Definition cmddragselectedboarditems.h:72
bool hasStrokeTextsSelected() const noexcept
Definition cmddragselectedboarditems.h:75
BoardGraphicsScene & mScene
Definition cmddragselectedboarditems.h:96
Angle mDeltaAngle
Definition cmddragselectedboarditems.h:101
QList< CmdBoardHoleEdit * > mHoleEditCmds
Definition cmddragselectedboarditems.h:117
QList< CmdBoardNetPointEdit * > mNetPointEditCmds
Definition cmddragselectedboarditems.h:111
UnsignedLength getMedianLineWidth() const noexcept
Definition cmddragselectedboarditems.cpp:183
bool mTextsReset
Definition cmddragselectedboarditems.h:105
~CmdDragSelectedBoardItems() noexcept
Definition cmddragselectedboarditems.cpp:176
void resetAllTexts() noexcept
Definition cmddragselectedboarditems.cpp:273
QList< CmdBoardViaEdit * > mViaEditCmds
Definition cmddragselectedboarditems.h:110
bool mSnappedToGrid
Definition cmddragselectedboarditems.h:102
void snapToGrid() noexcept
Definition cmddragselectedboarditems.cpp:202
bool hasAnythingSelected() const noexcept
Definition cmddragselectedboarditems.h:68
QList< CmdBoardPolygonEdit * > mPolygonEditCmds
Definition cmddragselectedboarditems.h:115
bool hasTracesSelected() const noexcept
Definition cmddragselectedboarditems.h:69
void setLineWidth(const UnsignedLength &width) noexcept
Definition cmddragselectedboarditems.cpp:257
void setCurrentPosition(const Point &pos, const bool gridIncrement=true) noexcept
Definition cmddragselectedboarditems.cpp:277
QList< CmdBoardZoneEdit * > mZoneEditCmds
Definition cmddragselectedboarditems.h:114
Point mStartPos
Definition cmddragselectedboarditems.h:98
bool performExecute() override
Execute the command the first time.
Definition cmddragselectedboarditems.cpp:361
bool mLockedChanged
Definition cmddragselectedboarditems.h:103
bool mLineWidthChanged
Definition cmddragselectedboarditems.h:104
void setLocked(bool locked) noexcept
Definition cmddragselectedboarditems.cpp:235
QList< CmdDeviceInstanceEdit * > mDeviceEditCmds
Definition cmddragselectedboarditems.h:108
void rotate(const Angle &angle, bool aroundCurrentPosition) noexcept
Definition cmddragselectedboarditems.cpp:318
QList< CmdDeviceStrokeTextsReset * > mDeviceStrokeTextsResetCmds
Definition cmddragselectedboarditems.h:109
QList< CmdBoardNetLineEdit * > mNetLineEditCmds
Definition cmddragselectedboarditems.h:112
Point mCenterPos
Definition cmddragselectedboarditems.h:100
The UndoCommandGroup class makes it possible to pack multiple undo commands together (it acts as a pa...
Definition undocommandgroup.h:44
Definition occmodel.cpp:76
type_safe::constrained_type< Length, UnsignedLengthConstraint, UnsignedLengthVerifier > UnsignedLength
Definition length.h:694