Vuo
2.0.3
editor
VuoCommandAddPublishedPort.cc
Go to the documentation of this file.
1
10
#include "
VuoCommandAddPublishedPort.hh
"
11
#include "
VuoCommandCommon.hh
"
12
#include "
VuoCompilerPublishedPort.hh
"
13
#include "
VuoCompilerPublishedPortClass.hh
"
14
#include "
VuoCompilerInputData.hh
"
15
#include "
VuoCompilerInputDataClass.hh
"
16
#include "
VuoEditorComposition.hh
"
17
#include "
VuoEditorWindow.hh
"
18
23
VuoCommandAddPublishedPort::VuoCommandAddPublishedPort
(
VuoRendererPublishedPort
*publishedPort,
VuoEditorWindow
*window)
24
:
VuoCommandCommon
(window)
25
{
26
setText(QApplication::translate(
"VuoEditorWindow"
,
"Add Published Port"
));
27
this->window = window;
28
this->revertedSnapshot = window->
getComposition
()->
takeSnapshot
();
29
30
// Start of command content.
31
{
32
bool
isPublishedInput = !publishedPort->
getInput
();
33
window->
getComposition
()->
addPublishedPort
(
dynamic_cast<
VuoPublishedPort
*
>
(publishedPort->
getBase
()), isPublishedInput);
34
35
string
typeName =
"event"
;
36
VuoType
*vuoType =
dynamic_cast<
VuoCompilerPublishedPortClass
*
>
(publishedPort->
getBase
()->
getClass
()->
getCompiler
())->getDataVuoType();
37
if
(vuoType)
38
typeName = vuoType->
getModuleKey
();
39
setDescription
(
"Add published %s port %s %s"
,
40
isPublishedInput ?
"input"
:
"output"
,
41
typeName.c_str(),
42
publishedPort->
getBase
()->
getClass
()->
getName
().c_str());
43
}
44
// End of command content.
45
46
this->updatedSnapshot = window->
getComposition
()->
takeSnapshot
();
47
}
48
52
int
VuoCommandAddPublishedPort::id
()
const
53
{
54
return
VuoCommandCommon::addPublishedPortCommandID
;
55
}
56
60
void
VuoCommandAddPublishedPort::undo
()
61
{
62
VuoCommandCommon_undo
;
63
64
window->
resetCompositionWithSnapshot
(revertedSnapshot);
65
window->
coalesceSnapshots
(updatedSnapshot, revertedSnapshot);
66
}
67
71
void
VuoCommandAddPublishedPort::redo
()
72
{
73
VuoCommandCommon_redo
;
74
75
window->
resetCompositionWithSnapshot
(updatedSnapshot);
76
window->
coalesceSnapshots
(revertedSnapshot, updatedSnapshot);
77
}
Generated on Tue Apr 28 2020 16:53:59 for Vuo by
1.8.17