Vuo
2.0.3
editor
VuoCommandSetTriggerThrottling.cc
Go to the documentation of this file.
1
10
#include "
VuoCommandSetTriggerThrottling.hh
"
11
#include "
VuoCommandCommon.hh
"
12
#include "
VuoCompilerPort.hh
"
13
#include "
VuoEditorComposition.hh
"
14
#include "
VuoEditorWindow.hh
"
15
19
VuoCommandSetTriggerThrottling::VuoCommandSetTriggerThrottling
(
VuoPort
*port,
20
enum
VuoPortClass::EventThrottling
eventThrottling,
21
VuoEditorWindow
*window)
22
:
VuoCommandCommon
(window)
23
{
24
setText(QApplication::translate(
"VuoEditorWindow"
,
"Set Throttling"
));
25
this->window = window;
26
this->revertedSnapshot = window->
getComposition
()->
takeSnapshot
();
27
28
// Start of command content.
29
{
30
port->
setEventThrottling
(eventThrottling);
31
}
32
// End of command content.
33
34
this->updatedSnapshot = window->
getComposition
()->
takeSnapshot
();
35
36
VuoCompilerPort
*cp =
dynamic_cast<
VuoCompilerPort
*
>
(port->
getCompiler
());
37
setDescription
(
"Set throttling for %s to %s"
,
38
cp ? cp->
getIdentifier
().c_str() :
"?"
,
39
eventThrottling ==
VuoPortClass::EventThrottling_Enqueue
?
"enqueue"
:
"drop"
);
40
}
41
45
int
VuoCommandSetTriggerThrottling::id
()
const
46
{
47
return
VuoCommandCommon::setTriggerThrottlingCommandID
;
48
}
49
53
void
VuoCommandSetTriggerThrottling::undo
()
54
{
55
VuoCommandCommon_undo
;
56
57
window->
resetCompositionWithSnapshot
(revertedSnapshot);
58
window->
coalesceSnapshots
(updatedSnapshot, revertedSnapshot);
59
window->
getComposition
()->
updatePortPopovers
();
60
}
61
65
void
VuoCommandSetTriggerThrottling::redo
()
66
{
67
VuoCommandCommon_redo
;
68
69
window->
resetCompositionWithSnapshot
(updatedSnapshot);
70
window->
coalesceSnapshots
(revertedSnapshot, updatedSnapshot);
71
window->
getComposition
()->
updatePortPopovers
();
72
}
Generated on Tue Apr 28 2020 16:53:59 for Vuo by
1.8.17