LibrePCB Developers Documentation
Loading...
Searching...
No Matches
packageeditorstate_drawzone.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_PACKAGEEDITORSTATE_DRAWZONE_H
21#define LIBREPCB_EDITOR_PACKAGEEDITORSTATE_DRAWZONE_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "packageeditorstate.h"
27
32
33#include <QtCore>
34#include <QtWidgets>
35
36#include <memory>
37
38/*******************************************************************************
39 * Namespace / Forward Declarations
40 ******************************************************************************/
41namespace librepcb {
42namespace editor {
43
44class CmdZoneEdit;
45class ZoneGraphicsItem;
46
47/*******************************************************************************
48 * Class PackageEditorState_DrawZone
49 ******************************************************************************/
50
55 Q_OBJECT
56
57public:
58 // Constructors / Destructor
61 delete;
62 explicit PackageEditorState_DrawZone(Context& context) noexcept;
63 virtual ~PackageEditorState_DrawZone() noexcept;
64
65 // General Methods
66 bool entry() noexcept override;
67 bool exit() noexcept override;
69 const noexcept override;
70
71 // Event Handlers
72 bool processKeyPressed(const QKeyEvent& e) noexcept override;
73 bool processKeyReleased(const QKeyEvent& e) noexcept override;
75 QGraphicsSceneMouseEvent& e) noexcept override;
77 QGraphicsSceneMouseEvent& e) noexcept override;
79 QGraphicsSceneMouseEvent& e) noexcept override;
80 bool processAbortCommand() noexcept override;
81
82 // Operator Overloadings
84 const PackageEditorState_DrawZone& rhs) = delete;
85
86private: // Methods
87 bool start() noexcept;
88 bool abort(bool showErrMsgBox = true) noexcept;
89 bool addNextSegment() noexcept;
90 void updateCursorPosition(Qt::KeyboardModifiers modifiers) noexcept;
91 void updateOutline() noexcept;
92 void updateOverlayText() noexcept;
93 void updateStatusBarMessage() noexcept;
94 void angleEditValueChanged(const Angle& value) noexcept;
95
96private: // Types / Data
98 std::unique_ptr<CmdZoneEdit> mEditCmd;
99 std::shared_ptr<Zone> mCurrentZone;
103
104 // Parameter memory
108};
109
110/*******************************************************************************
111 * End of File
112 ******************************************************************************/
113
114} // namespace editor
115} // namespace librepcb
116
117#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 Zone class.
Definition zone.h:43
The CmdZoneEdit class.
Definition cmdzoneedit.h:48
The EditorWidgetBase class.
Definition editorwidgetbase.h:61
The PackageEditorState_DrawZone class.
Definition packageeditorstate_drawzone.h:54
bool processGraphicsSceneMouseMoved(QGraphicsSceneMouseEvent &e) noexcept override
Definition packageeditorstate_drawzone.cpp:202
std::unique_ptr< CmdZoneEdit > mEditCmd
Definition packageeditorstate_drawzone.h:98
bool abort(bool showErrMsgBox=true) noexcept
Definition packageeditorstate_drawzone.cpp:268
bool addNextSegment() noexcept
Definition packageeditorstate_drawzone.cpp:291
void updateOutline() noexcept
Definition packageeditorstate_drawzone.cpp:350
void updateCursorPosition(Qt::KeyboardModifiers modifiers) noexcept
Definition packageeditorstate_drawzone.cpp:334
std::shared_ptr< Zone > mCurrentZone
Definition packageeditorstate_drawzone.h:99
Angle mLastAngle
Definition packageeditorstate_drawzone.h:107
bool processAbortCommand() noexcept override
Definition packageeditorstate_drawzone.cpp:226
bool processKeyPressed(const QKeyEvent &e) noexcept override
Definition packageeditorstate_drawzone.cpp:182
void updateOverlayText() noexcept
Definition packageeditorstate_drawzone.cpp:357
PackageEditorState_DrawZone(const PackageEditorState_DrawZone &other)=delete
bool mIsUndoCmdActive
Definition packageeditorstate_drawzone.h:97
bool start() noexcept
Definition packageeditorstate_drawzone.cpp:238
void angleEditValueChanged(const Angle &value) noexcept
Definition packageeditorstate_drawzone.cpp:408
bool exit() noexcept override
Definition packageeditorstate_drawzone.cpp:156
std::shared_ptr< ZoneGraphicsItem > mCurrentGraphicsItem
Definition packageeditorstate_drawzone.h:100
virtual ~PackageEditorState_DrawZone() noexcept
Definition packageeditorstate_drawzone.cpp:58
Zone::Rules mLastRules
Definition packageeditorstate_drawzone.h:106
void updateStatusBarMessage() noexcept
Definition packageeditorstate_drawzone.cpp:395
QSet< EditorWidgetBase::Feature > getAvailableFeatures() const noexcept override
Definition packageeditorstate_drawzone.cpp:172
Zone::Layers mLastLayers
Definition packageeditorstate_drawzone.h:105
bool processKeyReleased(const QKeyEvent &e) noexcept override
Definition packageeditorstate_drawzone.cpp:192
bool processGraphicsSceneLeftMouseButtonPressed(QGraphicsSceneMouseEvent &e) noexcept override
Definition packageeditorstate_drawzone.cpp:209
Point mLastScenePos
Definition packageeditorstate_drawzone.h:101
Point mCursorPos
Definition packageeditorstate_drawzone.h:102
bool entry() noexcept override
Definition packageeditorstate_drawzone.cpp:65
bool processGraphicsSceneLeftMouseButtonDoubleClicked(QGraphicsSceneMouseEvent &e) noexcept override
Definition packageeditorstate_drawzone.cpp:220
The PackageEditorState class is the base class of all package editor FSM states.
Definition packageeditorstate.h:52
The ZoneGraphicsItem class.
Definition zonegraphicsitem.h:48
Definition occmodel.cpp:76
Definition uuid.h:186
Definition packageeditorfsm.h:90