diff options
author | Devine Lu Linvega <[email protected]> | 2018-11-24 17:27:37 +1200 |
---|---|---|
committer | Devine Lu Linvega <[email protected]> | 2018-11-24 17:27:37 +1200 |
commit | 89710afd85301b089540f82a72513fa4eb491c75 (patch) | |
tree | 847d112905faccd736d17c5a96cf513c3aaa9f98 /desktop/sources | |
parent | aaa60b391b6ae3c5b44c896260a0f4c358d83518 (diff) | |
download | Orca-89710afd85301b089540f82a72513fa4eb491c75.tar.gz Orca-89710afd85301b089540f82a72513fa4eb491c75.zip |
Minor changes
Diffstat (limited to 'desktop/sources')
-rw-r--r-- | desktop/sources/index.html | 3 | ||||
-rw-r--r-- | desktop/sources/scripts/io.js | 1 | ||||
-rw-r--r-- | desktop/sources/scripts/source.js | 13 | ||||
-rw-r--r-- | desktop/sources/scripts/terminal.js | 9 |
4 files changed, 15 insertions, 11 deletions
diff --git a/desktop/sources/index.html b/desktop/sources/index.html index 91d6232..4d1dd7e 100644 --- a/desktop/sources/index.html +++ b/desktop/sources/index.html @@ -37,7 +37,8 @@ terminal.controller.add("default","File","Save",() => { terminal.source.save(); },"CmdOrCtrl+S") terminal.controller.add("default","File","Save As",() => { terminal.source.save(true); },"CmdOrCtrl+Shift+S") terminal.controller.add("default","File","Open",() => { terminal.source.open(); },"CmdOrCtrl+O") - terminal.controller.add("default","File","Revert",() => { terminal.source.revert(); },"CmdOrCtrl+W") + terminal.controller.add("default","File","Revert",() => { terminal.source.revert(); },"CmdOrCtrl+Shift+R") + terminal.controller.add("default","File","Close",() => { terminal.source.close(); },"CmdOrCtrl+W") terminal.controller.add("default","Edit","Select All",() => { terminal.cursor.paste(); },"CmdOrCtrl+A") terminal.controller.add("default","Edit","Copy",() => { terminal.cursor.copy(); },"CmdOrCtrl+C") diff --git a/desktop/sources/scripts/io.js b/desktop/sources/scripts/io.js index 695af40..f84955d 100644 --- a/desktop/sources/scripts/io.js +++ b/desktop/sources/scripts/io.js @@ -35,6 +35,7 @@ function IO (terminal) { this.playUdp = function (data) { const udp = dgram.createSocket('udp4') udp.send(Buffer.from(`${data}`), 49160, 'localhost', (err) => { + console.log(err) udp.close() }) } diff --git a/desktop/sources/scripts/source.js b/desktop/sources/scripts/source.js index f65ce44..b38ee24 100644 --- a/desktop/sources/scripts/source.js +++ b/desktop/sources/scripts/source.js @@ -7,14 +7,16 @@ function Source (orca, terminal) { this.path = null this.new = function () { - orca.clear() console.log('New') + orca.w = 57 + orca.h = 25 + orca.clear() this.path = null + terminal.resize() } this.open = function () { console.log('Open') - let paths = dialog.showOpenDialog(app.win, { properties: ['openFile'] }) if (!paths) { console.log('Nothing to load') } if (!terminal.source.validate(paths[0])) { console.log('Invalid file') } @@ -24,7 +26,6 @@ function Source (orca, terminal) { this.save = function (as = false) { console.log('Save') - if (this.path && !as) { this.write(this.path) } else { @@ -42,6 +43,12 @@ function Source (orca, terminal) { this.read(this.path) } + this.close = function () { + console.log('Close') + orca.clear() + this.path = null + } + // I/O this.write = function (path) { diff --git a/desktop/sources/scripts/terminal.js b/desktop/sources/scripts/terminal.js index 4a77282..2e8c3cb 100644 --- a/desktop/sources/scripts/terminal.js +++ b/desktop/sources/scripts/terminal.js @@ -26,18 +26,14 @@ function Terminal (orca, tile = { w: 20, h: 30 }) { this.start = function () { this.theme.start() this.io.start() - - this.update() this.setSpeed(120) + this.update() this.el.className = 'ready' } this.run = function () { if (this.isPaused) { return } - this.io.clear() - this.clear() - orca.run() this.io.run() this.update() @@ -74,9 +70,8 @@ function Terminal (orca, tile = { w: 20, h: 30 }) { this.setSpeed = function (bpm) { this.bpm = clamp(bpm, 60, 300) console.log(`Changed speed to ${this.bpm}.`) - const ms = (60000 / bpm) / 4 clearInterval(this.timer) - this.timer = setInterval(() => { this.run() }, ms) + this.timer = setInterval(() => { this.run() }, (60000 / bpm) / 4) } this.modSpeed = function (mod = 0) { |