Vuo  2.0.2
VuoCommandRemoveProtocolPort.cc
Go to the documentation of this file.
1 
11 #include "VuoCommandCommon.hh"
12 #include "VuoEditorComposition.hh"
13 #include "VuoEditorWindow.hh"
15 
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 
42 {
44 }
45 
50 {
52 
53  window->resetCompositionWithSnapshot(revertedSnapshot);
54  window->coalesceSnapshots(updatedSnapshot, revertedSnapshot);
55 }
56 
61 {
63 
64  window->resetCompositionWithSnapshot(updatedSnapshot);
65  window->coalesceSnapshots(revertedSnapshot, updatedSnapshot);
66 }