LibrePCB Developers Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
bes_addvia.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_PROJECT_BES_ADDVIA_H
21 #define LIBREPCB_PROJECT_BES_ADDVIA_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
26 #include "bes_base.h"
27 
29 
30 #include <QtCore>
31 
32 /*******************************************************************************
33  * Namespace / Forward Declarations
34  ******************************************************************************/
35 namespace librepcb {
36 
37 class PositiveLengthEdit;
38 
39 namespace project {
40 
41 class Board;
42 class BI_Via;
43 class CmdBoardViaEdit;
44 
45 namespace editor {
46 
47 /*******************************************************************************
48  * Class BES_AddVia
49  ******************************************************************************/
50 
54 class BES_AddVia final : public BES_Base {
55  Q_OBJECT
56 
57 public:
58  // Constructors / Destructor
59  explicit BES_AddVia(BoardEditor& editor, Ui::BoardEditor& editorUi,
60  GraphicsView& editorGraphicsView, UndoStack& undoStack);
61  ~BES_AddVia();
62 
63  // General Methods
64  ProcRetVal process(BEE_Base* event) noexcept override;
65  bool entry(BEE_Base* event) noexcept override;
66  bool exit(BEE_Base* event) noexcept override;
67 
68 private:
69  // Private Methods
70  ProcRetVal processSceneEvent(BEE_Base* event) noexcept;
71  bool addVia(Board& board) noexcept;
72  bool updateVia(Board& board, const Point& pos) noexcept;
73  bool fixVia(const Point& pos) noexcept;
74  void updateShapeActionsCheckedState() noexcept;
75  void sizeEditValueChanged(const PositiveLength& value) noexcept;
76  void drillDiameterEditValueChanged(const PositiveLength& value) noexcept;
77  void setNetSignal(NetSignal* netsignal) noexcept;
78 
79  // General Attributes
86  QScopedPointer<CmdBoardViaEdit> mViaEditCmd;
87 
88  // Widgets for the command toolbar
89  QHash<int, QAction*> mShapeActions;
90  QList<QAction*> mActionSeparators;
91  QLabel* mSizeLabel;
93  QLabel* mDrillLabel;
95  QLabel* mNetSignalLabel;
96  QComboBox* mNetSignalComboBox;
97 };
98 
99 /*******************************************************************************
100  * End of File
101  ******************************************************************************/
102 
103 } // namespace editor
104 } // namespace project
105 } // namespace librepcb
106 
107 #endif // LIBREPCB_PROJECT_BES_ADDVIA_H
ProcRetVal processSceneEvent(BEE_Base *event) noexcept
Definition: bes_addvia.cpp:219
PositiveLengthEdit * mSizeEdit
Definition: bes_addvia.h:92
BI_Via::Shape mCurrentViaShape
Definition: bes_addvia.h:82
ProcRetVal process(BEE_Base *event) noexceptoverride
Definition: bes_addvia.cpp:81
The BES_Base (BoardEditorState Base) class.
Definition: bes_base.h:60
QLabel * mNetSignalLabel
Definition: bes_addvia.h:95
The BES_AddVia class.
Definition: bes_addvia.h:54
bool mUndoCmdActive
Definition: bes_addvia.h:80
PositiveLength mCurrentViaDrillDiameter
Definition: bes_addvia.h:84
The BoardEditor class.
Definition: boardeditor.h:69
void drillDiameterEditValueChanged(const PositiveLength &value) noexcept
Definition: bes_addvia.cpp:373
The PositiveLengthEdit class is a widget to view/edit librepcb::PositiveLength values.
Definition: positivelengthedit.h:46
QLabel * mDrillLabel
Definition: bes_addvia.h:93
~BES_AddVia()
Definition: bes_addvia.cpp:73
The GraphicsView class.
Definition: graphicsview.h:47
bool fixVia(const Point &pos) noexcept
Definition: bes_addvia.cpp:335
QList< QAction * > mActionSeparators
Definition: bes_addvia.h:90
The UndoStack class holds UndoCommand objects and provides undo/redo commands.
Definition: undostack.h:107
NetSignal * mCurrentViaNetSignal
Definition: bes_addvia.h:85
bool entry(BEE_Base *event) noexceptoverride
Definition: bes_addvia.cpp:90
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5...
Definition: point.h:78
ProcRetVal
process() return values
Definition: bes_base.h:65
QComboBox * mNetSignalComboBox
Definition: bes_addvia.h:96
BES_AddVia(BoardEditor &editor, Ui::BoardEditor &editorUi, GraphicsView &editorGraphicsView, UndoStack &undoStack)
Definition: bes_addvia.cpp:55
PositiveLength mCurrentViaSize
Definition: bes_addvia.h:83
Shape
Definition: bi_via.h:56
bool exit(BEE_Base *event) noexceptoverride
Definition: bes_addvia.cpp:182
QScopedPointer< CmdBoardViaEdit > mViaEditCmd
Definition: bes_addvia.h:86
type_safe::constrained_type< Length, PositiveLengthConstraint, PositiveLengthVerifier > PositiveLength
Definition: length.h:780
PositiveLengthEdit * mDrillEdit
Definition: bes_addvia.h:94
The NetSignal class.
Definition: netsignal.h:56
QLabel * mSizeLabel
Definition: bes_addvia.h:91
The Board class represents a PCB of a project and is always part of a circuit.
Definition: board.h:83
BI_Via * mCurrentVia
Definition: bes_addvia.h:81
void sizeEditValueChanged(const PositiveLength &value) noexcept
Definition: bes_addvia.cpp:366
bool addVia(Board &board) noexcept
Definition: bes_addvia.cpp:287
void setNetSignal(NetSignal *netsignal) noexcept
Definition: bes_addvia.cpp:381
The BI_Via class.
Definition: bi_via.h:49
The BEE_Base (Board Editor Event Base) class.
Definition: boardeditorevent.h:55
void updateShapeActionsCheckedState() noexcept
Definition: bes_addvia.cpp:357
bool updateVia(Board &board, const Point &pos) noexcept
Definition: bes_addvia.cpp:320
QHash< int, QAction * > mShapeActions
Definition: bes_addvia.h:89