QElectroTech 0.100.0-dev
Loading...
Searching...
No Matches
diagramcommands.h
Go to the documentation of this file.
1/*
2 Copyright 2006-2024 The QElectroTech Team
3 This file is part of QElectroTech.
4
5 QElectroTech is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 2 of the License, or
8 (at your option) any later version.
9
10 QElectroTech is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
17*/
18#ifndef DIAGRAM_COMMANDS_H
19#define DIAGRAM_COMMANDS_H
20
22#include "conductorprofile.h"
23#include "borderproperties.h"
25
26class DiagramTextItem;
27
32class PasteDiagramCommand : public QUndoCommand {
33 // constructors, destructor
34 public:
36 QUndoCommand * = nullptr);
37 ~PasteDiagramCommand() override;
38 private:
40
41 // methods
42 public:
43 void undo() override;
44 void redo() override;
45
46 // attributes
47 private:
53 int filter;
56};
57
63 // constructors, destructor
64 public:
66 QUndoCommand * = nullptr);
67 ~CutDiagramCommand() override;
68 private:
70};
71
77class MoveConductorsTextsCommand : public QUndoCommand {
78 // constructors, destructor
79 public:
80 MoveConductorsTextsCommand(Diagram *, QUndoCommand * = nullptr);
82 private:
84
85 // methods
86 public:
87 void undo() override;
88 void redo() override;
90 const QPointF &,
91 const QPointF &,
92 bool = false);
93
94 private:
96
97 // attributes
98 private:
102 QHash<ConductorTextItem *, QPair<QPointF, bool> > texts_to_move_;
105};
106
111class ChangeDiagramTextCommand : public QUndoCommand {
112 // constructors, destructor
113 public:
115 const QString &before,
116 const QString &after,
117 QUndoCommand * = nullptr);
118 ~ChangeDiagramTextCommand() override;
119 private:
121
122 // methods
123 public:
124 void undo() override;
125 void redo() override;
126
127 // attributes
128 private:
132 QString text_before;
134 QString text_after;
138};
139
144class ChangeConductorCommand : public QUndoCommand {
145 // constructors, destructor
146 public:
148 const ConductorProfile &, Qt::Corner,
149 QUndoCommand * = nullptr);
150 ~ChangeConductorCommand() override;
151 private:
153
154 // methods
155 public:
156 void undo() override;
157 void redo() override;
158 virtual void setConductorTextItemMove(const QPointF &, const QPointF &);
159
160 // attributes
161 private:
169 Qt::Corner path_type;
177};
178
183class ResetConductorCommand : public QUndoCommand {
184 // constructors, destructor
185 public:
186 ResetConductorCommand(const QHash<Conductor *,
188 QUndoCommand * = nullptr);
189 ~ResetConductorCommand() override;
190 private:
192
193 // methods
194 public:
195 void undo() override;
196 void redo() override;
197
198 // attributes
199 private:
201 QHash<Conductor *, ConductorProfilesGroup> conductors_profiles;
203};
204
205
206
211class ChangeBorderCommand : public QUndoCommand {
212 // constructors, destructor
213 public:
215 const BorderProperties &, QUndoCommand * = nullptr);
216 ~ChangeBorderCommand() override;
217 private:
219
220 // methods
221 public:
222 void undo() override;
223 void redo() override;
224
225 // attributes
226 private:
229 public:
234};
235
236#endif
The BorderProperties class This class is a container for dimensions and display properties of a diagr...
Definition borderproperties.h:29
The ChangeBorderCommand class This command changes the border properties of a particular diagram.
Definition diagramcommands.h:211
Diagram * diagram
modified diagram
Definition diagramcommands.h:228
void redo() override
ChangeBorderCommand::redo Refait les changements apportes au schema.
Definition diagramcommands.cpp:473
void undo() override
ChangeBorderCommand::undo Annule les changements apportes au schema.
Definition diagramcommands.cpp:463
ChangeBorderCommand(const ChangeBorderCommand &)
~ChangeBorderCommand() override
ChangeBorderCommand::~ChangeBorderCommand Destructeur.
Definition diagramcommands.cpp:455
BorderProperties old_properties
properties before the change
Definition diagramcommands.h:231
BorderProperties new_properties
properties after the change
Definition diagramcommands.h:233
The ChangeConductorCommand class This command changes a particular conductor.
Definition diagramcommands.h:144
bool first_redo
prevent the first call to redo()
Definition diagramcommands.h:175
Qt::Corner path_type
Path type of the modified conductor.
Definition diagramcommands.h:169
Diagram * diagram
Definition diagramcommands.h:176
Conductor * conductor
changed conductor
Definition diagramcommands.h:163
void undo() override
ChangeConductorCommand::undo Annule la modification du conducteur.
Definition diagramcommands.cpp:344
QPointF text_pos_after_mov_
position of the text item after the change
Definition diagramcommands.h:173
ChangeConductorCommand(const ChangeConductorCommand &)
~ChangeConductorCommand() override
ChangeConductorCommand::~ChangeConductorCommand Destructeur.
Definition diagramcommands.cpp:336
ConductorProfile old_profile
profile before the change
Definition diagramcommands.h:165
void redo() override
ChangeConductorCommand::redo Refait la modification du conducteur.
Definition diagramcommands.cpp:355
ConductorProfile new_profile
profile after the change
Definition diagramcommands.h:167
virtual void setConductorTextItemMove(const QPointF &, const QPointF &)
ChangeConductorCommand::setConductorTextItemMove Integre dans cet objet d'annulation le repositionnem...
Definition diagramcommands.cpp:373
QPointF text_pos_before_mov_
position of the text item before the change
Definition diagramcommands.h:171
The ChangeDiagramTextCommand class This command modifies a text item.
Definition diagramcommands.h:111
ChangeDiagramTextCommand(const ChangeDiagramTextCommand &)
QString text_before
former text
Definition diagramcommands.h:132
void redo() override
ChangeDiagramTextCommand::redo.
Definition diagramcommands.cpp:300
QString text_after
new text
Definition diagramcommands.h:134
void undo() override
ChangeDiagramTextCommand::undo annule la modification de texte.
Definition diagramcommands.cpp:291
Diagram * diagram
Definition diagramcommands.h:137
~ChangeDiagramTextCommand() override
ChangeDiagramTextCommand::~ChangeDiagramTextCommand destructeur.
Definition diagramcommands.cpp:283
bool first_redo
prevent the first call to redo()
Definition diagramcommands.h:136
DiagramTextItem * text_item
modified text item
Definition diagramcommands.h:130
Definition conductor.h:43
Definition conductorprofile.h:28
Definition conductortextitem.h:30
The CutDiagramCommand class This command cuts content from a particular diagram.
Definition diagramcommands.h:62
~CutDiagramCommand() override
CutDiagramCommand::~CutDiagramCommand Destructeur.
Definition diagramcommands.cpp:147
CutDiagramCommand(const CutDiagramCommand &)
Definition deleteqgraphicsitemcommand.h:33
Definition diagramcontent.h:47
The Diagram class This class represents an electric diagram. It manages its various child elements,...
Definition diagram.h:56
Definition diagramtextitem.h:34
The MoveConductorsTextsCommand class This command moves text items related to conductors on a particu...
Definition diagramcommands.h:77
void redo() override
MoveConductorsTextsCommand::redo refait le deplacement.
Definition diagramcommands.cpp:197
QHash< ConductorTextItem *, QPair< QPointF, bool > > texts_to_move_
text items to be moved
Definition diagramcommands.h:102
bool first_redo
prevent the first call to redo()
Definition diagramcommands.h:104
Diagram * diagram
diagram the movement takes place on.
Definition diagramcommands.h:100
void regenerateTextLabel()
MoveConductorsTextsCommand::regenerateTextLabel Genere la description de l'objet d'annulation.
Definition diagramcommands.cpp:242
MoveConductorsTextsCommand(const MoveConductorsTextsCommand &)
void undo() override
MoveConductorsTextsCommand::undo annule le deplacement.
Definition diagramcommands.cpp:179
virtual void addTextMovement(ConductorTextItem *, const QPointF &, const QPointF &, bool=false)
MoveConductorsTextsCommand::addTextMovement Ajout un mouvement de champ de texte a cet objet.
Definition diagramcommands.cpp:223
~MoveConductorsTextsCommand() override
MoveConductorsTextsCommand::~MoveConductorsTextsCommand Destructeur.
Definition diagramcommands.cpp:171
The PasteDiagramCommand class This command pastes some content onto a particular diagram.
Definition diagramcommands.h:32
void redo() override
PasteDiagramCommand::redo Redo this command.
Definition diagramcommands.cpp:69
DiagramContent content
pasted content
Definition diagramcommands.h:49
void undo() override
PasteDiagramCommand::undo Undo this command.
Definition diagramcommands.cpp:57
bool first_redo
prevent the first call to redo()
Definition diagramcommands.h:55
int filter
filter stating what kinds of items should be pasted
Definition diagramcommands.h:53
PasteDiagramCommand(const PasteDiagramCommand &)
~PasteDiagramCommand() override
PasteDiagramCommand::~PasteDiagramCommand Destructor.
Definition diagramcommands.cpp:48
Diagram * diagram
diagram content is pasted onto
Definition diagramcommands.h:51
The ResetConductorCommand class This command resets conductor paths.
Definition diagramcommands.h:183
QHash< Conductor *, ConductorProfilesGroup > conductors_profiles
impacted conductors along with their former profiles
Definition diagramcommands.h:201
Diagram * diagram
Definition diagramcommands.h:202
ResetConductorCommand(const ResetConductorCommand &)
~ResetConductorCommand() override
ResetConductorCommand::~ResetConductorCommand.
Definition diagramcommands.cpp:402
void redo() override
ResetConductorCommand::redo.
Definition diagramcommands.cpp:420
void undo() override
ResetConductorCommand::undo.
Definition diagramcommands.cpp:409
QHash< Qt::Corner, ConductorProfile > ConductorProfilesGroup
Definition conductor.h:37