remote-control: rename that api
This commit is contained in:
parent
d989c3423d
commit
89c89dbfce
5 changed files with 34 additions and 26 deletions
|
|
@ -3,9 +3,10 @@
|
|||
## next
|
||||
|
||||
- main
|
||||
- **new** `midi` support
|
||||
- **new** `midi` support ([http://osc.ammd.net/user-guide/midi/](documentation))
|
||||
- ui
|
||||
- **new** `/TABS id1 id2 etc` osc address to remotely enable tabs
|
||||
- remote editing through `/EXEC` command is now deprecated, use `/EDIT` and `/EDIT_SOFT` instead
|
||||
- bug fixes
|
||||
- `push` widgets (and `keyboards`) not correctly synchronizing each other (with shared widget ids or between different clients)
|
||||
- widgets
|
||||
|
|
|
|||
|
|
@ -1,14 +1,9 @@
|
|||
# Remote editing
|
||||
# Remote control
|
||||
|
||||
The interface can be remotely edited by sending the appropriate osc messages (from an external source with `-o` / `--osc-port` set, or via `custom-module` scripting).
|
||||
All widgets that send osc messages respond to the same messages. Additionnaly, Open Stage Control responds to some general osc commands.
|
||||
|
||||
```
|
||||
/EXEC COMMAND ARGS
|
||||
```
|
||||
|
||||
## Supported commands
|
||||
|
||||
#### `edit` : `/EXEC edit id options`
|
||||
## `/EDIT id options`
|
||||
|
||||
|
||||
Apply a set of options to an existing widget by replacing the old ones with the new ones.
|
||||
|
|
@ -20,8 +15,7 @@ Apply a set of options to an existing widget by replacing the old ones with the
|
|||
|
||||
*Editing a widget can be cpu expensive, hence updating the UI continuously is not a good idea.*
|
||||
|
||||
#### `edit_soft` : `/EXEC edit_soft id options`
|
||||
|
||||
## `/EDIT_SOFT id options`
|
||||
|
||||
Apply a set of options to an existing widget by merging them to the widget's options.
|
||||
|
||||
|
|
@ -31,3 +25,7 @@ Apply a set of options to an existing widget by merging them to the widget's opt
|
|||
- example: `{"label":"New Label", "color":"red"}`
|
||||
|
||||
*Editing a widget can be cpu expensive, hence updating the UI continuously is not a good idea.*
|
||||
|
||||
## `/TABS id id etc`
|
||||
|
||||
Open the tabs designated by the `id` parameters. The target tab link must be accesible (opening a tab located in a disabled tab won't work unless you specify the parent tab's `id` before; the safest way to go is to pass the whole tab tree to enable).
|
||||
|
|
@ -158,11 +158,6 @@ module.exports = {
|
|||
$('#grid-width-input').remove()
|
||||
EDITING = false
|
||||
},
|
||||
tabsEnable: function(tabs){
|
||||
for (i in tabs) {
|
||||
$(`[data-id="${tabs[i]}"]`).trigger('fake-click')
|
||||
}
|
||||
},
|
||||
traversingDisable: function(){
|
||||
$('.traversingEnable, .traversingDisable').toggleClass('on')
|
||||
$('#container').trigger('disableTraversingGestures')
|
||||
|
|
|
|||
|
|
@ -5,12 +5,12 @@ var {widgetManager} = require('./managers'),
|
|||
var Osc = function(){
|
||||
|
||||
this.syncOnly = false
|
||||
this.remoteExec = ()=>{console.error('remote-exec module not loaded')}
|
||||
this.remoteControl = ()=>{console.error('remote-control module not loaded')}
|
||||
|
||||
}
|
||||
|
||||
Osc.prototype.init = function(data) {
|
||||
this.remoteExec = require('./remote-exec')
|
||||
this.remoteControl = require('./remote-control')
|
||||
}
|
||||
|
||||
Osc.prototype.send = function(data) {
|
||||
|
|
@ -29,8 +29,7 @@ Osc.prototype.send = function(data) {
|
|||
|
||||
Osc.prototype.receive = function(data){
|
||||
|
||||
if (data.address == '/EXEC') return this.remoteExec(data.args)
|
||||
if (data.address == '/TABS') return actions.tabsEnable(data.args)
|
||||
if (this.remoteControl.exists(data.address)) return this.remoteControl.exec(data.address, data.args)
|
||||
|
||||
// fetch ids corresponding to the osc address
|
||||
var address = data.address,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,13 @@ var {getObjectData, updateDom} = require('./editor/data-workers'),
|
|||
{widgetManager} = require('./managers')
|
||||
|
||||
var callbacks = {
|
||||
edit: function(args) {
|
||||
'/EXEC': function(args) {
|
||||
// backward-compatibility
|
||||
var [name, ...args] = args
|
||||
if (name == 'edit') return callbacks['/EDIT'](args)
|
||||
if (name == 'edit_soft') return callbacks['/EDIT_SOFT'](args)
|
||||
},
|
||||
'/EDIT': function(args) {
|
||||
var [id, json] = args,
|
||||
newdata = JSON.parse(json),
|
||||
containers = widgetManager.getWidgetById(id)
|
||||
|
|
@ -18,7 +24,7 @@ var callbacks = {
|
|||
updateDom(container,data,true)
|
||||
}
|
||||
},
|
||||
edit_soft: function(args) {
|
||||
'/EDIT_SOFT': function(args) {
|
||||
var [id, json] = args,
|
||||
newdata = JSON.parse(json),
|
||||
containers = widgetManager.getWidgetById(id)
|
||||
|
|
@ -31,12 +37,21 @@ var callbacks = {
|
|||
$.extend(true,data,newdata)
|
||||
updateDom(container,data,true)
|
||||
}
|
||||
},
|
||||
'/TABS': function(args) {
|
||||
for (i in args) {
|
||||
$(`[data-id="${args[i]}"]`).trigger('fake-click')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = function(args){
|
||||
var [name, ...args] = args
|
||||
if (callbacks[name]) {
|
||||
callbacks[name](args)
|
||||
module.exports = {
|
||||
exec: function(name, args){
|
||||
if (callbacks[name]) {
|
||||
callbacks[name](args)
|
||||
}
|
||||
},
|
||||
exists: function(name){
|
||||
return name in callbacks
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue