Vuo  2.0.3
VuoCommandCommon.hh
Go to the documentation of this file.
1 
10 #pragma once
11 
12 class VuoCompiler;
16 class VuoEditorWindow;
17 class VuoNode;
18 class VuoPort;
19 class VuoPublishedPort;
20 class VuoRendererCable;
21 class VuoRendererNode;
22 
26 class VuoCommandCommon : public QUndoCommand
27 {
28 public:
29  static const int moveCommandID = 1;
30  static const int addCommandID = 2;
31  static const int removeCommandID = 3;
32  static const int connectCommandID = 4;
33  static const int setPortConstantCommandID = 5;
34  static const int setNodeTitleCommandID = 6;
35  static const int setPublishedPortNameCommandID = 7;
36  static const int publishPortCommandID = 8;
37  static const int unpublishPortCommandID = 9;
38  static const int setItemTintCommandID = 10;
39  static const int replaceNodeCommandID = 11;
40  static const int setTriggerThrottlingCommandID = 12;
41  static const int setPublishedPortDetailsCommandID = 13;
42  static const int setCableHiddenCommandID = 14;
43  static const int addPublishedPortCommandID = 15;
44  static const int removeProtocolPortCommandID = 16;
45  static const int reorderPublishedPortsCommandID = 17;
46  static const int setMetadataCommandID = 18;
47  static const int setCommentTextCommandID = 19;
48  static const int resizeCommentCommandID = 20;
49  static const int changeNodeCommandID = 21;
50 
51  static void addCable(VuoRendererCable *rc, VuoPort *fromPortAfterAdding, VuoPort *toPortAfterAdding, VuoEditorComposition *composition);
52  static void removeCable(VuoRendererCable *rc, VuoEditorComposition *composition);
53  static void updateCable(VuoRendererCable *rc, VuoPort *updatedFromPort, VuoPort *updatedToPort, VuoEditorComposition *composition, bool preserveDanglingCables=false);
54 
55  static VuoPublishedPort * publishInternalPort(VuoPort *internalPort, bool forceEventOnlyPublication, string publishedPortName, VuoEditorComposition *composition, bool attemptMerge);
56  static VuoPublishedPort * publishInternalExternalPortCombination(VuoPort *internalPort, VuoPublishedPort *externalPort, bool forceEventOnlyPublication, VuoEditorComposition *composition);
57  static void unpublishInternalExternalPortCombination(VuoPort *internalPort, VuoPublishedPort *externalPort, VuoEditorComposition *composition, bool unpublishIsolatedExternalPorts);
58  static VuoCompilerCompositionDiff * addNodeReplacementToDiff(VuoCompilerCompositionDiff *diffInfo, VuoRendererNode *oldNode, VuoRendererNode *newNode, map<VuoPort *, VuoPort *> updatedPortForOriginalPort, VuoEditorComposition *composition);
59 
62  void setDescription(const char *formatString, ...) __attribute__((format(printf, 2, 3)));
63 
64 protected:
66  char *description;
67 
68 private:
69  static bool compositionContainsNode(VuoEditorComposition *composition, VuoNode *node);
70 };
71 
77 #define VuoCommandCommon_redo \
78  if (description) \
79  VUserLog("%s: %s", window->getWindowTitleWithoutPlaceholder().toUtf8().data(), description)
80 
86 #define VuoCommandCommon_undo \
87  if (description) \
88  VUserLog("%s: Undo %s", window->getWindowTitleWithoutPlaceholder().toUtf8().data(), description)