Vuo
2.0.2
editor
VuoCommandRemoveProtocolPort.cc
Go to the documentation of this file.
1
10
#include "
VuoCommandRemoveProtocolPort.hh
"
11
#include "
VuoCommandCommon.hh
"
12
#include "
VuoEditorComposition.hh
"
13
#include "
VuoEditorWindow.hh
"
14
#include "
VuoRendererPublishedPort.hh
"
15
19
VuoCommandRemoveProtocolPort::VuoCommandRemoveProtocolPort
(
VuoRendererPublishedPort
*publishedPort,
VuoEditorWindow
*window)
20
:
VuoCommandCommon
(window)
21
{
22
setText(QApplication::translate(
"VuoEditorWindow"
,
"Remove Protocol Port"
));
23
this->window = window;
24
this->revertedSnapshot = window->
getComposition
()->
takeSnapshot
();
25
26
// Start of command content.
27
{
28
bool
isPublishedInput = !publishedPort->
getInput
();
29
window->
getComposition
()->
removePublishedPort
(
dynamic_cast<
VuoPublishedPort
*
>
(publishedPort->
getBase
()), isPublishedInput);
30
}
31
// End of command content.
32
33
this->updatedSnapshot = window->
getComposition
()->
takeSnapshot
();
34
35
setDescription
(
"Remove protocol port %s"
, publishedPort->
getBase
()->
getClass
()->
getName
().c_str());
36
}
37
41
int
VuoCommandRemoveProtocolPort::id
()
const
42
{
43
return
VuoCommandCommon::removeProtocolPortCommandID
;
44
}
45
49
void
VuoCommandRemoveProtocolPort::undo
()
50
{
51
VuoCommandCommon_undo
;
52
53
window->
resetCompositionWithSnapshot
(revertedSnapshot);
54
window->
coalesceSnapshots
(updatedSnapshot, revertedSnapshot);
55
}
56
60
void
VuoCommandRemoveProtocolPort::redo
()
61
{
62
VuoCommandCommon_redo
;
63
64
window->
resetCompositionWithSnapshot
(updatedSnapshot);
65
window->
coalesceSnapshots
(revertedSnapshot, updatedSnapshot);
66
}
Generated on Thu Mar 19 2020 23:15:57 for Vuo by
1.8.17