LibrePCB Developers Documentation
Loading...
Searching...
No Matches
cmdnetclassedit.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_CMDNETCLASSEDIT_H
21#define LIBREPCB_EDITOR_CMDNETCLASSEDIT_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "../../undocommand.h"
27
29
30#include <QtCore>
31
32/*******************************************************************************
33 * Namespace / Forward Declarations
34 ******************************************************************************/
35namespace librepcb {
36
37class NetClass;
38
39namespace editor {
40
41/*******************************************************************************
42 * Class CmdNetClassEdit
43 ******************************************************************************/
44
48class CmdNetClassEdit final : public UndoCommand {
49public:
50 // Constructors / Destructor
51 explicit CmdNetClassEdit(NetClass& netclass) noexcept;
52 ~CmdNetClassEdit() noexcept;
53
54 // Setters
55 void setName(const ElementName& name) noexcept;
57 const std::optional<PositiveLength>& value) noexcept;
58 void setDefaultViaDrill(const std::optional<PositiveLength>& value) noexcept;
59
60private:
61 // Private Methods
62
64 bool performExecute() override;
65
67 void performUndo() override;
68
70 void performRedo() override;
71
72 // Private Member Variables
73
74 // Attributes from the constructor
76
77 // General Attributes
80 std::optional<PositiveLength> mOldDefaultTraceWidth;
81 std::optional<PositiveLength> mNewDefaultTraceWidth;
82 std::optional<PositiveLength> mOldDefaultViaDrill;
83 std::optional<PositiveLength> mNewDefaultViaDrill;
84};
85
86/*******************************************************************************
87 * End of File
88 ******************************************************************************/
89
90} // namespace editor
91} // namespace librepcb
92
93#endif
The NetClass class.
Definition netclass.h:47
The CmdNetClassEdit class.
Definition cmdnetclassedit.h:48
void performRedo() override
Redo the command.
Definition cmdnetclassedit.cpp:94
void setName(const ElementName &name) noexcept
Definition cmdnetclassedit.cpp:58
void setDefaultTraceWidth(const std::optional< PositiveLength > &value) noexcept
Definition cmdnetclassedit.cpp:63
~CmdNetClassEdit() noexcept
Definition cmdnetclassedit.cpp:51
NetClass & mNetClass
Definition cmdnetclassedit.h:75
std::optional< PositiveLength > mOldDefaultTraceWidth
Definition cmdnetclassedit.h:80
void setDefaultViaDrill(const std::optional< PositiveLength > &value) noexcept
Definition cmdnetclassedit.cpp:69
std::optional< PositiveLength > mOldDefaultViaDrill
Definition cmdnetclassedit.h:82
void performUndo() override
Undo the command.
Definition cmdnetclassedit.cpp:88
ElementName mNewName
Definition cmdnetclassedit.h:79
ElementName mOldName
Definition cmdnetclassedit.h:78
std::optional< PositiveLength > mNewDefaultViaDrill
Definition cmdnetclassedit.h:83
std::optional< PositiveLength > mNewDefaultTraceWidth
Definition cmdnetclassedit.h:81
bool performExecute() override
Execute the command the first time.
Definition cmdnetclassedit.cpp:79
The UndoCommand class represents a command which you can undo/redo.
Definition undocommand.h:46
Definition occmodel.cpp:77
type_safe::constrained_type< QString, ElementNameConstraint, ElementNameVerifier > ElementName
Definition elementname.h:84