Vuo
0.4.1
|
Handles drags-and-drops and performs node instantiation for the editor window.
Public Types | |
enum | targetComponentType { targetTypePort, targetTypeAny } |
Specifies the desired type of composition component to be returned from a search. | |
Public Slots | |
void | deleteSelectedCompositionComponents (string commandDescription="Delete") |
Deletes currently selected nodes and cables. | |
void | togglePortPublicationStatus () |
Publishes or unpublishes the port associated with the sender, as appropriate. | |
void | tintSelectedNodes (int tintColor) |
Sets the tint color of the selected nodes to tintColor . | |
void | selectAllCompositionComponents () |
Selects all nodes and cables on the canvas. | |
void | selectAllNodes () |
Selects all nodes on the canvas. | |
void | selectAllCables () |
Selects all cables on the canvas. | |
void | deselectAllCompositionComponents () |
Deselects all nodes and cables on the canvas. | |
void | moveSelectedNodesBy (qreal dx, qreal dy) |
Moves currently selected nodes dx points horizontally and dy points vertically. | |
void | updatePublishedCableGeometry () |
Prepares all published cables in the composition for geometry changes. | |
Signals | |
void | leftMouseButtonReleased (void) |
Emitted when the left mouse button is released. | |
void | nodesMoved (set< VuoRendererNode * > nodes, qreal dx, qreal dy, bool movedByDragging) |
Emitted in order to move nodes. | |
void | selectedComponentsDuplicated () |
Emitted in order to duplicate components. | |
void | componentsAdded (QList< QGraphicsItem * > addedComponents, VuoEditorComposition *target) |
Emitted in order to add components. | |
void | componentsRemoved (QList< QGraphicsItem * > removedComponents, string commandDescription="Remove") |
Emitted in order to remove components. | |
void | portPublicationRequested (VuoPort *port) |
Emitted when a port is to be published. | |
void | portUnpublicationRequested (VuoPort *port) |
Emitted when a port is to be unpublished. | |
void | highlightPublishedPortDropLocationsRequested (VuoRendererPort *port) |
Emitted when eligible published port sidebar drop locations for port should be visually highlighted. | |
void | clearPublishedPortDropLocationHighlightingRequested () |
Emitted when eligible published port sidebar drop locations should no longer be highlighted. | |
void | connectionCompleted (VuoRendererCable *cableInProgress, VuoRendererPort *targetPort, VuoRendererCable *previousConnectedCable, VuoRendererPort *portToUnpublish, string typecastToInsert) |
Emitted after a cable has been connected to a node. | |
void | duplicationOperationCancelled () |
Emitted in order to cancel duplication of components. | |
void | dataEditorRequested (VuoRendererPort *port) |
Emitted in order to display a data editor. | |
void | nodeTitleEditorRequested (VuoRendererNode *node) |
Emitted in order to display a node title editor. | |
void | tintSelectedNodesRequested (VuoNode::TintColor tintColor) |
Emitted when the user requests that the selected nodes be tinted. | |
Public Member Functions | |
VuoEditorComposition (VuoComposition *baseComposition) | |
Creates an empty canvas upon which nodes and cables can be rendered. | |
void | setCompiler (VuoCompiler *compiler) |
Specifies a compiler instance to be used by this composition (for, e.g., instantiating dropped nodes). | |
VuoRendererNode * | createNode (QString nodeClassName, string displayName="", double x=0, double y=0) |
Instantiates a node of class name nodeClassName . | |
void | removeNode (VuoRendererNode *rn) |
Removes a node from the canvas and disables all of its associated port popovers. | |
QAction * | getContextMenuDeleteSelectedAction (void) |
Returns the context menu's action that deletes a component. | |
QMenu * | getContextMenuTints (QMenu *parent=0) |
Returns the context menu's "Tint" submenu. | |
set< VuoRendererCable * > | getCablesInternalToSubcomposition (QList< QGraphicsItem * > subcompositionComponents) |
Returns the set of cables creating internal connections within the set of input subcompositionComponents . | |
VuoCable * | getCableInProgress () |
Returns the cable currently being dragged, or NULL if no cable is currently being dragged. | |
QGraphicsItem * | findNearbyComponent (QPointF scenePos, targetComponentType componentType=VuoEditorComposition::targetTypeAny, bool limitPortCollisionRange=true) |
Returns a pointer to the component (port, cable, or node) that should be operated upon if the user were to click at position scenePos , or NULL if no component is within collision range. | |
QRectF | internalItemsBoundingRect () const |
Calculates and returns the bounding rect of all internal composition components on the scene. | |
void | cancelCableDrag (void) |
Cancel the current cable drag operation, if applicable. | |
void | clearHoverHighlighting () |
Clear hover-highlighting of the previously highlighted graph component. | |
void | run (string compositionSnapshot) |
Asynchronously compiles, links, and runs a composition created from the snapshot. | |
void | stop (void) |
Asynchronously stops the running composition. | |
bool | isRunning (void) |
Returns true if the composition is running. | |
void | updateRunningComposition (string oldCompositionSnapshot, string newCompositionSnapshot) |
Asynchronously replaces the running composition (if any) with a composition created from newCompositionSnapshot . | |
void | updatePortConstantInRunningComposition (VuoCompilerInputEventPort *port, string constant) |
If the composition is running, tells the composition to set a new constant value on the port. | |
string | takeSnapshot (void) |
Returns a string representation of the composition (to save its current state). | |
void | disablePortPopovers (VuoRendererNode *node=NULL) |
Disables the port popovers associated with this composition. | |
void | blockDisablingOfPopoverForPort (VuoRendererPort *port) |
Prevents the popover associated with the provided port from being disabled until unblockDisablingOfPopoverForPort() is called for the same port. | |
void | unblockDisablingOfPopoverForPort (VuoRendererPort *port) |
Removes the bar against disabling the popover for the provided port , if applicable, and schedules the popover to be disabled if the cursor is no longer within the extended hover range of the port. | |
void | receivedTelemetryInputPortUpdated (string portIdentifier, bool receivedEvent, bool receivedData, string dataAsString) |
This delegate method is invoked every time any input port receives an event or data. | |
void | receivedTelemetryOutputPortUpdated (string portIdentifier, bool sentData, string dataAsString) |
This delegate method is invoked every time any output port conducts or fires an event. | |
![]() | |
VuoRendererComposition (VuoComposition *baseComposition, bool renderMissingAsPresent=false) | |
Creates a canvas upon which nodes and cables can be rendered. | |
void | setBackgroundTransparent (bool transparent) |
Sets whether the composition should be rendered with a transparent background. | |
VuoRendererNode * | createRendererNode (VuoNode *baseNode) |
Creates a renderer detail for the base node. | |
void | addNode (VuoNode *node) |
Adds a node to the canvas and the underlying composition. | |
void | addCable (VuoCable *cable) |
Adds a cable to the canvas and the underlying composition. | |
void | addPublishedInputCable (VuoCable *c) |
Adds a published input cable to the canvas and the underlying composition. | |
void | addPublishedOutputCable (VuoCable *c) |
Adds a published output cable to the canvas and the underlying composition. | |
void | removeNode (VuoRendererNode *rn) |
Removes a node from the canvas. | |
void | removeCable (VuoRendererCable *rc) |
Removes a cable from the canvas. | |
void | removePublishedInputCable (VuoRendererCable *rc) |
Removes a published input cable from the canvas and underlying composition. | |
void | removePublishedOutputCable (VuoRendererCable *rc) |
Removes a published output cable from the canvas and underlying composition. | |
VuoRendererPublishedPort * | publishPort (VuoPort *port, string name="", bool attemptMerge=false) |
Publishes this composition's internal port under the provided name , if possible; returns a pointer to the VuoRendererPublishedPort aliased to the internal port. | |
VuoCable * | createPublishedCable (VuoPort *vuoPseudoPort, VuoPort *internalPort) |
Creates a published cable connecting published pseudo-port vuoPort with internal port internalPort (in whichever direction appropriate). | |
void | registerExternalPublishedPort (VuoPublishedPort *publishedPort, bool isInput) |
Registers a previously existing VuoPublishedPort as one of this composition's published ports. | |
int | unregisterExternalPublishedPort (VuoPublishedPort *publishedPort, bool isInput) |
Removes a published input or output VuoRendererPublishedPort from the list of published ports associated with this composition. | |
void | setPublishedPortName (VuoRendererPublishedPort *publishedPort, string name) |
Sets the name of the provided publishedPort to name ; updates the composition's published pseudo-node and connected published cables accordingly. | |
string | getUniquePublishedPortName (string baseName, bool isInput) |
Returns a string derived from the input baseName that is guaranteed to be unique either among the published input port names or among the published output port names for this composition, as specified by isInput . | |
vector< VuoRendererTypecastPort * > | collapseTypecastNodes (void) |
Once all nodes and cables have been added to the scene, call this to convert each freestanding typecast node into a mini-node attached to its destination node. | |
VuoRendererTypecastPort * | collapseTypecastNode (VuoRendererNode *rn) |
Convert a freestanding typecast node into a mini-node attached to its destination node; returns a pointer to the newly collapsed node. | |
void | uncollapseTypecastNode (VuoRendererNode *typecastNode) |
Convert the collapsed typecast mini-node associated with the input typecastNode back into freestanding form. | |
VuoRendererNode * | uncollapseTypecastNode (VuoRendererTypecastPort *typecast) |
Convert a collapsed typecast mini-node back into a freestanding node. | |
void | clearInternalPortEligibilityHighlighting (void) |
Removes connection eligibility highlighting from all ports in the scene. | |
![]() | |
VuoBaseDetail (string description, VuoComposition *base) | |
Creates a VuoComposition detail class. | |
VuoComposition * | getBase (void) const |
Returns the VuoComposition detail class instance's base class instance. | |
void | setBase (VuoComposition *base) |
Sets the VuoComposition detail class instance's base class instance. | |
Protected Member Functions | |
void | dragEnterEvent (QGraphicsSceneDragDropEvent *event) |
Decide whether we can accept the dragged data. | |
void | dragLeaveEvent (QGraphicsSceneDragDropEvent *event) |
Decide what to do with the dragged data as it leaves. | |
void | dragMoveEvent (QGraphicsSceneDragDropEvent *event) |
Decide what to do with the moved drag-drop data. | |
void | dropEvent (QGraphicsSceneDragDropEvent *event) |
Handle the dropped data. | |
void | mouseDoubleClickEvent (QGraphicsSceneMouseEvent *event) |
Handle mouse double-click events. | |
void | mousePressEvent (QGraphicsSceneMouseEvent *event) |
Handle mouse press events. | |
void | mouseReleaseEvent (QGraphicsSceneMouseEvent *event) |
Handle mouse release events. | |
void | mouseMoveEvent (QGraphicsSceneMouseEvent *event) |
Handle mouse move events. | |
void | keyPressEvent (QKeyEvent *event) |
Handle keypress events. | |
void | contextMenuEvent (QGraphicsSceneContextMenuEvent *event) |
Display the context menu for a node, port, or cable. | |
Additional Inherited Members | |
![]() | |
static void | createAutoreleasePool (void) |
As a workaround for a bug in Qt 5.1.0-beta1 (https://b33p.net/kosada/node/4905), this function must be called to create the NSAutoreleasePool for a QApplication. | |
![]() | |
VuoCompilerGraphvizParser * | parser |
The Graphviz parser instance used by this composition. | |
map< string, VuoRendererNode * > | nodeNameTaken |
An index of every node in the composition, keyed by the node's Graphviz identifier. | |
VuoRendererSignaler * | signaler |
The Qt signaler used by this composition. | |
void VuoEditorComposition::blockDisablingOfPopoverForPort | ( | VuoRendererPort * | port | ) |
Prevents the popover associated with the provided port
from being disabled until unblockDisablingOfPopoverForPort() is called for the same port.
In the meantime, no other port will be permitted to display its non-detached popover.
void VuoEditorComposition::disablePortPopovers | ( | VuoRendererNode * | node = NULL | ) |
Disables the port popovers associated with this composition.
If an input node
is provided, only popovers whose ports belong to that node are disabled.
QGraphicsItem * VuoEditorComposition::findNearbyComponent | ( | QPointF | scenePos, |
targetComponentType | targetType = VuoEditorComposition::targetTypeAny , |
||
bool | limitPortCollisionRange = true |
||
) |
Returns a pointer to the component (port, cable, or node) that should be operated upon if the user were to click at position scenePos
, or NULL if no component is within collision range.
The input targetType
specifies what type of component to search for. Options are: VuoEditorComposition::targetTypePort (to include only ports) VuoEditorComposition::targetTypeAny (to include ports, cables, and nodes) If limitPortCollisionRange
is true, only the port circle and constant value flag, not the port's boundingRect as a whole, are taken into account for purposes of collision detection.
QRectF VuoEditorComposition::internalItemsBoundingRect | ( | ) | const |
Calculates and returns the bounding rect of all internal composition components on the scene.
This excludes published cables.
bool VuoEditorComposition::isRunning | ( | void | ) |
Returns true if the composition is running.
This function must not be called on runCompositionQueue
.
|
virtual |
This delegate method is invoked every time any input port receives an event or data.
Implementation of the virtual VuoRunnerDelegate function.
Implements VuoRunnerDelegate.
|
virtual |
This delegate method is invoked every time any output port conducts or fires an event.
Implementation of the virtual VuoRunnerDelegate function.
Implements VuoRunnerDelegate.
void VuoEditorComposition::run | ( | string | compositionSnapshot | ) |
Asynchronously compiles, links, and runs a composition created from the snapshot.
Assumes the composition is not already running.
void VuoEditorComposition::stop | ( | void | ) |
Asynchronously stops the running composition.
Assumes the composition is running.
void VuoEditorComposition::unblockDisablingOfPopoverForPort | ( | VuoRendererPort * | port | ) |
Removes the bar against disabling the popover for the provided port
, if applicable, and schedules the popover to be disabled if the cursor is no longer within the extended hover range of the port.
Other ports will once again be permitted to display their own non-detached popovers.
void VuoEditorComposition::updateRunningComposition | ( | string | oldCompositionSnapshot, |
string | newCompositionSnapshot | ||
) |
Asynchronously replaces the running composition (if any) with a composition created from newCompositionSnapshot
.
oldCompositionSnapshot | A snapshot of the currently running composition (which may include minor changes made since the composition was last run/updated, for which the running composition did not need to be updated). |
newCompositionSnapshot | A snapshot of the composition to run. |