Vuo
2.4.4
Loading...
Searching...
No Matches
editor
VuoCommandSetPublishedPortName.cc
Go to the documentation of this file.
1
10
#include "
VuoCommandCommon.hh
"
11
#include "
VuoCommandSetPublishedPortName.hh
"
12
#include "
VuoCompilerPort.hh
"
13
#include "
VuoEditorComposition.hh
"
14
#include "
VuoEditorWindow.hh
"
15
19
VuoCommandSetPublishedPortName::VuoCommandSetPublishedPortName
(
VuoRendererPublishedPort
*port,
string
name,
VuoEditorWindow
*window)
20
:
VuoCommandCommon
(window)
21
{
22
setText(QApplication::translate(
"VuoEditorWindow"
,
"Set Published Port Name"
));
23
this->window = window;
24
this->revertedSnapshot = window->
getComposition
()->
takeSnapshot
();
25
26
string
oldPortName = port->
getBase
()->
getClass
()->
getName
();
27
28
// Start of command content.
29
{
30
window->
getComposition
()->
setPublishedPortName
(port, name);
31
}
32
// End of command content.
33
34
this->updatedSnapshot = window->
getComposition
()->
takeSnapshot
();
35
36
setDescription
(
"Rename published port %s to %s"
,
37
oldPortName.c_str(),
38
name.c_str());
39
}
40
44
int
VuoCommandSetPublishedPortName::id
()
const
45
{
46
return
VuoCommandCommon::setPublishedPortNameCommandID
;
47
}
48
52
void
VuoCommandSetPublishedPortName::undo
()
53
{
54
VuoCommandCommon_undo
;
55
56
window->
resetCompositionWithSnapshot
(revertedSnapshot);
57
window->
coalesceSnapshots
(updatedSnapshot, revertedSnapshot);
58
59
setText(QApplication::translate(
"VuoEditorWindow"
,
"Set Published Port Name"
));
60
}
61
65
void
VuoCommandSetPublishedPortName::redo
()
66
{
67
VuoCommandCommon_redo
;
68
69
window->
resetCompositionWithSnapshot
(updatedSnapshot);
70
window->
coalesceSnapshots
(revertedSnapshot, updatedSnapshot);
71
72
setText(QApplication::translate(
"VuoEditorWindow"
,
"Set Published Port Name"
));
73
}
Generated on Thu Nov 9 2023 16:59:29 for Vuo by
1.9.8