diff --git a/README.md b/README.md
index d8cecf7..3a505c1 100644
--- a/README.md
+++ b/README.md
@@ -40,7 +40,7 @@ Ronin helpers are keywords that facilitates adding coordinates from the canvas i
- `(import path shape ~alpha)` Imports a graphic file with format.
- `(export path ~format ~quality)` Exports a graphic file with format.
-- `(open path ~ratio)` Imports a graphic file and resizes the frame.
+- `(open path ~ratio ~orientation ~mirrorx ~mirrory)` Imports a graphic file and resizes the frame.
- `(exit ~force)` Exits Ronin.
- `(pos ~x ~y)` Returns a position shape.
- `(line ax ay bx by)` Returns a line shape.
@@ -62,7 +62,7 @@ Ronin helpers are keywords that facilitates adding coordinates from the canvas i
- `(drag ~rect)` Drag a part of the canvas.
- `(view a b)` View a part of the canvas.
- `(pick ~shape)` Returns the color of a pixel at pos, or of the average of the pixels in rect.
-- `(transform)` The transform toolkit, see examples.
+- `(transform)` The transform toolkit.
- `(stroke shape color ~thickness)` Strokes a shape.
- `(fill ~rect)` Fills a shape.
- `(clear ~rect)` Clears a rect.
@@ -139,7 +139,6 @@ Ronin helpers are keywords that facilitates adding coordinates from the canvas i
- `(on event f)` Triggers on event.
- `(test name a b)`
- `(benchmark fn)` Logs time taken to execute a function.
-- `(theme)` Get theme values.
diff --git a/desktop/sources/index.html b/desktop/sources/index.html
index 5a5da50..2f49c55 100644
--- a/desktop/sources/index.html
+++ b/desktop/sources/index.html
@@ -11,7 +11,6 @@
-
@@ -23,7 +22,6 @@
const {dialog,app} = require('electron').remote;
const fs = require('fs')
const ronin = new Ronin()
-
ronin.controller = new Controller()
ronin.controller.add("default","*","About",() => { require('electron').shell.openExternal('https://github.com/hundredrabbits/Ronin'); },"CmdOrCtrl+,");
ronin.controller.add("default","*","Fullscreen",() => { app.toggleFullscreen() },"CmdOrCtrl+Enter");
@@ -58,7 +56,6 @@
ronin.controller.addSpacer('default', 'Theme', 'Download')
ronin.controller.add("default","Theme","Download Themes..",() => { require('electron').shell.openExternal('https://github.com/hundredrabbits/Themes') })
ronin.controller.commit()
-
ronin.install(document.body)
window.addEventListener('load', () => { ronin.start() })
diff --git a/desktop/sources/scripts/commander.js b/desktop/sources/scripts/commander.js
index 2e73bf6..9a0e32c 100644
--- a/desktop/sources/scripts/commander.js
+++ b/desktop/sources/scripts/commander.js
@@ -3,15 +3,11 @@ function Commander (ronin) {
this.el = document.createElement('div')
this.el.id = 'commander'
this._input = document.createElement('textarea')
- this._status = document.createElement('div')
- this._status.id = 'status'
- this._log = document.createElement('div')
- this._log.id = 'log'
- this._docs = document.createElement('div')
- this._docs.id = 'help'
- this._run = document.createElement('a')
- this._run.id = 'run'
- this._run.setAttribute('title', 'Run(c-R)')
+ this._status = document.createElement('div'); this._status.id = 'status'
+ this._log = document.createElement('div'); this._log.id = 'log'
+ this._docs = document.createElement('div'); this._docs.id = 'help'
+ this._run = document.createElement('a'); this._run.id = 'run'
+
this.isVisible = true
this.install = function (host) {
@@ -21,6 +17,7 @@ function Commander (ronin) {
this._status.appendChild(this._run)
this.el.appendChild(this._status)
host.appendChild(this.el)
+ this._run.setAttribute('title', 'Run(c-R)')
this._input.addEventListener('input', this.onInput)
this._input.addEventListener('click', this.onClick)
this._run.addEventListener('click', () => { this.run() })
@@ -57,8 +54,32 @@ function Commander (ronin) {
this.load('')
}
+ this.cleanup = function () {
+ this._input.value = this.clean(this._input.value)
+ this.reindent()
+ this.run()
+ }
+
+ this.update = function () {
+
+ }
+
+ this.onInput = () => {
+ this.setStatus()
+ }
+
+ this.onClick = () => {
+ this.setStatus()
+ }
+
+ this.getLastfn = function () {
+ const pos = this._input.value.substr(0, this._input.selectionStart).lastIndexOf('(')
+ return this._input.value.substr(pos).split(' ')[0].replace(/\(/g, '').replace(/\)/g, '').trim()
+ }
+
+
this.reindent = function () {
- let val = this._input.value.replace(/\n/g, '').replace(/ +(?= )/g, '').replace(/\( \(/g, '((').replace(/\) \)/g, '))').trim()
+ let val = this._input.value.replace(/\n/g, '').replace(/ \)/g, ')').replace(/ +(?= )/g, '').replace(/\( \(/g, '((').replace(/\) \)/g, '))').trim()
let depth = 0
if (val.split('(').length !== val.split(')').length) {
ronin.log('Uneven number of parens.')
@@ -89,12 +110,6 @@ function Commander (ronin) {
return input
}
- this.cleanup = function () {
- this._input.value = this.clean(this._input.value)
- this.reindent()
- this.run()
- }
-
this.setStatus = function (msg) {
// Logs
if (msg && msg !== this._log.textContent) {
@@ -109,23 +124,6 @@ function Commander (ronin) {
}
}
- this.update = function () {
-
- }
-
- this.onInput = () => {
- this.setStatus()
- }
-
- this.onClick = () => {
- this.setStatus()
- }
-
- this.getLastfn = function () {
- const pos = this._input.value.substr(0, this._input.selectionStart).lastIndexOf('(')
- return this._input.value.substr(pos).split(' ')[0].replace(/\(/g, '').replace(/\)/g, '').trim()
- }
-
// Injection
this.cache = this._input.value
diff --git a/desktop/sources/scripts/docs.js b/desktop/sources/scripts/docs.js
index 4ebb47b..ea8dce1 100644
--- a/desktop/sources/scripts/docs.js
+++ b/desktop/sources/scripts/docs.js
@@ -1,5 +1,7 @@
function Docs (ronin) {
+
this.dict = {}
+
this.load = () => {
const fs = require('fs')
const path = require('path')
@@ -8,6 +10,7 @@ function Docs (ronin) {
const lines = fs.readFileSync(p, 'utf8').split('\n').filter((line) => { return line.substr(0, 7) === ' this.' })
return lines.map((line) => { return line.trim().substr(5).trim() })
}
+
this.install = (payload = this.load()) => {
for (const id in payload) {
const name = payload[id].substr(0, payload[id].indexOf(' = '))
@@ -21,6 +24,7 @@ function Docs (ronin) {
console.log('Docs', `Loaded ${Object.keys(this.dict).length} functions.`)
console.log(this.toMarkdown())
}
+
this.toMarkdown = () => {
return Object.keys(this.dict).reduce((acc, item, key) => {
const example = `${item} ${this.dict[item].params.reduce((acc, item) => {
@@ -29,9 +33,11 @@ function Docs (ronin) {
return `${acc}- \`(${example.trim()})\` ${this.dict[item].note}\n`
}, '')
}
+
this.hasDocs = (name) => {
return !!this.dict[name]
}
+
this.print = (name) => {
return `(${name} ${this.dict[name].params.reduce((acc, item) => { return `${acc}${item} ` }, '').trim()})`
}
diff --git a/desktop/sources/scripts/library.js b/desktop/sources/scripts/library.js
index 78a8859..6fb9869 100644
--- a/desktop/sources/scripts/library.js
+++ b/desktop/sources/scripts/library.js
@@ -146,7 +146,7 @@ function Library (ronin) {
// Transforms
- this.transform = { // The transform toolkit, use like (transform:move 10 10).
+ this.transform = { // The transform toolkit.
push: () => {
ronin.surface.context.save()
},