Loading...
Searching...
No Matches
Inheritance diagram for JS::EditJsContext:

Public Member Functions

const score::DocumentContext * ctx ()
 Global ////.
 
QJSValue controls () const noexcept
 The published objects of the current document, by name.
 
QJSValue triggers () const noexcept
 
QJSValue conditions () const noexcept
 
void setNamespaces (QJSValue ns)
 Set from ScriptableNames::makeNamespaces, on this object's engine.
 
QObject * device (QString name)
 Devices ///.
 
QVariant deviceSettings (QString name)
 
QString deviceToJson (QString addr)
 
QString deviceToOSCQuery (QString addr)
 
void createDevice (QString name, QString uuid, QJSValue obj)
 
void createDevice (QString name, QString uuid, QVariant obj)
 
void createOSCDevice (QString name, QString host, int in, int out)
 
void connectOSCQueryDevice (QString name, QString host)
 
void removeDevice (QString name)
 
void disconnectDevice (QString name)
 
void reconnectDevice (QString name)
 
void createQMLWebSocketDevice (QString name, QString text)
 
void createQMLSerialDevice (QString name, QString port, QString text)
 
GlobalDeviceEnumerator * enumerateDevices ()
 
GlobalDeviceEnumerator * enumerateDevices (const QString &protocol)
 
GlobalDeviceEnumerator * enumerateDevices (const QStringList &protocols)
 
DeviceListener * listenDevice (const QString &name)
 
void iterateDevice (const QString &name, const QJSValue &op)
 
void setDeviceLearn (const QString &name, bool learn)
 
void createAddress (QString addr, QString type)
 Processes ///.
 
void setUnit (QString addr, QString unit)
 
QObject * createProcess (QObject *interval, QString name, QString data)
 
int processes (QObject *obj)
 Number of processes hosted by an interval or a state.
 
QObject * process (QObject *obj, int index)
 
QObject * parentProcess (QObject *obj)
 
QObject * parentInterval (QObject *obj)
 
void loadPreset (QObject *process, QString json)
 
QString savePreset (QObject *process)
 
void setName (QObject *sel, QString new_name)
 
void setComment (QObject *sel, QString comment)
 Set an object's comment, as an undoable command.
 
QObject * createBox (QObject *obj, QString startTime, QString duration, double y)
 
QObject * createBox (QObject *obj, double startTimeFlicks, double durationFlicks, double y)
 
QObject * createState (QObject *ev, double y)
 
QObject * createIntervalAfter (QObject *obj, QString duration, double y)
 
QObject * createIntervalBetween (QObject *startState, QObject *endState)
 
void enableTrigger (QObject *obj)
 
void disableTrigger (QObject *obj)
 
void enableCondition (QObject *obj)
 
void disableCondition (QObject *obj)
 
void setExpression (QObject *obj, QString expression)
 
QString expression (QObject *obj)
 
void setScriptable (QObject *obj, bool scriptable)
 Publishes obj under score:/controls, score:/triggers or score:/conditions.
 
QString scriptableAddress (QObject *obj)
 
void trigger (QObject *obj)
 
void setIntervalDuration (QObject *object, TimeVal flicks)
 
void setIntervalMinDuration (QObject *object, TimeVal flicks)
 
void setIntervalMaxDuration (QObject *object, TimeVal flicks)
 
void setIntervalMaxInfinite (QObject *object, bool)
 
void setIntervalSpeed (QObject *object, double)
 
void setAutoTrigger (QObject *timeSync, bool)
 
void setProcessLoop (QObject *process, bool)
 
QObject * port (QObject *obj, QString name)
 
QObject * inlet (QObject *obj, int index)
 
QObject * inlet (QObject *obj, QString name)
 An inlet of a process by name, or null.
 
int inlets (QObject *obj)
 
QObject * outlet (QObject *obj, int index)
 
QObject * outlet (QObject *obj, QString name)
 An outlet of a process by name, or null.
 
int outlets (QObject *obj)
 
QObject * createCable (QObject *outlet, QObject *inlet)
 
QObject * createCable (QObject *outlet, QObject *inlet, Process::CableType type)
 
QObject * cable (QObject *port, int index)
 The index-th cable attached to a port. Works for inlets and outlets alike.
 
int cables (QObject *port)
 Number of cables attached to a port. Works for inlets and outlets alike.
 
QObject * source (QObject *cable)
 The outlet a cable starts from, or null if it no longer resolves.
 
QObject * sink (QObject *cable)
 The inlet a cable ends at, or null if it no longer resolves.
 
QObject * cable (QObject *outlet, QObject *inlet)
 The cable joining an outlet to an inlet, or null if there is none.
 
