Loading...
Searching...
No Matches
EditContext.hpp
1#pragma once
2#include <score/document/DocumentContext.hpp>
3
4#include <QList>
5#include <QObject>
6#include <QVariant>
7
8#include <score_plugin_js_export.h>
9
10#include <memory>
11#include <optional>
12#include <verdigris>
13namespace score
14{
15struct DocumentContext;
16class Command;
17}
18namespace Scenario::Command
19{
20class Macro;
21}
22namespace JS
23{
24class GlobalDeviceEnumerator;
25class SCORE_PLUGIN_JS_EXPORT EditJsContext : public QObject
26{
27 W_OBJECT(EditJsContext)
29
30 std::unique_ptr<Macro> m_macro;
31 struct MacroClear
32 {
34 std::unique_ptr<Macro>& macro;
35 bool clearOnDelete{};
36 ~MacroClear();
37 };
38
39 MacroClear macro(const score::DocumentContext& doc);
40
41public:
44
45 const score::DocumentContext* ctx();
46 W_INVOKABLE(ctx);
47
48 QString deviceToJson(QString addr);
49 W_SLOT(deviceToJson)
50
51 QString deviceToOSCQuery(QString addr);
52 W_SLOT(deviceToOSCQuery)
53
54 void createOSCDevice(QString name, QString host, int in, int out);
55 W_SLOT(createOSCDevice)
56
57 void createQMLWebSocketDevice(QString name, QString text);
58 W_SLOT(createQMLWebSocketDevice)
59
60 void createQMLSerialDevice(QString name, QString port, QString text);
61 W_SLOT(createQMLSerialDevice)
62
63 GlobalDeviceEnumerator* enumerateDevices();
64 W_SLOT(enumerateDevices)
65
66 void createAddress(QString addr, QString type);
67 W_SLOT(createAddress)
68
69 QObject* createProcess(QObject* interval, QString name, QString data);
70 W_SLOT(createProcess)
71
72 void setName(QObject* sel, QString new_name);
73 W_SLOT(setName)
74
75 QObject* createBox(QObject* obj, QString startTime, QString duration, double y);
76 W_SLOT(createBox, (QObject*, QString, QString, double))
77
78 QObject*
79 createBox(QObject* obj, double startTimeFlicks, double durationFlicks, double y);
80 W_SLOT(createBox, (QObject*, double, double, double))
81
82 QObject* createState(QObject* ev, double y);
83 W_SLOT(createState)
84
85 QObject* createIntervalAfter(QObject* obj, QString duration, double y);
86 W_SLOT(createIntervalAfter)
87
88 QObject* createIntervalBetween(QObject* startState, QObject* endState);
89 W_SLOT(createIntervalBetween)
90
91 QObject* port(QObject* obj, QString name);
92 W_SLOT(port)
93
94 QObject* inlet(QObject* obj, int index);
95 W_SLOT(inlet)
96
97 int inlets(QObject* obj);
98 W_SLOT(inlets)
99
100 QObject* outlet(QObject* obj, int index);
101 W_SLOT(outlet)
102
103 int outlets(QObject* obj);
104 W_SLOT(outlets)
105
106 void setAddress(QObject* obj, QString addr);
107 W_SLOT(setAddress)
108
109 void setValue(QObject* obj, double value);
110 W_SLOT(setValue, (QObject*, double))
111
112 void setValue(QObject* obj, QString value);
113 W_SLOT(setValue, (QObject*, QString))
114
115 void setValue(QObject* obj, bool value);
116 W_SLOT(setValue, (QObject*, bool))
117
118 void setValue(QObject* obj, QList<QString> value);
119 W_SLOT(setValue, (QObject*, QList<QString>))
120
121 QString valueType(QObject* obj);
122 W_SLOT(valueType)
123
124 double min(QObject* obj);
125 W_SLOT(min)
126
127 double max(QObject* obj);
128 W_SLOT(max)
129
130 QVector<QString> enumValues(QObject* obj);
131 W_SLOT(enumValues)
132
133 QObject* metadata(QObject* obj) const noexcept;
134 W_SLOT(metadata)
135
136 QObject* startState(QObject* obj);
137 W_SLOT(startState)
138
139 QObject* startEvent(QObject* obj);
140 W_SLOT(startEvent)
141
142 QObject* startSync(QObject* obj);
143 W_SLOT(startSync)
144
145 QObject* endState(QObject* obj);
146 W_SLOT(endState)
147
148 QObject* endEvent(QObject* obj);
149 W_SLOT(endEvent)
150
151 QObject* endSync(QObject* obj);
152 W_SLOT(endSync)
153
154 void remove(QObject* obj);
155 W_SLOT(remove)
156
157 void setCurvePoints(QObject* process, QVector<QVariantList> points);
158 W_SLOT(setCurvePoints)
159
160 void setSteps(QObject* process, QVector<double> points);
161 W_SLOT(setSteps)
162
163 QVariantList messages(QObject* state);
164 W_SLOT(messages)
165
166 void setMessages(QObject* state, QVariantList msgs);
167 W_SLOT(setMessages)
168
169 void replaceAddress(QObjectList objects, QString before, QString after);
170 W_SLOT(replaceAddress)
171
172 void automate(QObject* interval, QString addr);
173 W_SLOT(automate, (QObject*, QString))
174
175 void automate(QObject* interval, QObject* port);
176 W_SLOT(automate, (QObject*, QObject*))
177
178 void startMacro();
179 W_SLOT(startMacro)
180
181 void endMacro();
182 W_SLOT(endMacro)
183
184 void undo();
185 W_SLOT(undo)
186
187 void redo();
188 W_SLOT(redo)
189
190 QObject* find(QString p);
191 W_SLOT(find)
192
193 QObject* findByLabel(QString p);
194 W_SLOT(findByLabel)
195
196 QObject* document();
197 W_SLOT(document)
198
199
200 void play();
201 W_SLOT(play, ())
202
203 void play(QObject* obj);
204 W_SLOT(play, (QObject*))
205
206 void pause();
207 W_SLOT(pause, ())
208
209 void resume();
210 W_SLOT(resume, ())
211
212 void stop();
213 W_SLOT(stop)
214
215 void scrub(double z);
216 W_SLOT(scrub)
217
218
219 QString readFile(QString path);
220 W_SLOT(readFile)
221
222
223 QObject* selectedObject();
224 W_SLOT(selectedObject)
225
226 QVariantList selectedObjects();
227 W_SLOT(selectedObjects)
228
229 void zoom(double zx, double zy);
230 W_SLOT(zoom, (double, double));
231
232 void scroll(double zx, double zy);
233 W_SLOT(scroll, (double, double));
234
236 QVariant prompt(QVariant v);
237 W_SLOT(prompt)
238
239private:
240 void submit(Macro& m, score::Command* c);
241};
242}
243
244W_REGISTER_ARGTYPE(QVector<QVariantList>)
245W_REGISTER_ARGTYPE(QList<QObject*>)
246W_REGISTER_ARGTYPE(JS::GlobalDeviceEnumerator*)
Definition EditContext.hpp:26
Definition DeviceEnumerator.hpp:46
Definition CommandAPI.hpp:28
The Command class.
Definition Command.hpp:34
Base toolkit upon which the software is built.
Definition Application.cpp:90
Definition DocumentContext.hpp:18