16 #include "VuoMovieExporter.hh"
19 #include <dispatch/dispatch.h>
66 void addNode(
VuoNode *node,
bool nodeShouldBeRendered=
true,
bool nodeShouldBeGivenUniqueIdentifier=
true);
107 void run(
string compositionSnapshot);
122 map<string, string>
publishPorts(set<string> portsToPublish);
132 QGraphicsItem *
findNearbyPort(QPointF scenePos,
bool limitPortCollisionRange=
true);
136 QList<QAction *>
getCompatibleTypesForMenu(
VuoRendererPort *genericPort, set<string> compatibleTypesInIsolation, set<string> compatibleTypesInContext,
bool limitToNodeSet,
string nodeSetName=
"", QMenu *menu=NULL);
185 #include "pro/VuoEditorComposition_Pro.hh"
209 void itemsMoved(set<VuoRendererNode *> nodes, set<VuoRendererComment *> comments, qreal dx, qreal dy,
bool movedByDragging);
213 void componentsRemoved(QList<QGraphicsItem *> removedComponents,
string commandDescription=
"Remove");
223 void protocolPortChangesRequested(map<VuoPublishedPort *, string> publishedPortsToRename, set<VuoPublishedPort *> publishedPortsToRemove, vector<VuoPublishedPort *> publishedPortsToAdd,
bool beginUndoStackMacro,
bool endUndoStackMacro);
263 void dropEvent(QGraphicsSceneDragDropEvent *event);
276 void openSelectedEditableNodes();
277 string getNonProtocolVariantForPortName(
string portName);
278 set<string> getRespecializationOptionsForPortInNetwork(
VuoRendererPort *port);
279 bool canConnectDirectlyWithRespecializationNondestructively(
VuoRendererPort *fromPort,
281 bool eventOnlyConnection,
282 bool forwardConnection);
283 bool canConnectDirectlyWithRespecializationNondestructively(
VuoRendererPort *fromPort,
285 bool eventOnlyConnection,
286 bool forwardConnection,
288 string &respecializedTypeName);
291 bool eventOnlyConnection,
292 bool forwardConnection,
294 string &respecializedTypeName);
296 bool portCanBeUnspecializedNondestructively(
VuoPort *port);
300 void fireTriggerPortEvent(
VuoPort *port);
301 QList<QAction *> promoteSingletonsFromSubmenus(QList<QAction *> actionList);
302 static bool nodeSetMenuActionLessThan(QAction *action1, QAction *action2);
303 static bool itemHigherOnCanvas(QGraphicsItem *item1, QGraphicsItem *item2);
308 void disablePopoverForPortThreadSafe(
string portID);
310 void moveDetachedPortPopoversBy(
int dx,
int dy);
311 void moveErrorPopoversBy(
int dx,
int dy);
313 set<VuoErrorPopover *> errorPopovers;
314 bool errorMarkingUpdatesEnabled;
317 void moveNodesBy(set<VuoRendererNode *> nodes, qreal dx, qreal dy,
bool movedByDragging);
318 void moveCommentsBy(set<VuoRendererComment *> comments, qreal dx, qreal dy,
bool movedByDragging);
320 void editSelectedComments();
322 void insertComment();
323 void insertSubcomposition();
324 void deleteConnectedCables();
325 void hideConnectedCables();
326 void unhideConnectedCables();
327 void fireTriggerPortEvent();
328 void setPortConstant();
329 void setTriggerThrottling(
int eventThrottling);
330 void specializeGenericPortType();
331 void unspecializePortType();
333 void removeInputPort();
335 void setDisableDragStickiness(
bool disable);
336 void updatePortAnimation(qreal value);
337 void endPortAnimation(
void);
338 void expandChangeNodeMenu();
341 void updatePopoversForActiveWindowChange(QWidget *old, QWidget *now);
342 void updatePopoversForApplicationStateChange(
bool active);
344 void repositionPopover();
347 static const qreal nodeMoveRate;
348 static const qreal nodeMoveRateMultiplier;
349 static const qreal showEventsModeUpdateInterval;
350 static const int initialChangeNodeSuggestionCount;
359 dispatch_queue_t runCompositionQueue;
360 dispatch_queue_t activePortPopoversQueue;
362 string linkedCompositionPath;
363 std::shared_ptr<VuoRunningCompositionLibraries> runningCompositionLibraries;
364 QAction *contextMenuDeleteSelected;
365 QAction *contextMenuHideSelectedCables;
366 QAction *contextMenuRenameSelected;
367 QAction *contextMenuRefactorSelected;
368 QAction *contextMenuPublishPort;
369 QAction *contextMenuDeleteCables;
370 QAction *contextMenuHideCables;
371 QAction *contextMenuUnhideCables;
372 QAction *contextMenuFireEvent;
373 QAction *contextMenuAddInputPort;
374 QAction *contextMenuRemoveInputPort;
375 QAction *contextMenuSetPortConstant;
376 QAction *contextMenuEditSelectedComments;
377 QMenu *contextMenuChangeNode;
378 QList<QAction *> contextMenuThrottlingActions;
379 QList<QAction *> contextMenuTintActions;
380 bool duplicateOnNextMouseMove;
381 bool duplicationDragInProgress;
382 bool duplicationCancelled;
383 QPointF cursorPosBeforeDuplicationDragMove;
385 bool cableInProgressWasNew;
386 bool cableInProgressShouldBeWireless;
389 bool menuSelectionInProgress;
390 QGraphicsItem *previousNearbyItem;
392 bool dragStickinessDisabled;
393 bool ignoreApplicationStateChangeEvents;
395 QTimer *refreshComponentAlphaLevelTimer;
396 set<QGraphicsItemAnimation *> preparedAnimations;
397 map<QTimeLine *, QGraphicsItemAnimation *> animationForTimeline;
398 string triggerPortToRefire;
401 bool popoverEventsEnabled;
402 map<string, VuoPortPopover *> activePortPopovers;
403 set<string> portsWithPopoversClosedAtLastEvent;
406 void addActionToMenuAndMapper(QMenu *menu, QSignalMapper *mapper, QString name,
int index);
407 void mousePressEventNonLeftButton(QGraphicsSceneMouseEvent *event);
408 void correctForCancelledDuplication(QGraphicsSceneMouseEvent *event);
410 void concludeCableDrag(QGraphicsSceneMouseEvent *event);
411 void concludePublishedCableDrag(QGraphicsSceneMouseEvent *event);
412 void updateHoverHighlighting(QPointF scenePos,
bool disablePortHoverHighlighting=
false);
413 void highlightEligibleEndpointsForCable(
VuoCable *cable);
415 void updateEligibilityHighlightingForPort(
VuoRendererPort *portToHighlight,
VuoRendererPort *fixedPort,
bool eventOnlyConnection, map<string, VuoCompilerType *> &types);
417 bool selectBridgingSolutionFromOptions(vector<string> suitableTypecasts, map<string, VuoRendererPort *> portToSpecializeForTypecast, map<string, string> specializedTypeNameForTypecast,
string &selectedTypecast);
418 vector<string>
findBridgingSolutions(
VuoRendererPort *fromPort,
VuoRendererPort *toPort,
bool toPortIsDragDestination, map<string, VuoRendererPort *> &portToSpecializeForTypecast, map<string, string> &specializedTypeNameForTypecast, map<string, VuoCompilerType *> &types);
419 bool promptForBridgingSelectionFromOptions(vector<string> suitableTypecasts, map<string, VuoRendererPort *> portToSpecializeForTypecast, map<string, string> specializedTypeNameForTypecast,
string &selectedTypecast);
420 QString getDisplayTextForSpecializationOption(
VuoRendererPort *portToSpecialize,
string specializedTypeName);
421 bool hasFeedbackErrors(
void);
422 void buildComposition(
string compositionSnapshot,
const set<string> &dependenciesUninstalled = set<string>());
423 bool isRunningThreadUnsafe(
void);
424 string getIdentifierForRunningPort(
VuoPort *port);
425 void moveItemsBy(set<VuoRendererNode *> nodes, set<VuoRendererComment *> comments, qreal dx, qreal dy,
bool movedByDragging);
426 void setPopoversHideOnDeactivate(
bool shouldHide);
428 QGraphicsItemAnimation * setUpAnimationForPort(QGraphicsItemAnimation *animation,
VuoRendererPort *port);
430 QGraphicsItemAnimation * getAvailableAnimationForPort(
VuoRendererPort *port);
432 friend class TestVuoEditor;