Begin implementing onscreen docs.
This commit is contained in:
@@ -4,18 +4,28 @@ function Commander (ronin) {
|
||||
this._input = document.createElement('textarea')
|
||||
this._status = document.createElement('div')
|
||||
this._status.id = 'status'
|
||||
this._log = document.createElement('div')
|
||||
this._log.id = 'log'
|
||||
this._source = document.createElement('div')
|
||||
this._source.id = 'source'
|
||||
this._help = document.createElement('div')
|
||||
this._help.id = 'help'
|
||||
this.isVisible = true
|
||||
|
||||
this.install = function (host) {
|
||||
this.el.appendChild(this._input)
|
||||
this._status.appendChild(this._log)
|
||||
this._status.appendChild(this._source)
|
||||
this._status.appendChild(this._help)
|
||||
this.el.appendChild(this._status)
|
||||
host.appendChild(this.el)
|
||||
this._input.addEventListener('input', this.onInput)
|
||||
this._input.addEventListener('click', this.onClick)
|
||||
this.docs.install()
|
||||
}
|
||||
|
||||
this.start = function () {
|
||||
this._status.textContent = 'Idle. (zoom 100%)'
|
||||
this.setStatus('Ready.')
|
||||
this._input.focus()
|
||||
this.run()
|
||||
this.hide()
|
||||
@@ -54,21 +64,22 @@ function Commander (ronin) {
|
||||
}
|
||||
|
||||
this.setStatus = function (msg) {
|
||||
if (!msg || msg === this._status.textContent) { return }
|
||||
this._status.textContent = `${(msg + '').substr(0, 40)}`
|
||||
console.log(...msg)
|
||||
if (!msg || msg === this._log.textContent) { return }
|
||||
this._log.textContent = `${msg}`
|
||||
this._source.textContent = `${ronin.source} ${this._input.value.split('\n').length} lines`
|
||||
console.log(msg)
|
||||
}
|
||||
|
||||
this.update = function () {
|
||||
|
||||
}
|
||||
|
||||
this.onInput = function () {
|
||||
|
||||
this.onInput = () => {
|
||||
console.log('input', this._input.selectionStart)
|
||||
}
|
||||
|
||||
this.getQuery = function () {
|
||||
|
||||
this.onClick = () => {
|
||||
console.log('click', this._input.selectionStart)
|
||||
}
|
||||
|
||||
// Mouse
|
||||
@@ -83,7 +94,6 @@ function Commander (ronin) {
|
||||
this.mouseRect.a.x = e.offsetX
|
||||
this.mouseRect.a.y = e.offsetY
|
||||
this.mouseRect.t = 'pos'
|
||||
this._status.textContent = `${this.mouseRect.x},${this.mouseRect.y} ${this.mouseRect.w},${this.mouseRect.h}`
|
||||
this.capture()
|
||||
this.show()
|
||||
}
|
||||
@@ -94,7 +104,6 @@ function Commander (ronin) {
|
||||
this.mouseRect.h = e.offsetY - this.mouseRect.y
|
||||
this.mouseRect.b.x = e.offsetX
|
||||
this.mouseRect.b.y = e.offsetY
|
||||
this._status.textContent = `${this.mouseRect.x},${this.mouseRect.y} ${this.mouseRect.w},${this.mouseRect.h}`
|
||||
this.commit()
|
||||
}
|
||||
}
|
||||
@@ -106,7 +115,6 @@ function Commander (ronin) {
|
||||
this.mouseRect.b.x = e.offsetX
|
||||
this.mouseRect.b.y = e.offsetY
|
||||
this.mouseRect.t = ''
|
||||
this._status.textContent = `${this.mouseRect.x},${this.mouseRect.y} ${this.mouseRect.w},${this.mouseRect.h}`
|
||||
this.commit()
|
||||
this._input.focus()
|
||||
ronin.surface.clearGuide()
|
||||
|
||||
@@ -15,6 +15,7 @@ function Source (ronin) {
|
||||
console.log('Source', 'Make a new file..')
|
||||
this.path = null
|
||||
ronin.surface.clear()
|
||||
ronin.log(`New file.`)
|
||||
}
|
||||
|
||||
this.open = function () {
|
||||
@@ -57,6 +58,7 @@ function Source (ronin) {
|
||||
if (quitAfter === true) {
|
||||
app.exit()
|
||||
}
|
||||
ronin.log(`Writing file.`)
|
||||
}
|
||||
|
||||
this.read = function (loc = this.path) {
|
||||
@@ -65,6 +67,7 @@ function Source (ronin) {
|
||||
console.log('Source', 'Reading ' + loc)
|
||||
this.path = loc
|
||||
this.load(fs.readFileSync(this.path, 'utf8'))
|
||||
ronin.log(`Reading file.`)
|
||||
}
|
||||
|
||||
this.run = function () {
|
||||
@@ -144,7 +147,7 @@ function Source (ronin) {
|
||||
}
|
||||
|
||||
this.toString = function () {
|
||||
return this.path ? this.name() : 'unsaved'
|
||||
return this.path ? this.name() + '.lisp' : 'unsaved'
|
||||
}
|
||||
|
||||
function isDifferent (a, b) {
|
||||
|
||||
Reference in New Issue
Block a user