void setAddress (QObject *obj, QString addr)
 
void setPropagate (QObject *obj, bool propagate)
 
void setValue (QObject *obj, double value)
 
void setValue (QObject *obj, QVector2D value)
 
void setValue (QObject *obj, QVector3D value)
 
void setValue (QObject *obj, QVector4D value)
 
void setValue (QObject *obj, QString value)
 
void setValue (QObject *obj, bool value)
 
void setValue (QObject *obj, int value)
 
void setValue (QObject *obj, QList< QString > value)
 
void setValue (QObject *obj, QList< qreal > value)
 
void setValue (QObject *obj, QList< QVariant > value)
 
void editValue (QObject *obj, QVariant value)
 
void commitEdit ()
 Put the edit in progress on the undo stack; nothing if there is none.
 
bool pushExecutionValue (QObject *port, QVariant value)
 
QString portName (QObject *port)
 
QString valueType (QObject *obj)
 
double min (QObject *obj)
 
double max (QObject *obj)
 
QVector< QVariant > enumValues (QObject *obj)
 
QObject * metadata (QObject *obj) const noexcept
 
QObject * documentMetadata () const noexcept
 
QString documentName () const noexcept
 
void setDocumentName (QString name)
 Renames the document. Not a save: it sets the name the next save uses.
 
QObject * startState (QObject *obj)
 
QObject * startEvent (QObject *obj)
 
QObject * startSync (QObject *obj)
 
QObject * endState (QObject *obj)
 
QObject * endEvent (QObject *obj)
 
QObject * endSync (QObject *obj)
 
void remove (QObject *obj)
 
void setCurvePoints (QObject *process, QVector< QVariantList > points)
 
void setSteps (QObject *process, QVector< double > points)
 
QVariantList messages (QObject *state)
 
void setMessages (QObject *state, QVariantList msgs)
 
void replaceAddress (QObjectList objects, QString before, QString after)
 
QVariantList automate (QObject *interval, QString addr)
 
QObject * automate (QObject *interval, QObject *port)
 
void startMacro ()
 Undo-redo ///.
 
void withMacro (QJSValue fn)
 
void endMacro ()
 
void registerCommandHandler (QString name, QJSValue fn)
 
void pushCommand (QString name, QJSValue undoPayload, QJSValue redoPayload)
 
void undo ()
 
void redo ()
 
bool canUndo ()
 
bool canRedo ()
 
