LibrePCB Developers Documentation
Loading...
Searching...
No Matches
cmdimageedit.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_CMDIMAGEEDIT_H
21#define LIBREPCB_EDITOR_CMDIMAGEEDIT_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "../undocommand.h"
27
29
30#include <QtCore>
31
32/*******************************************************************************
33 * Namespace / Forward Declarations
34 ******************************************************************************/
35namespace librepcb {
36namespace editor {
37
38/*******************************************************************************
39 * Class CmdImageEdit
40 ******************************************************************************/
41
45class CmdImageEdit final : public UndoCommand {
46public:
47 // Constructors / Destructor
48 CmdImageEdit() = delete;
49 CmdImageEdit(const CmdImageEdit& other) = delete;
50 explicit CmdImageEdit(Image& image) noexcept;
51 ~CmdImageEdit() noexcept;
52
53 // Setters
54 void setFileName(const FileProofName& name, bool immediate) noexcept;
55 void setPosition(const Point& pos, bool immediate) noexcept;
56 void translate(const Point& deltaPos, bool immediate) noexcept;
57 void snapToGrid(const PositiveLength& gridInterval, bool immediate) noexcept;
58 void setRotation(const Angle& angle, bool immediate) noexcept;
59 void rotate(const Angle& angle, const Point& center, bool immediate) noexcept;
60 void mirror(Qt::Orientation orientation, const Point& center,
61 bool immediate) noexcept;
62 void mirror(const Angle& rotation, const Point& center,
63 bool immediate) noexcept;
64 void setWidth(const PositiveLength& width, bool immediate) noexcept;
65 void setHeight(const PositiveLength& height, bool immediate) noexcept;
66 void setBorderWidth(const std::optional<UnsignedLength>& width,
67 bool immediate) noexcept;
68
69 // Operator Overloadings
70 CmdImageEdit& operator=(const CmdImageEdit& rhs) = delete;
71
72private: // Methods
74 bool performExecute() override;
75
77 void performUndo() override;
78
80 void performRedo() override;
81
82private: // Data
84
85 // General Attributes
98};
99
100/*******************************************************************************
101 * End of File
102 ******************************************************************************/
103
104} // namespace editor
105} // namespace librepcb
106
107#endif
The Angle class is used to represent an angle (for example 12.75 degrees)
Definition angle.h:76
The Image class.
Definition image.h:49
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5....
Definition point.h:78
The CmdImageEdit class.
Definition cmdimageedit.h:45
void performRedo() override
Redo the command.
Definition cmdimageedit.cpp:168
void setWidth(const PositiveLength &width, bool immediate) noexcept
Definition cmdimageedit.cpp:122
void setHeight(const PositiveLength &height, bool immediate) noexcept
Definition cmdimageedit.cpp:129
void setPosition(const Point &pos, bool immediate) noexcept
Definition cmdimageedit.cpp:71
void translate(const Point &deltaPos, bool immediate) noexcept
Definition cmdimageedit.cpp:77
Point mOldPosition
Definition cmdimageedit.h:88
void setBorderWidth(const std::optional< UnsignedLength > &width, bool immediate) noexcept
Definition cmdimageedit.cpp:136
Image & mImage
Definition cmdimageedit.h:83
FileProofName mNewFileName
Definition cmdimageedit.h:87
Angle mNewRotation
Definition cmdimageedit.h:91
~CmdImageEdit() noexcept
Definition cmdimageedit.cpp:54
void performUndo() override
Undo the command.
Definition cmdimageedit.cpp:159
PositiveLength mNewHeight
Definition cmdimageedit.h:95
PositiveLength mNewWidth
Definition cmdimageedit.h:93
PositiveLength mOldHeight
Definition cmdimageedit.h:94
void snapToGrid(const PositiveLength &gridInterval, bool immediate) noexcept
Definition cmdimageedit.cpp:83
PositiveLength mOldWidth
Definition cmdimageedit.h:92
FileProofName mOldFileName
Definition cmdimageedit.h:86
Point mNewPosition
Definition cmdimageedit.h:89
void mirror(Qt::Orientation orientation, const Point &center, bool immediate) noexcept
Definition cmdimageedit.cpp:100
void setFileName(const FileProofName &name, bool immediate) noexcept
Definition cmdimageedit.cpp:64
bool performExecute() override
Execute the command the first time.
Definition cmdimageedit.cpp:147
CmdImageEdit(const CmdImageEdit &other)=delete
std::optional< UnsignedLength > mOldBorderWidth
Definition cmdimageedit.h:96
void rotate(const Angle &angle, const Point &center, bool immediate) noexcept
Definition cmdimageedit.cpp:94
Angle mOldRotation
Definition cmdimageedit.h:90
std::optional< UnsignedLength > mNewBorderWidth
Definition cmdimageedit.h:97
void setRotation(const Angle &angle, bool immediate) noexcept
Definition cmdimageedit.cpp:88
The UndoCommand class represents a command which you can undo/redo.
Definition undocommand.h:46
Definition occmodel.cpp:77
type_safe::constrained_type< Length, PositiveLengthConstraint, PositiveLengthVerifier > PositiveLength
Definition length.h:810
type_safe::constrained_type< Length, UnsignedLengthConstraint, UnsignedLengthVerifier > UnsignedLength
Definition length.h:694
type_safe::constrained_type< QString, FileProofNameConstraint, FileProofNameVerifier > FileProofName
Definition fileproofname.h:90
Definition uuid.h:186