LibrePCB Developers Documentation
Loading...
Searching...
No Matches
schematiceditorstate_addimage.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_SCHEMATICEDITORSTATE_ADDIMAGE_H
21#define LIBREPCB_EDITOR_SCHEMATICEDITORSTATE_ADDIMAGE_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
27
29
30#include <QtCore>
31
32/*******************************************************************************
33 * Namespace / Forward Declarations
34 ******************************************************************************/
35namespace librepcb {
36
37class SI_Image;
38class Schematic;
39
40namespace editor {
41
42class CmdImageEdit;
43class ImageGraphicsItem;
44
45/*******************************************************************************
46 * Class SchematicEditorState_AddImage
47 ******************************************************************************/
48
53 Q_OBJECT
54
55public:
56 // Constructors / Destructor
59 delete;
60 explicit SchematicEditorState_AddImage(const Context& context) noexcept;
61 virtual ~SchematicEditorState_AddImage() noexcept;
62
63 // General Methods
64 virtual bool entry() noexcept override;
65 virtual bool exit() noexcept override;
66
67 // Event Handlers
68 virtual bool processAddImage(const QByteArray& data, const QString& format,
69 const QString& basename) noexcept override;
70 virtual bool processRotate(const Angle& rotation) noexcept override;
72 const GraphicsSceneMouseEvent& e) noexcept override;
74 const GraphicsSceneMouseEvent& e) noexcept override;
76 const GraphicsSceneMouseEvent& e) noexcept override;
77
78 // Operator Overloadings
80 const SchematicEditorState_AddImage& rhs) = delete;
81
82private: // Methods
83 bool start(const Point& pos, QByteArray data, QString format,
84 QString basename) noexcept;
85 void updateSize(const Point& pos) noexcept;
86 bool finish(const Point& pos) noexcept;
87 bool abort(bool showErrMsgBox) noexcept;
88
89private: // Data
90 enum class State { Positioning, Resizing };
91
92 // State
95
96 // Current tool settings
98
99 // Information about the current image to place
100 std::unique_ptr<CmdImageEdit> mCurrentEditCmd;
101 QPointer<SI_Image> mCurrentImage;
103 std::shared_ptr<ImageGraphicsItem> mCurrentGraphicsItem;
104};
105
106/*******************************************************************************
107 * End of File
108 ******************************************************************************/
109
110} // namespace editor
111} // namespace librepcb
112
113#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 SchematicEditorState_AddImage class.
Definition schematiceditorstate_addimage.h:52
virtual bool processGraphicsSceneMouseMoved(const GraphicsSceneMouseEvent &e) noexcept override
Definition schematiceditorstate_addimage.cpp:117
virtual ~SchematicEditorState_AddImage() noexcept
Definition schematiceditorstate_addimage.cpp:66
virtual bool processGraphicsSceneRightMouseButtonReleased(const GraphicsSceneMouseEvent &e) noexcept override
Definition schematiceditorstate_addimage.cpp:156
bool finish(const Point &pos) noexcept
Definition schematiceditorstate_addimage.cpp:264
State mState
Definition schematiceditorstate_addimage.h:93
QPointer< SI_Image > mCurrentImage
Definition schematiceditorstate_addimage.h:101
virtual bool processGraphicsSceneLeftMouseButtonPressed(const GraphicsSceneMouseEvent &e) noexcept override
Definition schematiceditorstate_addimage.cpp:135
State
Definition schematiceditorstate_addimage.h:90
Image mCurrentProperties
Definition schematiceditorstate_addimage.h:97
bool mUndoCmdActive
Definition schematiceditorstate_addimage.h:94
virtual bool processRotate(const Angle &rotation) noexcept override
Definition schematiceditorstate_addimage.cpp:106
std::unique_ptr< CmdImageEdit > mCurrentEditCmd
Definition schematiceditorstate_addimage.h:100
void updateSize(const Point &pos) noexcept
Definition schematiceditorstate_addimage.cpp:252
bool abort(bool showErrMsgBox) noexcept
Definition schematiceditorstate_addimage.cpp:288
virtual bool exit() noexcept override
Definition schematiceditorstate_addimage.cpp:83
SchematicEditorState_AddImage(const SchematicEditorState_AddImage &other)=delete
std::shared_ptr< ImageGraphicsItem > mCurrentGraphicsItem
Definition schematiceditorstate_addimage.h:103
qreal mCurrentImageAspectRatio
Definition schematiceditorstate_addimage.h:102
virtual bool processAddImage(const QByteArray &data, const QString &format, const QString &basename) noexcept override
Definition schematiceditorstate_addimage.cpp:98
virtual bool entry() noexcept override
Definition schematiceditorstate_addimage.cpp:74
bool start(const Point &pos, QByteArray data, QString format, QString basename) noexcept
Definition schematiceditorstate_addimage.cpp:175
The schematic editor state base class.
Definition schematiceditorstate.h:58
Definition occmodel.cpp:77
Definition graphicsscene.h:45
FSM Context.
Definition schematiceditorfsm.h:65