int undoIndex ()
 Number of commands that can still be undone (the stack's current index).
 
int undoCount ()
 Total number of commands on the stack.
 
QString undoText ()
 Description of the command the next undo()/redo() would apply, or "".
 
QString redoText ()
 
void load (QString path)
 
void save ()
 
void saveAs (QString path)
 
QVariantList consolidate (bool collectLibraryFiles)
 
QString archive (QString zipPath, bool collectLibraryFiles)
 
QObject * find (QString p)
 Document ///.
 
QObject * findByLabel (QString p)
 
QObjectList references (QObject *obj)
 The states, ports, events and syncs holding an address anchored to obj.
 
QObjectList targets (QObject *obj)
 The objects the addresses of a state, port, event or sync are anchored to.
 
void rebind (QObject *obj, QString from, QString to)
 Points the addresses from held by the object at to
 
QString path (QObject *obj)
 
QObject * findByPath (QString path)
 
QObject * document ()
 
QObject * rootInterval ()
 
QObject * documentPlugin (QString key)
 
void play ()
 Execution ///.
 
void play (QObject *obj)
 
void playFromHere (double ms)
 
void playIntervalFromHere (QObject *interval, double ms)
 
void pause ()
 
void resume ()
 
void stop ()
 
void stop (QObject *obj)
 As the stop button of an interval: the rest of the score keeps playing.
 
void reinitialize ()
 
void scrub (double z)
 
QObject * transport ()
 
QString readFile (QString path)
 File API ///.
 
QString relativizeFilePath (QString path)
 
QString locateFilePath (QString path)
 
QObject * selectedObject ()
 Score UI ///.
 
QVariantList selectedObjects ()
 
void select (QObject *obj)
 
void select (QVariantList objs)
 
void zoom (double zx, double zy)
 
void scroll (double zx, double zy)
 
QVariant prompt (QVariant v)
 Custom UI ///.
 
bool hasProcessUI (QObject *process)
 
void showProcessUI (QObject *process, bool show)
 
bool hasProcessScriptEditor (QObject *process)
 
void showProcessScriptEditor (QObject *process, bool show)
 
void setProcessScriptEditorPlacement (QObject *process, QString placement)
 "Window", "Side panel", "Central" or "" for the user's default
 
void setProcessUIPlacement (QObject *process, QString placement)
 
QVariantMap availableProcesses () const noexcept
 Introspection ///.
 
QVariant availableProcessesAndPresets () const noexcept
 
QVariantList libraryEntries (QString filter) const noexcept
 
QVariant availableProtocols () const noexcept
 
QByteArray serializeAsJson () noexcept
 

Static Public Member Functions

static void w_GetAccessSpecifierHelper (std::integral_constant< decltype((&W_ThisType::ctx)), &W_ThisType::ctx >)
 
static void w_GetAccessSpecifierHelper (std::integral_constant< decltype((&W_ThisType::transport)), &W_ThisType::transport >)
 

Friends

constexpr auto w_state (w_internal::Index< w_internal::stateCount< __COUNTER__, w_internal::MethodStateTag, W_ThisType ** > >, w_internal::MethodStateTag, W_ThisType **) -> decltype((w_internal::makeMetaMethodInfo((&W_ThisType::ctx), w_internal::viewLiteral("ctx"), std::integral_constant< decltype((&W_ThisType::ctx)), &W_ThisType::ctx >(), w_internal::viewParsedLiterals< w_internal::countParsedLiterals("" "")>("" ""), w_internal::W_EmptyFlag)))
 
constexpr auto w_state (w_internal::Index< w_internal::stateCount< __COUNTER__, w_internal::PropertyStateTag, W_ThisType ** > >, w_internal::PropertyStateTag, W_ThisType **) -> decltype((w_internal::makeMetaPropertyInfo< QJSValue >(w_internal::viewLiteral("Controls"), w_internal::viewLiteral("QJSValue"), &W_ThisType::controls)))
 
constexpr auto w_state (w_internal::Index< w_internal::stateCount< __COUNTER__, w_internal::PropertyStateTag, W_ThisType ** > >, w_internal::PropertyStateTag, W_ThisType **) -> decltype((w_internal::makeMetaPropertyInfo< QJSValue >(w_internal::viewLiteral("Triggers"), w_internal::viewLiteral("QJSValue"), &W_ThisType::triggers)))
 
constexpr auto w_state (w_internal::Index< w_internal::stateCount< __COUNTER__, w_internal::PropertyStateTag, W_ThisType ** > >, w_internal::PropertyStateTag, W_ThisType **) -> decltype((w_internal::makeMetaPropertyInfo< QJSValue >(w_internal::viewLiteral("Conditions"), w_internal::viewLiteral("QJSValue"), &W_ThisType::conditions)))
 
constexpr auto w_state (w_internal::Index< w_internal::stateCount< __COUNTER__, w_internal::MethodStateTag, W_ThisType ** > >, w_internal::MethodStateTag, W_ThisType **) -> decltype((w_internal::makeMetaMethodInfo((&W_ThisType::transport), w_internal::viewLiteral("transport"), std::integral_constant< decltype((&W_ThisType::transport)), &W_ThisType::transport >(), w_internal::viewParsedLiterals< w_internal::countParsedLiterals("" "")>("" ""), w_internal::W_EmptyFlag)))
 

Member Function Documentation

◆ archive()

QString JS::EditJsContext::archive ( QString  zipPath,
bool  collectLibraryFiles 
)

As File > Project files > Archive: consolidates, saves, then writes the project into zipPath. Returns an empty string, or the error.

◆ automate() [1/2]

QObject * JS::EditJsContext::automate ( QObject *  interval,
QObject *  port 
)

Create an automation in interval driving port, and cable it up. Returns the created process, whose default curve is a 0 -> 1 ramp.

◆ automate() [2/2]

QVariantList JS::EditJsContext::automate ( QObject *  interval,
QString  addr 
)

Create automations for every parameter matching addr in interval. Returns the created processes: an address may expand to several curves.

◆ canUndo()

bool JS::EditJsContext::canUndo ( )

Undo-stack introspection. Mirroring the stack script-side desynchronises as soon as a macro commits nothing, or a document is loaded behind it.

◆ consolidate()

QVariantList JS::EditJsContext::consolidate ( bool  collectLibraryFiles)

As File > Project files > Consolidate: copies every file the document uses next to it, rewrites the references and saves. Returns one {path, newPath, source, action, note} entry per reference.

◆ deviceSettings()

QVariant JS::EditJsContext::deviceSettings ( QString  name)

An existing device's settings as a JS object - {Name, Protocol} plus the protocol's own keys, as the document saves them. createDevice() accepts the same object, taking the name and protocol from its own arguments.

◆ disconnectDevice()

void JS::EditJsContext::disconnectDevice ( QString  name)

As the device explorer's Disconnect / Reconnect (the device stays in the tree), but also allowed while playing.

◆ documentMetadata()

QObject * JS::EditJsContext::documentMetadata ( ) const
noexcept

The document's own metadata, which is not a child of anything the other accessors reach. Its fileName, author, creation and lastEdition are properties, so they read and write from QML directly.

◆ documentName()

QString JS::EditJsContext::documentName ( ) const
noexcept

What the title bar shows: the file's base name, or "Untitled..." before it has been saved anywhere.

◆ editValue()

void JS::EditJsContext::editValue ( QObject *  obj,
QVariant  value 
)

An edit still in progress, such as a slider being dragged: every call of one gesture updates the same command, and commitEdit() puts it on the undo stack as one step - what score's own control widgets do between press and release. Editing another control first commits the previous edit, so a gesture whose end was lost does not leak into the next one.

◆ enumerateDevices()

GlobalDeviceEnumerator * JS::EditJsContext::enumerateDevices ( const QString &  protocol)

protocol is either a protocol's user-visible name ("OSC", "DMX", "Camera") or its factory UUID; only that protocol's enumerators run.

◆ parentInterval()

QObject * JS::EditJsContext::parentInterval ( QObject *  obj)

The interval an object belongs to, or null. A process gives the interval hosting it; an interval gives itself.

◆ parentProcess()

QObject * JS::EditJsContext::parentProcess ( QObject *  obj)

The process an object belongs to: the process itself if given one, else the closest process ancestor. Ports, layers and cable endpoints all resolve through this.

◆ playFromHere()

void JS::EditJsContext::playFromHere ( double  ms)

As "Play from here" on the time ruler: from the date in milliseconds, or there while already playing.

◆ playIntervalFromHere()

void JS::EditJsContext::playIntervalFromHere ( QObject *  interval,
double  ms 
)

Play from here at ms into interval, as from a view of it: while the score plays, that interval alone goes there.

◆ port()

QObject * JS::EditJsContext::port ( QObject *  obj,
QString  name 
)

A port of a process by name, inlets first. Prefer inlet() / outlet() when a process has an input and an output sharing a name.

◆ process()

QObject * JS::EditJsContext::process ( QObject *  obj,
int  index 
)

The index-th process of an interval or a state. Index 0 is the most recently added one; the order is stable but is not timeline order.

◆ pushCommand()

void JS::EditJsContext::pushCommand ( QString  name,
QJSValue  undoPayload,
QJSValue  redoPayload 
)

Push an undoable edit the engine knows nothing about - state that lives in the script or outside the process. The payloads are JSON-serialisable values handed back to the handler on redo and on undo; the command stores them rather than closures, so it survives the crash-recovery backup. Pushing applies the edit: the redo payload is replayed immediately, and inside an open macro it undoes together with the engine edits around it.

◆ registerCommandHandler()

void JS::EditJsContext::registerCommandHandler ( QString  name,
QJSValue  fn 
)

Register the handler fn that pushCommand("name", ...) replays against. Registering a name twice replaces it.

◆ setExpression()

void JS::EditJsContext::setExpression ( QObject *  obj,
QString  expression 
)

The expression of what obj resolves to: the trigger for a time sync or an interval (its end), the condition for an event or a state. Addresses are written between % signs, e.g. "{ %osc:/x% > 0.5 }".

◆ setPropagate()

void JS::EditJsContext::setPropagate ( QObject *  obj,
bool  propagate 
)

Whether an audio outlet is cabled to its parent interval. An outlet writes to its address only when nothing is cabled to it.

◆ setUnit()

void JS::EditJsContext::setUnit ( QString  addr,
QString  unit 
)

The unit of an existing address, spelled as the address panel shows it: "color.rgba", "position.cart2D", "" to clear. The unit is what picks the colour swatch and the XY pad over plain number fields.

◆ withMacro()

void JS::EditJsContext::withMacro ( QJSValue  fn)

Run fn in a macro, committed even if the script errors. A nested call joins the enclosing macro. startMacro()/endMacro() by hand is not exception-safe, and startMacro() overwrites an open macro, rolling back what it had already applied.


The documentation for this class was generated from the following files:
  • EditContext.hpp
  • EditContext.cpp
  • EditContext.curve.cpp
  • EditContext.device.cpp
  • EditContext.introspection.cpp
  • EditContext.ossia.cpp
  • EditContext.port.cpp
  • EditContext.scenario.cpp
  • EditContext.ui.cpp