40 setText(QApplication::translate(
"VuoEditorWindow",
"Cable Connection"));
41 this->window = window;
47 this->cableInProgress = cableInProgress;
48 this->displacedCable = displacedCable;
49 this->fromPortForAddedCable = NULL;
50 this->toPortForAddedCable = NULL;
51 this->addedNode = NULL;
52 this->inputEditorManager = inputEditorManager;
55 VuoPort *internalPortToUnpublish = (portToUnpublish? portToUnpublish->
getBase() : NULL);
92 updatedConstantForPort[toPort] = (currentRunningValue? json_object_to_json_string_ext(currentRunningValue, JSON_C_TO_STRING_PLAIN) :
93 revertedConstantForPort[toPort]);
103 revertedFromPortForCable[cableInProgress] = NULL;
104 revertedToPortForCable[cableInProgress] = NULL;
108 updatedToPortForCable[cableInProgress] = targetPort->
getBase();
114 revertedToPortForCable[displacedCable] = displacedCable->
getBase()->
getToPort();
116 updatedFromPortForCable[displacedCable] = NULL;
117 updatedToPortForCable[displacedCable] = NULL;
125 revertedFromPortForCable[cableInProgress] = NULL;
126 revertedToPortForCable[cableInProgress] = NULL;
128 updatedFromPortForCable[cableInProgress] = targetPort->
getBase();
129 updatedToPortForCable[cableInProgress] = cableInProgress->
getBase()->
getToPort();
139 bool mustReconstructRevertedSnapshot = ((currentFromPortForCableInProgress != revertedFromPortForCable[cableInProgress]) ||
140 (currentToPortForCableInProgress != revertedToPortForCable[cableInProgress]));
142 if (mustReconstructRevertedSnapshot)
144 VuoCommandCommon::updateCable(cableInProgress, revertedFromPortForCable[cableInProgress], revertedToPortForCable[cableInProgress], composition,
true);
145 cableInProgress->getBase()->getCompiler()->setAlwaysEventOnly(cableInProgress->getPreviouslyAlwaysEventOnly());
150 if (mustReconstructRevertedSnapshot)
152 cableInProgress->getBase()->getCompiler()->setAlwaysEventOnly(currentAlwaysEventOnlyStatusForCableInProgress);
162 (previousInputPort != targetPort->
getBase()))
171 addedNode = makeListNode;
174 toPortForAddedCable = previousInputPort;
181 inventorySharedValueToBackpropagate();
183 this->operationInvolvesGenericPort = modifiedComponentsIncludeGenericPorts();
190 if (internalPortToUnpublish)
192 bool unpublishIsolatedExternalPorts =
false;
198 VuoCommandCommon::updateCable(cableInProgress, updatedFromPortForCable[cableInProgress], updatedToPortForCable[cableInProgress], composition);
212 for (map<VuoPort *, string>::iterator i = updatedConstantForPort.begin(); i != updatedConstantForPort.end(); ++i)
216 if (revertedConstantForPort[toPort] != updatedConstantForPort[toPort])
255 if (operationInvolvesGenericPort)
260 foreach (
string updatedPortID, updatedPortIDs)
273 if (operationInvolvesGenericPort)
278 foreach (
string updatedPortID, updatedPortIDs)
287 bool VuoCommandConnect::modifiedComponentsIncludeGenericPorts()
289 bool revertedFromPortIsGeneric = (revertedFromPortForCable[cableInProgress] &&
dynamic_cast<VuoGenericType *
>(revertedFromPortForCable[cableInProgress]->getRenderer()->getDataType()));
290 bool revertedToPortIsGeneric = (revertedToPortForCable[cableInProgress] &&
dynamic_cast<VuoGenericType *
>(revertedToPortForCable[cableInProgress]->getRenderer()->getDataType()));
291 bool updatedFromPortIsGeneric = (updatedFromPortForCable[cableInProgress] &&
dynamic_cast<VuoGenericType *
>(updatedFromPortForCable[cableInProgress]->getRenderer()->getDataType()));
292 bool updatedToPortIsGeneric = (updatedToPortForCable[cableInProgress] &&
dynamic_cast<VuoGenericType *
>(updatedToPortForCable[cableInProgress]->getRenderer()->getDataType()));
294 bool revertedDisplacedFromPortIsGeneric = (revertedFromPortForCable[displacedCable] &&
dynamic_cast<VuoGenericType *
>(revertedFromPortForCable[displacedCable]->getRenderer()->getDataType()));
295 bool revertedDisplacedToPortIsGeneric = (revertedToPortForCable[displacedCable] &&
dynamic_cast<VuoGenericType *
>(revertedToPortForCable[displacedCable]->getRenderer()->getDataType()));
296 bool updatedDisplacedFromPortIsGeneric = (updatedFromPortForCable[displacedCable] &&
dynamic_cast<VuoGenericType *
>(updatedFromPortForCable[displacedCable]->getRenderer()->getDataType()));
297 bool updatedDisplacedToPortIsGeneric = (updatedToPortForCable[displacedCable] &&
dynamic_cast<VuoGenericType *
>(updatedToPortForCable[displacedCable]->getRenderer()->getDataType()));
299 bool addedNodeIsGeneric = (addedNode && addedNode->
hasGenericPort());
303 return (revertedFromPortIsGeneric || revertedToPortIsGeneric || updatedFromPortIsGeneric || updatedToPortIsGeneric ||
304 revertedDisplacedFromPortIsGeneric || revertedDisplacedToPortIsGeneric || updatedDisplacedFromPortIsGeneric || updatedDisplacedToPortIsGeneric ||
305 addedNodeIsGeneric || fromPortForAddedCableIsGeneric || toPortForAddedCableIsGeneric);
318 void VuoCommandConnect::inventorySharedValueToBackpropagate()
321 VuoPort *fromPort = updatedFromPortForCable[cableInProgress];
322 VuoPort *toPort = updatedToPortForCable[cableInProgress];
323 bool fromPortIsSharedValue = (fromPort &&
326 bool toPortHasCopyableConstant = (toPort &&
332 bool fromPortHasOtherDataConnections =
false;
336 foreach (
VuoCable *cable, connectedCables)
342 fromPortHasOtherDataConnections =
true;
349 bool shareValueInputPortConstantNotYetSet = shareValueInputPort &&
353 if (fromPortIsSharedValue && toPortHasCopyableConstant && !isReconnection && !fromPortHasOtherDataConnections && cableInProgress->
effectivelyCarriesData() && shareValueInputPortConstantNotYetSet)