Merge branch 'master' of github.com:jean-emmanuel/open-stage-control

This commit is contained in:
jean-emmanuel 2021-03-02 15:17:21 +01:00
commit cc5f1f5bfe
19 changed files with 174 additions and 42 deletions

View file

@ -1,14 +1,41 @@
# Changelog
# 1.8.9
## next
- bug fixes
- switch: widget not reacting at first touch when traversing is enabled on parent
- custom module
- expose `process` global
- scripting
- add `openUrl` function
## 1.8.10
- bug fixes
- modal: issues with children's visibility
- console: allow multiple arguments in console.log()
- ui
- launcher: add many keyboard shortcuts
- client: add keyboard shortcuts for clearing the console
- scripting
- add `setFocus` function to focus an input widget programmatically
- misc
- add `usePercents` client option
## 1.8.9
- bug fixes
- script: issue when using the `options` argument in `set()` (options leaked to subsequent set() calls in the script)
- multixy: `decimals` property not applied
- multixy: spring behavior not working until all points are released
- custom module: prevent require() from reading submodules files each time and instead return the object in memory
- custom module: prevent require() from reading submodules files each time and instead return the object in memory
# 1.8.8
## 1.8.8
- launcher
- add file browser button for the `theme` option and fix parsing path containing spaces if only one theme is set

View file

