LibrePCB Developers Documentation
Loading...
Searching...
No Matches
boardeditorstate_addhole.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_BOARDEDITORSTATE_ADDHOLE_H
21#define LIBREPCB_EDITOR_BOARDEDITORSTATE_ADDHOLE_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "boardeditorstate.h"
27
29
30#include <QtCore>
31
32#include <memory>
33
34/*******************************************************************************
35 * Namespace / Forward Declarations
36 ******************************************************************************/
37namespace librepcb {
38
39class Board;
40
41namespace editor {
42
43class CmdBoardHoleEdit;
44
45/*******************************************************************************
46 * Class BoardEditorState_AddHole
47 ******************************************************************************/
48
53 Q_OBJECT
54
55public:
56 // Constructors / Destructor
59 explicit BoardEditorState_AddHole(const Context& context) noexcept;
60 virtual ~BoardEditorState_AddHole() noexcept;
61
62 // General Methods
63 virtual bool entry() noexcept override;
64 virtual bool exit() noexcept override;
65
66 // Event Handlers
68 const GraphicsSceneMouseEvent& e) noexcept override;
70 const GraphicsSceneMouseEvent& e) noexcept override;
72 const GraphicsSceneMouseEvent& e) noexcept override;
73
74 // Connection to UI
75 const PositiveLength& getDiameter() const noexcept {
76 return mCurrentDiameter;
77 }
78 void setDiameter(const PositiveLength& diameter) noexcept;
79
80 // Operator Overloadings
82 delete;
83
84signals:
85 void diameterChanged(const PositiveLength& diameter);
86
87private: // Methods
88 bool addHole(const Point& pos) noexcept;
89 bool updatePosition(const Point& pos) noexcept;
90 bool fixPosition(const Point& pos) noexcept;
91 bool abortCommand(bool showErrMsgBox) noexcept;
92
93private: // Data
94 // State
97
98 // Information about the current hole to place. Only valid if
99 // mIsUndoCmdActive == true.
101 std::unique_ptr<CmdBoardHoleEdit> mCurrentHoleEditCmd;
102};
103
104/*******************************************************************************
105 * End of File
106 ******************************************************************************/
107
108} // namespace editor
109} // namespace librepcb
110
111#endif
The BI_Hole class.
Definition bi_hole.h:46
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5....
Definition point.h:78
The "add hole" state/tool of the board editor.
Definition boardeditorstate_addhole.h:52
BI_Hole * mCurrentHoleToPlace
Definition boardeditorstate_addhole.h:100
virtual bool processGraphicsSceneMouseMoved(const GraphicsSceneMouseEvent &e) noexcept override
Definition boardeditorstate_addhole.cpp:87
virtual ~BoardEditorState_AddHole() noexcept
Definition boardeditorstate_addhole.cpp:52
bool addHole(const Point &pos) noexcept
Definition boardeditorstate_addhole.cpp:126
virtual bool processGraphicsSceneLeftMouseButtonPressed(const GraphicsSceneMouseEvent &e) noexcept override
Definition boardeditorstate_addhole.cpp:93
bool updatePosition(const Point &pos) noexcept
Definition boardeditorstate_addhole.cpp:151
BoardEditorState_AddHole(const BoardEditorState_AddHole &other)=delete
void diameterChanged(const PositiveLength &diameter)
std::unique_ptr< CmdBoardHoleEdit > mCurrentHoleEditCmd
Definition boardeditorstate_addhole.h:101
const PositiveLength & getDiameter() const noexcept
Definition boardeditorstate_addhole.h:75
virtual bool processGraphicsSceneLeftMouseButtonDoubleClicked(const GraphicsSceneMouseEvent &e) noexcept override
Definition boardeditorstate_addhole.cpp:101
bool abortCommand(bool showErrMsgBox) noexcept
Definition boardeditorstate_addhole.cpp:179
bool mIsUndoCmdActive
Definition boardeditorstate_addhole.h:95
void setDiameter(const PositiveLength &diameter) noexcept
Definition boardeditorstate_addhole.cpp:110
PositiveLength mCurrentDiameter
Definition boardeditorstate_addhole.h:96
virtual bool exit() noexcept override
Definition boardeditorstate_addhole.cpp:74
bool fixPosition(const Point &pos) noexcept
Definition boardeditorstate_addhole.cpp:160
BoardEditorState_AddHole & operator=(const BoardEditorState_AddHole &rhs)=delete
virtual bool entry() noexcept override
Definition boardeditorstate_addhole.cpp:59
The board editor state base class.
Definition boardeditorstate.h:60
Definition occmodel.cpp:77
type_safe::constrained_type< Length, PositiveLengthConstraint, PositiveLengthVerifier > PositiveLength
Definition length.h:810
FSM Context.
Definition boardeditorfsm.h:88
Definition graphicsscene.h:45