aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDevine Lu Linvega <[email protected]>2018-11-17 10:42:33 +1200
committerDevine Lu Linvega <[email protected]>2018-11-17 10:42:33 +1200
commitdd50a142940bc0feff3d9a0cc8ed3572b9d9fc12 (patch)
tree6e922f5e7f3d21d30c3a8a9eed954353f637647d
parent934c8074c1d6154bfb81ad25c64336b0c54cbc57 (diff)
downloadOrca-dd50a142940bc0feff3d9a0cc8ed3572b9d9fc12.tar.gz
Orca-dd50a142940bc0feff3d9a0cc8ed3572b9d9fc12.zip
Display source
-rw-r--r--desktop/sources/scripts/midi.js13
-rw-r--r--desktop/sources/scripts/source.js11
-rw-r--r--desktop/sources/scripts/terminal.js1
-rw-r--r--examples/benchmark.pico44
4 files changed, 39 insertions, 30 deletions
diff --git a/desktop/sources/scripts/midi.js b/desktop/sources/scripts/midi.js
index 232e3bb..575b7ac 100644
--- a/desktop/sources/scripts/midi.js
+++ b/desktop/sources/scripts/midi.js
@@ -89,13 +89,12 @@ function Midi (terminal) {
}
this.toString = function () {
- if (this.stack.length === 0) { return '------' }
- if (this.stack.length === 1) { return '|-----' }
- if (this.stack.length === 2) { return '||----' }
- if (this.stack.length === 3) { return '|||---' }
- if (this.stack.length === 4) { return '||||--' }
- if (this.stack.length === 5) { return '|||||-' }
- if (this.stack.length > 4) { return '||||||' }
+ if (this.stack.length === 0) { return '-----' }
+ if (this.stack.length === 1) { return '|----' }
+ if (this.stack.length === 2) { return '||---' }
+ if (this.stack.length === 3) { return '|||--' }
+ if (this.stack.length === 4) { return '||||-' }
+ if (this.stack.length === 5) { return '|||||' }
}
}
diff --git a/desktop/sources/scripts/source.js b/desktop/sources/scripts/source.js
index 8ff0689..f01f42a 100644
--- a/desktop/sources/scripts/source.js
+++ b/desktop/sources/scripts/source.js
@@ -27,7 +27,7 @@ function Source (pico, terminal) {
} else {
dialog.showSaveDialog((path) => {
if (path === undefined) { return }
- if (path.indexOf('.') < 0) { path += '.pico' }
+ if (path.indexOf('.pico') < 0) { path += '.pico' }
terminal.source.write(path)
terminal.source.path = path
})
@@ -59,6 +59,15 @@ function Source (pico, terminal) {
this.validate = function (data) {
return true
}
+
+ this.name = function () {
+ const parts = this.path.split('/')
+ return parts[parts.length - 1].replace('.pico', '').trim()
+ }
+
+ this.toString = function () {
+ return this.path ? this.name() : 'unsaved'
+ }
}
module.exports = Source
diff --git a/desktop/sources/scripts/terminal.js b/desktop/sources/scripts/terminal.js
index 7f35616..8c624ec 100644
--- a/desktop/sources/scripts/terminal.js
+++ b/desktop/sources/scripts/terminal.js
@@ -161,6 +161,7 @@ function Terminal (pico) {
this.write(`${this.cursor._mode()}`, col * 1, 0)
this.write(`${this.bpm}`, col * 2, 0)
this.write(`${this.midi}`, col * 3, 0)
+ this.write(`${this.source}`, col * 4, 0)
}
this.write = function (text, offsetX, offsetY) {
diff --git a/examples/benchmark.pico b/examples/benchmark.pico
index 217633a..1fa3d1e 100644
--- a/examples/benchmark.pico
+++ b/examples/benchmark.pico
@@ -1,22 +1,22 @@
-...................................................................
-.................A.......M.......F.......Y.........................
-...................................................................
-...................................................................
-................2A......2M......2F......2Y.........................
-...................................................................
-...................................................................
-.................A2......M2......F2......Y2........................
-...................................................................
-...................................................................
-................2A2.....2M2.....2F2.....2Y2........................
-...................................................................
-...................................................................
-................2A3.....2M3.....2F3.....2Y3........................
-...................................................................
-...................................................................
-................2AK.....9MK.....2FK.....2YK........................
-...................................................................
-...................................................................
-................KA2.....KM6.....KFK.....KYK........................
-...................................................................
-................................................................... \ No newline at end of file
+.................................................
+....A.......M.......F.......Y.......I.......C....
+.................................................
+.................................................
+...2A......2M......2F......2Y......2I......2C....
+.................................................
+.................................................
+....A2......M2......F2......Y2......I2......C2...
+.................................................
+.................................................
+...2A2.....2M2.....2F2.....2Y2.....2I2.....2C2...
+.................................................
+.................................................
+...2A3.....2M3.....2F3.....2Y3.....2I3.....2C3...
+.................................................
+.................................................
+...2AK.....9MK.....2FK.....2YK.....2IK.....2CK...
+.................................................
+.................................................
+...KA2.....KM6.....KFK.....KYK.....KI2.....KC2...
+.................................................
+................................................. \ No newline at end of file