@ -4,9 +4,12 @@ Open Stage Control
*Libre and modular OSC / MIDI controller*
https://openstagecontrol.ammd.net/
- Website: https://openstagecontrol.ammd.net/
- Forum: https://openstagecontrol.discourse.group/
- IRC: Freenode #openstagecontrol
----
Copyleft © Jean-Emmanuel Doucet @ [AMMD](http://ammd.net) 2014-2020.
Copyleft © Jean-Emmanuel Doucet @ [AMMD](http://ammd.net) 2014-2021.
This program is a free software released under the [GNU/GPL3](ttps://github.com/jean-emmanuel/open-stage-control/blob/master/LICENSE) license.

View file

@ -2,7 +2,7 @@
"name": "open-stage-control",
"productName": "Open Stage Control",
"description": "Libre and modular OSC / MIDI controller",
"version": "1.8.9",
"version": "1.8.11",
"author": {
"name": "Jean-Emmanuel Doucet",
"email": "jean-emmanuel@ammd.net"

View file

@ -12,6 +12,8 @@ Client options can be set either with the server's `--client-options` option, or
| lang | string | *system_default* | use a different language than the default if available (available languages: en, fr) |
| consoleLength | number | 300 | sets the maximum number of log messages in the client's console |
| id | string | *random_id* | client's unique id (use with caution: two clients should never have the same id) |
| usePercents | 1 / 0 | 0 | sets the editor's "relative units" option |
Example:

View file

@ -136,6 +136,7 @@ This function can be used to load native node modules or locally installed modul
- `clearInterval`
- `__dirname`
- `__filename`
- `process`
----

View file

@ -55,6 +55,7 @@ Modals are virtual popup windows that may contain various content: file browser,
|---|---|
| ++ctrl+e++ | enable/disable editor |
| ++ctrl+k++ | show/hide console |
| ++ctrl+l++ | clear console |
| ++ctrl+s++ | save session |
| ++ctrl+shift+s++ | save session as... |
| ++ctrl+o++ | open a session file |
@ -66,6 +67,7 @@ Modals are virtual popup windows that may contain various content: file browser,
|---|---|
| ++ctrl+e++ | enable/disable editor |
| ++ctrl+k++ | show/hide console |
| ++ctrl+l++ | clear console |
| ++ctrl+s++ | save session |
| ++ctrl+shift+s++ | save session as... |
| ++ctrl+o++ | open a session file |
@ -77,6 +79,7 @@ Modals are virtual popup windows that may contain various content: file browser,
|---|---|
| ++cmd+e++ | enable/disable editor |
| ++cmd+k++ | show/hide console |
| ++cmd+l++ | clear console |
| ++cmd+s++ | save session |
| ++cmd+shift+s++ | save session as... |
| ++cmd+o++ | open a session file |

View file

@ -30,17 +30,42 @@ The console diplays various informations, runtime errors and server debug messag
| Shortcut | Description |
|---|---|
| ++f5++ | start server |
| ++f6++ | stop server |
| ++ctrl+n++ | open new client window |
| ++ctrl+o++ | load settings |
| ++ctrl+s++ | save settings |
| ++ctrl+shift+s++ | save settings as... |
| ++ctrl+m++ | list midi devices |
| ++ctrl+l++ | clear console |
| ++ctrl+w++ | close window |
=== "Windows"
| Shortcut | Description |
|---|---|
| ++f5++ | start server |
| ++f6++ | stop server |
| ++ctrl+n++ | open new client window |
| ++ctrl+o++ | load settings |
| ++ctrl+s++ | save settings |
| ++ctrl+shift+s++ | save settings as... |
| ++ctrl+m++ | list midi devices |
| ++ctrl+l++ | clear console |
| ++alt+f4++ | close window |
=== "Mac"
| Shortcut | Description |
|---|---|
| ++f5++ | start server |
| ++f6++ | stop server |
| ++cmd+n++ | open new client window |
| ++cmd+o++ | load settings |
| ++cmd+s++ | save settings |
| ++cmd+shift+s++ | save settings as... |
| ++cmd+m++ | list midi devices |
| ++cmd+l++ | clear console |
| ++cmd+w++ | close window |
| ++cmd+q++ | quit app |

View file

@ -161,7 +161,7 @@ Reference:
#### `clearTimeout(id)` / `clearInterval(id)`
Clear timeout with matching `id`.
Clears timeout with matching `id`.
Reference:
@ -170,6 +170,16 @@ Reference:
----
#### `setFocus(id)`
- `id` (optional): widget `id` as a string
Gives focus to a widget (ie input widget).
*Built-in client only*: tells the operating system to give the focus to the client window
----
#### `unfocus()`
*Built-in client only*: tells the operating system to give the focus to the window that was focused before.
@ -195,7 +205,7 @@ Sets the scroll state of a container.
#### `toolbar(i1, i2, ...)`
- `iX`: menu entry index
Trigger toolbar action at specified index.
Triggers toolbar action at specified index.
!!! example "Examples"
@ -203,3 +213,12 @@ Trigger toolbar action at specified index.
- `toolbar(3)` -> Toggle full screen
Actions will only be triggered if initiated with a user interaction. Fullscreen cannot be toggled with a simulated interaction (i.e. using `/SET`)
#### `openUrl(url)`
- `url`: http(s) url
*Built-in client only*: opens url with the system's default browser
*External client only*: opens url in a new tab
If the event that triggered the script's execution was not initiated by a user interaction, this function will have no effect.

View file

@ -130,7 +130,7 @@ class Editor {
this.idClipboard = data.idClipboard
})
this.usePercents = false
this.usePercents = !!ENV.usePercents
this.enabled = false
this.grid = true

View file

@ -184,6 +184,7 @@ var menuEntries = [
{
label: locales('console_clear'),
action: uiConsole.clear.bind(uiConsole),
shortcut: 'mod + l'
},
]
},

View file

@ -100,13 +100,6 @@ class ColorPicker extends UiWidget {
}
childrenVisible() {
return true
}
setName(n = '') {
this.name = n

View file

@ -37,13 +37,17 @@ class UiConsole extends UiSidePanel {
console._log = console.log
console.log = function(message){
_this.log('log', message)
for (let arg of arguments) {
_this.log('log', arg)
}
console._log(...arguments)
}
console._error = console.error
console.error = function(message){
_this.log('error', message)
for (let arg of arguments) {
_this.log('error', arg)
}
console._error(...arguments)
}

View file

@ -56,6 +56,10 @@ class Switch extends MenuBase {
var index = 0,
node = e.target
if (e.target === this.widget && e.traversing === true && e.firstTarget) {
node = e.firstTarget
}
if (touchFix && e.isTouch) {
// special traversing touch fix
node = document.elementFromPoint(e.clientX, e.clientY)

View file

@ -1065,13 +1065,7 @@ class Widget extends EventEmitter {
isVisible() {
return this.getProp('visible') && this.parent.childrenVisible()
}
childrenVisible() {
return this.isVisible()
return this.getProp('visible') && this.parent.isVisible()
}

View file

@ -126,13 +126,6 @@ class Modal extends Panel {
}
childrenVisible() {
return this.init && this.value && this.isVisible()
}
setValue(v, options={}) {
if (this.init === undefined) return

View file

@ -326,8 +326,28 @@ class ScriptVm extends Vm {
}
this.sandbox.contentWindow.setFocus = (id)=>{
if (id) {
var widgets = this.resolveId(id)
if (widgets.length) {
setTimeout(()=>{
widgets[0].widget.focus()
})
}
}
// built-in client only: electron will call window.focus()
console.debug('ELECTRON.FOCUS()')
}
this.sandbox.contentWindow.unfocus = ()=>{
window.blur()
// built-in client only: electron will call window.blur()
console.debug('ELECTRON.BLUR()')
@ -353,8 +373,17 @@ class ScriptVm extends Vm {
}
this.sandbox.contentWindow.openUrl = (url)=>{
var options = this.getValueOptions()
if (options.send) window.open(url, '_blank')
}
for (var imports of ['set', 'get', 'getProp', 'getIndex', 'updateProp', 'send', 'httpGet', 'stateGet', 'stateSet', 'storage',
'setInterval', 'clearInterval', 'setTimeout', 'clearTimeout', 'unfocus', 'setScroll', 'getScroll', 'toolbar']) {
'setInterval', 'clearInterval', 'setTimeout', 'clearTimeout', 'setFocus', 'unfocus', 'setScroll', 'getScroll', 'toolbar',
'openUrl']) {
this.sanitize(this.sandbox.contentWindow[imports])
}

View file

@ -3,6 +3,7 @@ var {remote, ipcRenderer} = require('electron'),
menu = new Menu(),
terminal = require('./terminal'),
settings = require('./settings'),
keyboardJS = require('keyboardjs/dist/keyboard.min.js'),
{midilist, openDocs} = remote.getGlobal('launcherSharedGlobals'),
serverStarted = false,
serverStart = ()=>{
@ -16,18 +17,21 @@ var {remote, ipcRenderer} = require('electron'),
var start = new MenuItem({
label: 'Start',
click: serverStart
click: serverStart,
accelerator: 'f5'
})
var stop = new MenuItem({
label: 'Stop',
click: serverStop
click: serverStop,
accelerator: 'f6'
})
var newWindow = new MenuItem({
label: 'New window',
visible: false,
click: ()=>{
ipcRenderer.send('openClient')
}
},
accelerator: 'CmdOrCtrl + n'
})
menu.append(start)
menu.append(stop)
@ -39,19 +43,22 @@ menu.append(new MenuItem({
label: 'Load',
click: ()=>{
settings.load()
}
},
accelerator: 'CmdOrCtrl + o'
}))
menu.append(new MenuItem({
label: 'Save',
click: ()=>{
settings.save()
}
},
accelerator: 'CmdOrCtrl + s'
}))
menu.append(new MenuItem({
label: 'Save as...',
click: ()=>{
settings.saveAs()
}
},
accelerator: 'CmdOrCtrl + shift + s'
}))
menu.append(new MenuItem({
type: 'separator'
@ -60,14 +67,16 @@ menu.append(new MenuItem({
label: 'List MIDI Devices',
click: ()=>{
midilist()
}
},
accelerator: 'CmdOrCtrl + m'
}))
menu.append(new MenuItem({type: 'submenu' , label: 'Console', submenu: [
new MenuItem({
label: 'Clear',
click: ()=>{
terminal.clear()
}
},
accelerator: 'CmdOrCtrl + l'
}),
new MenuItem({
label: 'Autoscroll',
@ -106,6 +115,29 @@ menu.append(new MenuItem({
role: 'Quit'
}))
function bindShortcuts(menu) {
for (let m of menu.items) {
if (m.type === 'submenu') {
bindShortcuts(m.submenu)
} else if (m.accelerator && m.click) {
keyboardJS.bind(m.accelerator.replace('CmdOrCtrl', 'mod'), (e)=>{
m.click()
})
}
}
}
bindShortcuts(menu)
class Toolbar {
constructor() {

View file

@ -60,7 +60,8 @@ class CustomModule {
setInterval: this.setInterval.bind(this),
clearInterval: this.clearInterval.bind(this),
require: this.require.bind(this),
nativeRequire: require
nativeRequire: require,
process: process
}
if (!this.submodule && !modulePathExtended) {

View file

@ -101,6 +101,7 @@ module.exports = function(options={}) {
window.webContents.on('console-message', (event, level, message)=>{
if (level === 0 && message === 'ELECTRON.BLUR()') window.blur()
if (level === 0 && message === 'ELECTRON.FOCUS()') window.focus()
})