aboutsummaryrefslogtreecommitdiffhomepage
path: root/desktop/sources/scripts/lib
diff options
context:
space:
mode:
authorneauoire <[email protected]>2019-10-24 21:18:42 -0400
committerneauoire <[email protected]>2019-10-24 21:18:42 -0400
commit22e6fc0a43b1903ca64cfa9bb014f2b0a99593e5 (patch)
tree64593443185f862d0369b20fff5bb12d2c3c08c1 /desktop/sources/scripts/lib
parent75a95e3ddfe3f3ff7d45e3f2cad5a332a108eb0d (diff)
downloadOrca-22e6fc0a43b1903ca64cfa9bb014f2b0a99593e5.tar.gz
Orca-22e6fc0a43b1903ca64cfa9bb014f2b0a99593e5.zip
Improved Midi controls
Diffstat (limited to 'desktop/sources/scripts/lib')
-rw-r--r--desktop/sources/scripts/lib/controller.js18
-rw-r--r--desktop/sources/scripts/lib/theme.js22
2 files changed, 19 insertions, 21 deletions
diff --git a/desktop/sources/scripts/lib/controller.js b/desktop/sources/scripts/lib/controller.js
index 4f667b9..6b81027 100644
--- a/desktop/sources/scripts/lib/controller.js
+++ b/desktop/sources/scripts/lib/controller.js
@@ -1,12 +1,8 @@
'use strict'
export default function Controller () {
- const fs = require('fs')
- const { dialog, app } = require('electron').remote
-
this.menu = { default: {} }
this.mode = 'default'
-
this.app = require('electron').remote.app
this.start = function () {
@@ -15,11 +11,13 @@ export default function Controller () {
this.add = function (mode, cat, label, fn, accelerator) {
if (!this.menu[mode]) { this.menu[mode] = {} }
if (!this.menu[mode][cat]) { this.menu[mode][cat] = {} }
- this.menu[mode][cat][label] = { fn: function (_menuItem, browserWindow) {
- browserWindow.webContents.focus()
- fn.apply(this, arguments)
- },
- accelerator: accelerator }
+ this.menu[mode][cat][label] = {
+ fn: function (_menuItem, browserWindow) {
+ browserWindow.webContents.focus()
+ fn.apply(this, arguments)
+ },
+ accelerator: accelerator
+ }
}
this.addRole = function (mode, cat, label) {
@@ -70,7 +68,7 @@ export default function Controller () {
this.accelerator = function (key, menu) {
const acc = { basic: null, ctrl: null }
- for (cat in menu) {
+ for (const cat in menu) {
const options = menu[cat]
for (const id in options.submenu) {
const option = options.submenu[id]; if (option.role) { continue }
diff --git a/desktop/sources/scripts/lib/theme.js b/desktop/sources/scripts/lib/theme.js
index 7e52e44..43b6790 100644
--- a/desktop/sources/scripts/lib/theme.js
+++ b/desktop/sources/scripts/lib/theme.js
@@ -31,7 +31,7 @@ export default function Theme (_default) {
this.load = function (data) {
const theme = parse(data)
if (!validate(theme)) { console.warn('Theme', 'Not a theme', theme); return }
- console.log('Theme', `Loaded theme!`)
+ console.log('Theme', 'Loaded theme!')
this.el.innerHTML = `:root { --background: ${theme.background}; --f_high: ${theme.f_high}; --f_med: ${theme.f_med}; --f_low: ${theme.f_low}; --f_inv: ${theme.f_inv}; --b_high: ${theme.b_high}; --b_med: ${theme.b_med}; --b_low: ${theme.b_low}; --b_inv: ${theme.b_inv}; }`
localStorage.setItem('theme', JSON.stringify(theme))
this.active = theme
@@ -83,7 +83,7 @@ export default function Theme (_default) {
this.open = function () {
const fs = require('fs')
const { dialog, app } = require('electron').remote
- let paths = dialog.showOpenDialog(app.win, { properties: ['openFile'], filters: [{ name: 'Themes', extensions: ['svg'] }] })
+ const paths = dialog.showOpenDialog(app.win, { properties: ['openFile'], filters: [{ name: 'Themes', extensions: ['svg'] }] })
if (!paths) { console.log('Nothing to load'); return }
fs.readFile(paths[0], 'utf8', function (err, data) {
if (err) throw err
@@ -114,15 +114,15 @@ export default function Theme (_default) {
const svg = new DOMParser().parseFromString(text, 'text/xml')
try {
return {
- 'background': svg.getElementById('background').getAttribute('fill'),
- 'f_high': svg.getElementById('f_high').getAttribute('fill'),
- 'f_med': svg.getElementById('f_med').getAttribute('fill'),
- 'f_low': svg.getElementById('f_low').getAttribute('fill'),
- 'f_inv': svg.getElementById('f_inv').getAttribute('fill'),
- 'b_high': svg.getElementById('b_high').getAttribute('fill'),
- 'b_med': svg.getElementById('b_med').getAttribute('fill'),
- 'b_low': svg.getElementById('b_low').getAttribute('fill'),
- 'b_inv': svg.getElementById('b_inv').getAttribute('fill')
+ background: svg.getElementById('background').getAttribute('fill'),
+ f_high: svg.getElementById('f_high').getAttribute('fill'),
+ f_med: svg.getElementById('f_med').getAttribute('fill'),
+ f_low: svg.getElementById('f_low').getAttribute('fill'),
+ f_inv: svg.getElementById('f_inv').getAttribute('fill'),
+ b_high: svg.getElementById('b_high').getAttribute('fill'),
+ b_med: svg.getElementById('b_med').getAttribute('fill'),
+ b_low: svg.getElementById('b_low').getAttribute('fill'),
+ b_inv: svg.getElementById('b_inv').getAttribute('fill')
}
} catch (err) {
console.warn('Theme', 'Incomplete SVG Theme', err)