20#ifndef LIBREPCB_EDITOR_BOARDEDITORSTATE_H
21#define LIBREPCB_EDITOR_BOARDEDITORSTATE_H
29#include <optional/tl/optional.hpp>
49class BoardGraphicsScene;
71 FootprintPads = (1 << 4),
75 StrokeTexts = (1 << 8),
77 All = Vias | NetPoints | NetLines | Devices | FootprintPads | Planes |
78 Zones | Polygons | StrokeTexts | Holes,
81 AcceptNearMatch = (1 << 10),
82 AcceptNextGridMatch = (1 << 11),
85 SkipLowerPriorityMatches = (1 << 15),
93 QObject* parent =
nullptr) noexcept;
97 virtual
bool entry() noexcept {
return true; }
98 virtual bool exit() noexcept {
return true; }
103 const Uuid& footprint)
noexcept {
123 Q_UNUSED(orientation);
148 QGraphicsSceneMouseEvent& e)
noexcept {
153 QGraphicsSceneMouseEvent& e)
noexcept {
158 QGraphicsSceneMouseEvent& e)
noexcept {
163 QGraphicsSceneMouseEvent& e)
noexcept {
168 QGraphicsSceneMouseEvent& e)
noexcept {
202 const
Point& pos, FindFlags flags,
203 const
tl::optional<const
Layer&> cuLayer =
tl::nullopt,
204 const QSet<const
NetSignal*>& netsignals = {},
205 const QVector<std::shared_ptr<QGraphicsItem>>& except = {})
noexcept;
206 template <
typename T = QGraphicsItem>
208 const Point& pos, FindFlags flags,
209 const tl::optional<const Layer&> cuLayer = tl::nullopt,
210 const QSet<const NetSignal*>& netsignals = {},
211 const QVector<std::shared_ptr<QGraphicsItem>>& except = {})
noexcept {
212 const QList<std::shared_ptr<QGraphicsItem>> items =
215 std::shared_ptr<T> castedItem =
216 std::dynamic_pointer_cast<T>(items.value(0,
nullptr));
217 if ((!items.isEmpty()) && (!castedItem)) {
219 qCritical() <<
"Found a board item, but it has the wrong type!";
231Q_DECLARE_OPERATORS_FOR_FLAGS(librepcb::editor::BoardEditorState::FindFlags)
The Angle class is used to represent an angle (for example 12.75 degrees)
Definition: angle.h:78
The Board class represents a PCB of a project and is always part of a circuit.
Definition: board.h:73
The ComponentInstance class.
Definition: componentinstance.h:54
The Layer class provides all supported geometry layers.
Definition: layer.h:42
The LengthUnit class represents a length unit (millimeters, inches,...) and provides some useful meth...
Definition: lengthunit.h:60
The NetSignal class.
Definition: netsignal.h:50
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5....
Definition: point.h:79
The Uuid class is a replacement for QUuid to get UUID strings without {} braces.
Definition: uuid.h:58
The board editor state base class.
Definition: boardeditorstate.h:59
Context mContext
Definition: boardeditorstate.h:225
void requestLeavingState()
Signal to indicate that the current tool should be exited.
BoardEditorState & operator=(const BoardEditorState &rhs)=delete
virtual bool processEditProperties() noexcept
Definition: boardeditorstate.h:137
virtual bool processAbortCommand() noexcept
Definition: boardeditorstate.h:138
virtual bool processGraphicsSceneLeftMouseButtonDoubleClicked(QGraphicsSceneMouseEvent &e) noexcept
Definition: boardeditorstate.h:162
virtual bool exit() noexcept
Definition: boardeditorstate.h:98
void statusBarMessageChanged(const QString &message, int timeoutMs=-1)
const LengthUnit & getLengthUnit() const noexcept
Definition: boardeditorstate.cpp:98
virtual bool processKeyPressed(const QKeyEvent &e) noexcept
Definition: boardeditorstate.h:139
virtual bool processSnapToGrid() noexcept
Definition: boardeditorstate.h:126
virtual bool processSetLocked(bool locked) noexcept
Definition: boardeditorstate.h:127
virtual bool entry() noexcept
Definition: boardeditorstate.h:97
virtual bool processSelectAll() noexcept
Definition: boardeditorstate.h:110
virtual bool processMove(const Point &delta) noexcept
Definition: boardeditorstate.h:114
QWidget * parentWidget() noexcept
Definition: boardeditorstate.cpp:164
virtual bool processGraphicsSceneRightMouseButtonReleased(QGraphicsSceneMouseEvent &e) noexcept
Definition: boardeditorstate.h:167
virtual bool processGraphicsSceneLeftMouseButtonReleased(QGraphicsSceneMouseEvent &e) noexcept
Definition: boardeditorstate.h:157
virtual bool processRotate(const Angle &rotation) noexcept
Definition: boardeditorstate.h:118
virtual bool processImportDxf() noexcept
Definition: boardeditorstate.h:109
virtual bool processKeyReleased(const QKeyEvent &e) noexcept
Definition: boardeditorstate.h:143
BoardGraphicsScene * getActiveBoardScene() noexcept
Definition: boardeditorstate.cpp:86
FindFlag
Definition: boardeditorstate.h:65
@ SkipLowerPriorityMatches
std::shared_ptr< T > findItemAtPos(const Point &pos, FindFlags flags, const tl::optional< const Layer & > cuLayer=tl::nullopt, const QSet< const NetSignal * > &netsignals={}, const QVector< std::shared_ptr< QGraphicsItem > > &except={}) noexcept
Definition: boardeditorstate.h:207
virtual bool processResetAllTexts() noexcept
Definition: boardeditorstate.h:135
virtual bool processGraphicsSceneMouseMoved(QGraphicsSceneMouseEvent &e) noexcept
Definition: boardeditorstate.h:147
bool getIgnoreLocks() const noexcept
Definition: boardeditorstate.cpp:90
QList< std::shared_ptr< QGraphicsItem > > findItemsAtPos(const Point &pos, FindFlags flags, const tl::optional< const Layer & > cuLayer=tl::nullopt, const QSet< const NetSignal * > &netsignals={}, const QVector< std::shared_ptr< QGraphicsItem > > &except={}) noexcept
Definition: boardeditorstate.cpp:168
void abortBlockingToolsInOtherEditors() noexcept
Definition: boardeditorstate.cpp:156
virtual bool processGraphicsSceneLeftMouseButtonPressed(QGraphicsSceneMouseEvent &e) noexcept
Definition: boardeditorstate.h:152
PositiveLength getGridInterval() const noexcept
Definition: boardeditorstate.cpp:94
Board * getActiveBoard() noexcept
Definition: boardeditorstate.cpp:82
virtual bool processCopy() noexcept
Definition: boardeditorstate.h:112
virtual bool processCut() noexcept
Definition: boardeditorstate.h:111
virtual bool processFlip(Qt::Orientation orientation) noexcept
Definition: boardeditorstate.h:122
virtual bool processPaste() noexcept
Definition: boardeditorstate.h:113
QSet< const Layer * > getAllowedGeometryLayers() noexcept
Definition: boardeditorstate.cpp:107
bool execCmd(UndoCommand *cmd)
Definition: boardeditorstate.cpp:160
virtual bool processRemove() noexcept
Definition: boardeditorstate.h:136
virtual bool processSwitchToBoard(int index) noexcept
Definition: boardeditorstate.h:172
virtual bool processChangeLineWidth(int step) noexcept
Definition: boardeditorstate.h:131
virtual bool processAddDevice(ComponentInstance &component, const Uuid &device, const Uuid &footprint) noexcept
Definition: boardeditorstate.h:101
void makeLayerVisible(const QString &layer) noexcept
Definition: boardeditorstate.cpp:148
The BoardGraphicsScene class.
Definition: boardgraphicsscene.h:77
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:812
FSM Context.
Definition: boardeditorfsm.h:88