Support for control bindings with user-defined values (eg, for Keyboard "test" button)

This commit is contained in:
Jeff Parsons 2016-02-02 10:21:45 -08:00
commit 4ab2c21043
32 changed files with 2374 additions and 2253 deletions

View file

@ -60,6 +60,11 @@
"use strict";
if (NODE) {
var web = require("../../shared/lib/weblib");
var Component = require("../../shared/lib/component");
}
/**
* C1PComputer(parmsComputer, modules)
*
@ -166,9 +171,10 @@ C1PComputer.prototype.stop = function(msStart, nCycles)
* @param {string|null} sHTMLType is the type of the HTML control (eg, "button", "list", "text", "submit", "textarea")
* @param {string} sBinding is the value of the 'binding' parameter stored in the HTML control's "data-value" attribute (eg, "reset")
* @param {Object} control is the HTML control DOM object (eg, HTMLButtonElement)
* @param {string} [sValue] optional data value
* @return {boolean} true if binding was successful, false if unrecognized binding request
*/
C1PComputer.prototype.setBinding = function(sHTMLType, sBinding, control)
C1PComputer.prototype.setBinding = function(sHTMLType, sBinding, control, sValue)
{
switch(sBinding) {
case "reset":
@ -186,13 +192,15 @@ C1PComputer.prototype.setBinding = function(sHTMLType, sBinding, control)
};
/**
* NOTE: If there are multiple components for a given type, we may need to provide a means of discriminating.
*
* @this {C1PComputer}
* @param {string} sType
* @return {Component}
*
* NOTE: If there are multiple components for a given type, we may need to provide a means of discriminating.
* @param {string} [idRelated] of related component
* @param {Component|null} [componentPrev] of previously returned component, if any
* @return {Component|null}
*/
C1PComputer.prototype.getComponentByType = function(sType)
C1PComputer.prototype.getComponentByType = function(sType, idRelated, componentPrev)
{
if (this.modules[sType]) {
return this.modules[sType][0];

View file

@ -32,6 +32,13 @@
"use strict";
if (NODE) {
var str = require("../../shared/lib/strlib");
var usr = require("../../shared/lib/usrlib");
var web = require("../../shared/lib/weblib");
var Component = require("../../shared/lib/component");
}
/**
* C1PCPU(parmsCPU)
*
@ -506,9 +513,10 @@ C1PCPU.prototype.reset = function(fPowerOn)
* @param {string|null} sHTMLType is the type of the HTML control (eg, "button", "list", "text", "submit", "textarea")
* @param {string} sBinding is the value of the 'binding' parameter stored in the HTML control's "data-value" attribute (eg, "run")
* @param {Object} control is the HTML control DOM object (eg, HTMLButtonElement)
* @param {string} [sValue] optional data value
* @return {boolean} true if binding was successful, false if unrecognized binding request
*/
C1PCPU.prototype.setBinding = function(sHTMLType, sBinding, control)
C1PCPU.prototype.setBinding = function(sHTMLType, sBinding, control, sValue)
{
var fBound = false;
switch(sBinding) {

View file

@ -32,6 +32,13 @@
"use strict";
if (NODE) {
var str = require("../../shared/lib/strlib");
var usr = require("../../shared/lib/usrlib");
var web = require("../../shared/lib/weblib");
var Component = require("../../shared/lib/component");
}
/**
* C1PDebugger(parmsDbg)
*
@ -491,9 +498,10 @@ if (DEBUGGER) {
* @param {string|null} sHTMLType is the type of the HTML control (eg, "button", "list", "text", "submit", "textarea", "canvas")
* @param {string} sBinding is the value of the 'binding' parameter stored in the HTML control's "data-value" attribute (eg, "reset")
* @param {Object} control is the HTML control DOM object (eg, HTMLButtonElement)
* @param {string} [sValue] optional data value
* @return {boolean} true if binding was successful, false if unrecognized binding request
*/
C1PDebugger.prototype.setBinding = function(sHTMLType, sBinding, control)
C1PDebugger.prototype.setBinding = function(sHTMLType, sBinding, control, sValue)
{
var dbg = this;
switch(sBinding) {

View file

@ -32,6 +32,12 @@
"use strict";
if (NODE) {
var str = require("../../shared/lib/strlib");
var web = require("../../shared/lib/weblib");
var Component = require("../../shared/lib/component");
}
/**
* C1PDiskController(parmsDC)
*
@ -660,9 +666,10 @@ C1PDiskController.prototype.resetDrive = function(iDrive, iDriveType, nMaxTracks
* @param {string|null} sHTMLType is the type of the HTML control (eg, "button", "list", "text", "submit", "textarea")
* @param {string} sBinding is the value of the 'binding' parameter stored in the HTML control's "data-value" attribute (eg, "listDisk")
* @param {Object} control is the HTML control DOM object (eg, HTMLButtonElement)
* @param {string} [sValue] optional data value
* @return {boolean} true if binding was successful, false if unrecognized binding request
*/
C1PDiskController.prototype.setBinding = function(sHTMLType, sBinding, control)
C1PDiskController.prototype.setBinding = function(sHTMLType, sBinding, control, sValue)
{
switch(sBinding) {

View file

@ -32,6 +32,12 @@
"use strict";
if (NODE) {
var str = require("../../shared/lib/strlib");
var web = require("../../shared/lib/weblib");
var Component = require("../../shared/lib/component");
}
/**
* C1PKeyboard(parmsKbd)
*
@ -352,7 +358,7 @@ C1PKeyboard.prototype.reset = function()
*/
if (this.aKeyTimers) {
for (var i in this.aKeyTimers) {
if (isNaN(i)) continue; // ignore any non-numeric properties, if any
if (isNaN(+i)) continue; // ignore any non-numeric properties, if any
if (this.aKeyTimers[i]) clearTimeout(this.aKeyTimers[i]);
}
}
@ -391,9 +397,10 @@ C1PKeyboard.prototype.reset = function()
* @param {string|null} sHTMLType is the type of the HTML control (eg, "button", "list", "text", "submit", "textarea")
* @param {string} sBinding is the value of the 'binding' parameter stored in the HTML control's "data-value" attribute (eg, "esc", "ctrl-c")
* @param {Object} control is the HTML control DOM object (eg, HTMLButtonElement)
* @param {string} [sValue] optional data value
* @return {boolean} true if binding was successful, false if unrecognized binding request
*/
C1PKeyboard.prototype.setBinding = function(sHTMLType, sBinding, control)
C1PKeyboard.prototype.setBinding = function(sHTMLType, sBinding, control, sValue)
{
/*
* I want to bind to the first caller (ie, the Screen), not subsequent ones (eg, the Panel)
@ -524,8 +531,9 @@ C1PKeyboard.prototype.setPower = function(fOn, cmp)
/**
* @this {C1PKeyboard}
* @param {boolean} [fReady] is assumed to indicate "ready" unless EXPLICITLY set to false
*/
C1PKeyboard.prototype.setReady = function()
C1PKeyboard.prototype.setReady = function(fReady)
{
this.iOS = web.isUserAgent("iOS");
this.fMobile = (this.iOS || web.isUserAgent("Android"));
@ -536,7 +544,7 @@ C1PKeyboard.prototype.setReady = function()
};
/**
* calcReleaseDelay(fRepeat
* calcReleaseDelay(fRepeat)
*
* This attempts to scale our default "release" delay appropriately for the current CPU speed.
*

View file

@ -32,6 +32,11 @@
"use strict";
if (NODE) {
var web = require("../../shared/lib/weblib");
var Component = require("../../shared/lib/component");
}
/**
* C1PPanel(parmsPanel)
*
@ -58,15 +63,16 @@ Component.subclass(C1PPanel);
* @param {string|null} sHTMLType is the type of the HTML control (eg, "button", "list", "text", "submit", "textarea", "canvas")
* @param {string} sBinding is the value of the 'binding' parameter stored in the HTML control's "data-value" attribute (eg, "reset")
* @param {Object} control is the HTML control DOM object (eg, HTMLButtonElement)
* @param {string} [sValue] optional data value
* @return {boolean} true if binding was successful, false if unrecognized binding request
*/
C1PPanel.prototype.setBinding = function(sHTMLType, sBinding, control)
C1PPanel.prototype.setBinding = function(sHTMLType, sBinding, control, sValue)
{
if (this.cmp && this.cmp.setBinding(sHTMLType, sBinding, control)) return true;
if (this.cpu && this.cpu.setBinding(sHTMLType, sBinding, control)) return true;
if (this.kbd && this.kbd.setBinding(sHTMLType, sBinding, control)) return true;
if (DEBUGGER && this.dbg && this.dbg.setBinding(sHTMLType, sBinding, control)) return true;
return Component.prototype.setBinding.call(this, sHTMLType, sBinding, control);
if (this.cmp && this.cmp.setBinding(sHTMLType, sBinding, control, sValue)) return true;
if (this.cpu && this.cpu.setBinding(sHTMLType, sBinding, control, sValue)) return true;
if (this.kbd && this.kbd.setBinding(sHTMLType, sBinding, control, sValue)) return true;
if (DEBUGGER && this.dbg && this.dbg.setBinding(sHTMLType, sBinding, control, sValue)) return true;
return Component.prototype.setBinding.call(this, sHTMLType, sBinding, control, sValue);
};
/**

View file

@ -32,6 +32,11 @@
"use strict";
if (NODE) {
var web = require("../../shared/lib/weblib");
var Component = require("../../shared/lib/component");
}
/**
* C1PRAM(parmsRAM)
*

View file

@ -32,6 +32,13 @@
"use strict";
if (NODE) {
var str = require("../../shared/lib/strlib");
var web = require("../../shared/lib/weblib");
var DumpAPI = require("../../shared/lib/dumpapi");
var Component = require("../../shared/lib/component");
}
/**
* C1PROM(parmsROM)
*

View file

@ -32,6 +32,12 @@
"use strict";
if (NODE) {
var str = require("../../shared/lib/strlib");
var web = require("../../shared/lib/weblib");
var Component = require("../../shared/lib/component");
}
/**
* C1PSerialPort(parmsSerial)
*
@ -103,9 +109,10 @@ C1PSerialPort.prototype.start = function()
* @param {string|null} sHTMLType is the type of the HTML control (eg, "button", "list", "text", "submit", "textarea")
* @param {string} sBinding is the value of the 'binding' parameter stored in the HTML control's "data-value" attribute (eg, "listSerial")
* @param {Object} control is the HTML control DOM object (eg, HTMLButtonElement)
* @param {string} [sValue] optional data value
* @return {boolean} true if binding was successful, false if unrecognized binding request
*/
C1PSerialPort.prototype.setBinding = function(sHTMLType, sBinding, control)
C1PSerialPort.prototype.setBinding = function(sHTMLType, sBinding, control, sValue)
{
var serial = this;
@ -162,7 +169,7 @@ C1PSerialPort.prototype.setBinding = function(sHTMLType, sBinding, control)
}
else {
if (DEBUG) this.log("Local file support not available");
control.parentNode.removeChild(control);
control.parentNode.removeChild(/** @type {Node} */ (control));
}
return true;

View file

@ -32,6 +32,11 @@
"use strict";
if (NODE) {
var web = require("../../shared/lib/weblib");
var Component = require("../../shared/lib/component");
}
/**
* C1PVideo(parmsVideo, eCanvas, context, imgChars)
*
@ -183,9 +188,10 @@ C1PVideo.prototype.reset = function(fPowerOn)
* @param {string|null} sHTMLType is the type of the HTML control (eg, "button", "list", "text", "submit", "textarea")
* @param {string} sBinding is the value of the 'binding' parameter stored in the HTML control's "data-value" attribute (eg, "refresh")
* @param {Object} control is the HTML control DOM object (eg, HTMLButtonElement)
* @param {string} [sValue] optional data value
* @return {boolean} true if binding was successful, false if unrecognized binding request
*/
C1PVideo.prototype.setBinding = function(sHTMLType, sBinding, control)
C1PVideo.prototype.setBinding = function(sHTMLType, sBinding, control, sValue)
{
switch(sBinding) {
case "refresh":
@ -345,15 +351,16 @@ C1PVideo.prototype.setPower = function(fOn, cmp)
};
/**
* @this {C1PVideo}
*
* cxChar and cyChar are the source cell size. Originally, those values came strictly from the parmsVideo
* 'charWidth' and 'charHeight' properties. Now, if those aren't defined (which is normally the case now),
* then we infer the source cell size from the dimensions of imgChars, which is expected to be a 16x16 array of
* character bitmaps. We could be even more flexible, by allowing imgChars to be any rectangular dimension
* (eg, 1x256) as long as we can assume it contains exactly 256 characters, but there's no need to get carried away....
*
* @this {C1PVideo}
* @param {boolean} [fReady] is assumed to indicate "ready" unless EXPLICITLY set to false
*/
C1PVideo.prototype.setReady = function()
C1PVideo.prototype.setReady = function(fReady)
{
if (!this.cxChar) this.cxChar = Math.floor(this.imgChars.width / 16);
if (!this.cyChar) this.cyChar = Math.floor(this.imgChars.height / 16);

View file

@ -21,7 +21,7 @@
<xsl:template name="componentScripts">
<xsl:param name="component"/>
<script type="text/javascript" src="/versions/{$APPCLASS}/{$APPVERSION}/{$component}.js"></script>
<script type="text/javascript" src="/versions/{$APPCLASS}/{$APPVERSION}/{$component}.js"> </script>
</xsl:template>
<xsl:template name="componentIncludes">
@ -157,7 +157,7 @@
</xsl:if>
<div class="{$APPCLASS}-container" style="{$border}{$style}">
<xsl:if test="$class != '' and $component != 'machine'">
<div class="{$APPCLASS}-{$class}-object" data-value="{{id:'{$id}',name:'{$name}'{$parms}}}"></div>
<div class="{$APPCLASS}-{$class}-object" data-value="{{id:'{$id}',name:'{$name}'{$parms}}}"> </div>
</xsl:if>
<xsl:if test="control">
<div class="{$APPCLASS}-controls">
@ -174,7 +174,7 @@
<div class="{$APPCLASS}-copyright">
<a href="http://{$SITEHOST}/{$APPCLASS}" target="_blank">C1Pjs</a> v<xsl:value-of select="$APPVERSION"/> © 2012-2016 by <a href="http://twitter.com/jeffpar" target="_blank">@jeffpar</a>
</div>
<div style="clear:both"></div>
<div style="clear:both"> </div>
</xsl:if>
</div>
</xsl:template>
@ -284,7 +284,7 @@
<input class="{$APPCLASS}-binding" type="submit" style="{$border}{$fontsize}{$style}" data-value="{{{$type},{$binding}}}" value="{.}"/>
</xsl:when>
<xsl:when test="@type = 'textarea'">
<textarea class="{$APPCLASS}-binding" style="{$border}{$width}{$height}{$style}" data-value="{{{$type},{$binding}}}" readonly="readonly"></textarea>
<textarea class="{$APPCLASS}-binding" style="{$border}{$width}{$height}{$style}" data-value="{{{$type},{$binding}}}" readonly="readonly"> </textarea>
</xsl:when>
<xsl:when test="@type = 'heading'">
<div><xsl:value-of select="."/></div>
@ -301,7 +301,7 @@
<hr/>
</xsl:when>
<xsl:when test="not(@type)">
<div style="clear:both"></div><br/>
<div style="clear:both"> </div><br/>
</xsl:when>
<xsl:otherwise>
<div class="{$APPCLASS}-binding{$subclass}" style="{$border}{$width}{$height}{$style}" data-value="{{{$type},{$binding}}}"><xsl:apply-templates/></div>
@ -311,7 +311,7 @@
<xsl:if test="@labelpos = 'right'">
<div class="{$APPCLASS}-label" style="{$labelwidth}{$labelstyle}"><xsl:value-of select="@label"/></div>
</xsl:if>
<div style="clear:both"></div>
<div style="clear:both"> </div>
</xsl:if>
</div>
</xsl:template>

View file

@ -994,15 +994,16 @@ ChipSet.FPU = { // TODO: Define a variable for this?
};
/**
* setBinding(sHTMLType, sBinding, control)
* setBinding(sHTMLType, sBinding, control, sValue)
*
* @this {ChipSet}
* @param {string|null} sHTMLType is the type of the HTML control (eg, "button", "list", "text", "submit", "textarea", "canvas")
* @param {string} sBinding is the value of the 'binding' parameter stored in the HTML control's "data-value" attribute (eg, "sw1")
* @param {Object} control is the HTML control DOM object (eg, HTMLButtonElement)
* @param {string} [sValue] optional data value
* @return {boolean} true if binding was successful, false if unrecognized binding request
*/
ChipSet.prototype.setBinding = function(sHTMLType, sBinding, control)
ChipSet.prototype.setBinding = function(sHTMLType, sBinding, control, sValue)
{
switch (sBinding) {
case ChipSet.CONTROLS.SW1:

View file

@ -1002,15 +1002,16 @@ Computer.prototype.stop = function(ms, nCycles)
};
/**
* setBinding(sHTMLType, sBinding, control)
* setBinding(sHTMLType, sBinding, control, sValue)
*
* @this {Computer}
* @param {string|null} sHTMLType is the type of the HTML control (eg, "button", "list", "text", "submit", "textarea", "canvas")
* @param {string} sBinding is the value of the 'binding' parameter stored in the HTML control's "data-value" attribute (eg, "reset")
* @param {Object} control is the HTML control DOM object (eg, HTMLButtonElement)
* @param {string} [sValue] optional data value
* @return {boolean} true if binding was successful, false if unrecognized binding request
*/
Computer.prototype.setBinding = function(sHTMLType, sBinding, control)
Computer.prototype.setBinding = function(sHTMLType, sBinding, control, sValue)
{
var computer = this;

View file

@ -517,15 +517,16 @@ CPU.prototype.setFocus = function()
};
/**
* setBinding(sHTMLType, sBinding, control)
* setBinding(sHTMLType, sBinding, control, sValue)
*
* @this {CPU}
* @param {string|null} sHTMLType is the type of the HTML control (eg, "button", "list", "text", "submit", "textarea", "canvas")
* @param {string} sBinding is the value of the 'binding' parameter stored in the HTML control's "data-value" attribute (eg, "run")
* @param {Object} control is the HTML control DOM object (eg, HTMLButtonElement)
* @param {string} [sValue] optional data value
* @return {boolean} true if binding was successful, false if unrecognized binding request
*/
CPU.prototype.setBinding = function(sHTMLType, sBinding, control)
CPU.prototype.setBinding = function(sHTMLType, sBinding, control, sValue)
{
var cpu = this;
var fBound = false;

View file

@ -2084,15 +2084,16 @@ if (DEBUGGER) {
}
/**
* setBinding(sHTMLType, sBinding, control)
* setBinding(sHTMLType, sBinding, control, sValue)
*
* @this {Debugger}
* @param {string|null} sHTMLType is the type of the HTML control (eg, "button", "list", "text", "submit", "textarea", "canvas")
* @param {string} sBinding is the value of the 'binding' parameter stored in the HTML control's "data-value" attribute (eg, "debugInput")
* @param {Object} control is the HTML control DOM object (eg, HTMLButtonElement)
* @param {string} [sValue] optional data value
* @return {boolean} true if binding was successful, false if unrecognized binding request
*/
Debugger.prototype.setBinding = function(sHTMLType, sBinding, control)
Debugger.prototype.setBinding = function(sHTMLType, sBinding, control, sValue)
{
var dbg = this;
switch (sBinding) {

View file

@ -401,15 +401,16 @@ FDC.aCmdInfo = {
};
/**
* setBinding(sHTMLType, sBinding, control)
* setBinding(sHTMLType, sBinding, control, sValue)
*
* @this {FDC}
* @param {string|null} sHTMLType is the type of the HTML control (eg, "button", "list", "text", "submit", "textarea", "canvas")
* @param {string} sBinding is the value of the 'binding' parameter stored in the HTML control's "data-value" attribute (eg, "listDisks")
* @param {Object} control is the HTML control DOM object (eg, HTMLButtonElement)
* @param {string} [sValue] optional data value
* @return {boolean} true if binding was successful, false if unrecognized binding request
*/
FDC.prototype.setBinding = function(sHTMLType, sBinding, control)
FDC.prototype.setBinding = function(sHTMLType, sBinding, control, sValue)
{
var fdc = this;

View file

@ -553,15 +553,16 @@ if (DEBUG) {
}
/**
* setBinding(sHTMLType, sBinding, control)
* setBinding(sHTMLType, sBinding, control, sValue)
*
* @this {HDC}
* @param {string|null} sHTMLType is the type of the HTML control (eg, "button", "list", "text", "submit", "textarea", "canvas")
* @param {string} sBinding is the value of the 'binding' parameter stored in the HTML control's "data-value" attribute (eg, "listDisks")
* @param {Object} control is the HTML control DOM object (eg, HTMLButtonElement)
* @param {string} [sValue] optional data value
* @return {boolean} true if binding was successful, false if unrecognized binding request
*/
HDC.prototype.setBinding = function(sHTMLType, sBinding, control)
HDC.prototype.setBinding = function(sHTMLType, sBinding, control, sValue)
{
/*
* This is reserved for future use; for now, hard disk images can be specified during initialization only (no "hot-swapping")

View file

@ -970,15 +970,16 @@ Keyboard.LIMIT = {
};
/**
* setBinding(sHTMLType, sBinding, control)
* setBinding(sHTMLType, sBinding, control, sValue)
*
* @this {Keyboard}
* @param {string|null} sHTMLType is the type of the HTML control (eg, "button", "list", "text", "submit", "textarea", "canvas")
* @param {string} sBinding is the value of the 'binding' parameter stored in the HTML control's "data-value" attribute (eg, "esc")
* @param {Object} control is the HTML control DOM object (eg, HTMLButtonElement)
* @param {string} [sValue] optional data value
* @return {boolean} true if binding was successful, false if unrecognized binding request
*/
Keyboard.prototype.setBinding = function(sHTMLType, sBinding, control)
Keyboard.prototype.setBinding = function(sHTMLType, sBinding, control, sValue)
{
/*
* There's a special binding that the Video component uses ("kbd") to effectively bind its
@ -1047,6 +1048,14 @@ Keyboard.prototype.setBinding = function(sHTMLType, sBinding, control)
};
return true;
case "test":
this.bindings[id] = control;
control.onclick = function onClickTest(event) {
if (kbd.cpu) kbd.cpu.setFocus();
return kbd.injectKeys(sValue);
};
return true;
default:
/*
* Maintain support for older button codes; eg, map button code "ctrl-c" to CLICKCODE "CTRL_C"
@ -1562,17 +1571,19 @@ Keyboard.prototype.addScanCode = function(bScan)
};
/**
* injectKeys(sKeyCodes, msDelay)
* injectKeys(sKeys, msDelay)
*
* @this {Keyboard}
* @param {string} sKeyCodes
* @param {number|undefined} [msDelay] is an optional injection delay (default is msInjectDelay)
* @param {string|undefined} sKeys
* @param {number} [msDelay] is an optional injection delay (default is msInjectDelay)
*/
Keyboard.prototype.injectKeys = function(sKeyCodes, msDelay)
Keyboard.prototype.injectKeys = function(sKeys, msDelay)
{
this.sInjectBuffer = sKeyCodes;
if (!COMPILED) this.log("injectKeys(" + this.sInjectBuffer.split("\n").join("\\n") + ")");
this.injectKeysFromBuffer(msDelay || this.msInjectDelay);
if (sKeys && !this.sInjectBuffer) {
this.sInjectBuffer = sKeys;
if (!COMPILED) this.log("injectKeys(" + this.sInjectBuffer.split("\n").join("\\n") + ")");
this.injectKeysFromBuffer(msDelay || this.msInjectDelay);
}
};
/**

View file

@ -235,7 +235,7 @@ Rectangle.prototype.drawWith = function(context, color)
};
/**
* setBinding(sHTMLType, sBinding, control)
* setBinding(sHTMLType, sBinding, control, sValue)
*
* Most panel layouts don't have bindings of their own, so we pass along all binding requests to the
* Computer, CPU, Keyboard and Debugger components first. The order shouldn't matter, since any component
@ -245,14 +245,15 @@ Rectangle.prototype.drawWith = function(context, color)
* @param {string|null} sHTMLType is the type of the HTML control (eg, "button", "list", "text", "submit", "textarea", "canvas")
* @param {string} sBinding is the value of the 'binding' parameter stored in the HTML control's "data-value" attribute (eg, "reset")
* @param {Object} control is the HTML control DOM object (eg, HTMLButtonElement)
* @param {string} [sValue] optional data value
* @return {boolean} true if binding was successful, false if unrecognized binding request
*/
Panel.prototype.setBinding = function(sHTMLType, sBinding, control)
Panel.prototype.setBinding = function(sHTMLType, sBinding, control, sValue)
{
if (this.cmp && this.cmp.setBinding(sHTMLType, sBinding, control)) return true;
if (this.cpu && this.cpu.setBinding(sHTMLType, sBinding, control)) return true;
if (this.kbd && this.kbd.setBinding(sHTMLType, sBinding, control)) return true;
if (DEBUGGER && this.dbg && this.dbg.setBinding(sHTMLType, sBinding, control)) return true;
if (this.cmp && this.cmp.setBinding(sHTMLType, sBinding, control, sValue)) return true;
if (this.cpu && this.cpu.setBinding(sHTMLType, sBinding, control, sValue)) return true;
if (this.kbd && this.kbd.setBinding(sHTMLType, sBinding, control, sValue)) return true;
if (DEBUGGER && this.dbg && this.dbg.setBinding(sHTMLType, sBinding, control, sValue)) return true;
if (!this.canvas && sHTMLType == "canvas") {
@ -330,7 +331,7 @@ Panel.prototype.setBinding = function(sHTMLType, sBinding, control)
return true;
}
}
return this.parent.setBinding.call(this, sHTMLType, sBinding, control);
return this.parent.setBinding.call(this, sHTMLType, sBinding, control, sValue);
};
/**

View file

@ -342,15 +342,16 @@ SerialPort.prototype.syncMouse = function()
*/
/**
* setBinding(sHTMLType, sBinding, control)
* setBinding(sHTMLType, sBinding, control, sValue)
*
* @this {SerialPort}
* @param {string|null} sHTMLType is the type of the HTML control (eg, "button", "list", "text", "submit", "textarea", "canvas")
* @param {string} sBinding is the value of the 'binding' parameter stored in the HTML control's "data-value" attribute (eg, "buffer")
* @param {Object} control is the HTML control DOM object (eg, HTMLButtonElement)
* @param {string} [sValue] optional data value
* @return {boolean} true if binding was successful, false if unrecognized binding request
*/
SerialPort.prototype.setBinding = function(sHTMLType, sBinding, control)
SerialPort.prototype.setBinding = function(sHTMLType, sBinding, control, sValue)
{
var serial = this;

View file

@ -2909,15 +2909,16 @@ Video.prototype.initBus = function(cmp, bus, cpu, dbg)
};
/**
* setBinding(sHTMLType, sBinding, control)
* setBinding(sHTMLType, sBinding, control, sValue)
*
* @this {Video}
* @param {string|null} sHTMLType is the type of the HTML control (eg, "button", "list", "text", "submit", "textarea", "canvas")
* @param {string} sBinding is the value of the 'binding' parameter stored in the HTML control's "data-value" attribute (eg, "refresh")
* @param {Object} control is the HTML control DOM object (eg, HTMLButtonElement)
* @param {string} [sValue] optional data value
* @return {boolean} true if binding was successful, false if unrecognized binding request
*/
Video.prototype.setBinding = function(sHTMLType, sBinding, control)
Video.prototype.setBinding = function(sHTMLType, sBinding, control, sValue)
{
var video = this;

View file

@ -2947,15 +2947,16 @@ X86CPU.prototype.checkIOPM = function(port, nPorts, fInput)
};
/**
* setBinding(sHTMLType, sBinding, control)
* setBinding(sHTMLType, sBinding, control, sValue)
*
* @this {X86CPU}
* @param {string|null} sHTMLType is the type of the HTML control (eg, "button", "list", "text", "submit", "textarea", "canvas")
* @param {string} sBinding is the value of the 'binding' parameter stored in the HTML control's "data-value" attribute (eg, "AX")
* @param {Object} control is the HTML control DOM object (eg, HTMLButtonElement)
* @param {string} [sValue] optional data value
* @return {boolean} true if binding was successful, false if unrecognized binding request
*/
X86CPU.prototype.setBinding = function(sHTMLType, sBinding, control)
X86CPU.prototype.setBinding = function(sHTMLType, sBinding, control, sValue)
{
var fBound = false;
switch (sBinding) {

View file

@ -266,6 +266,9 @@
<xsl:variable name="binding">
<xsl:text>binding:'</xsl:text><xsl:value-of select="@binding"/><xsl:text>'</xsl:text>
</xsl:variable>
<xsl:variable name="value">
<xsl:text>value:'</xsl:text><xsl:value-of select="@value"/><xsl:text>'</xsl:text>
</xsl:variable>
<xsl:variable name="border">
<xsl:choose>
<xsl:when test="@border = '1'">border:1px solid black;</xsl:when>
@ -363,7 +366,7 @@
<canvas class="{$APPCLASS}-binding {$APPCLASS}-canvas" width="{@width}" height="{@height}" style="-webkit-user-select:none;{$border}{$fontsize}{$style}" data-value="{{{$type},{$binding}}}"><xsl:apply-templates/></canvas>
</xsl:when>
<xsl:when test="@type = 'button'">
<button class="{$APPCLASS}-binding" style="-webkit-user-select:none;{$border}{$width}{$height}{$fontsize}{$style}" data-value="{{{$type},{$binding}}}"><xsl:apply-templates/></button>
<button class="{$APPCLASS}-binding" style="-webkit-user-select:none;{$border}{$width}{$height}{$fontsize}{$style}" data-value="{{{$type},{$binding},{$value}}}"><xsl:apply-templates/></button>
</xsl:when>
<xsl:when test="@type = 'list'">
<select class="{$APPCLASS}-binding" style="{$border}{$width}{$height}{$fontsize}{$style}" data-value="{{{$type},{$binding}}}">
@ -531,7 +534,7 @@
<xsl:variable name="stepping">
<xsl:choose>
<xsl:when test="@stepping"><xsl:value-of select="@stepping"/></xsl:when>
<xsl:otherwise></xsl:otherwise>
<xsl:otherwise/>
</xsl:choose>
</xsl:variable>
<xsl:variable name="fpu">
@ -600,7 +603,7 @@
<xsl:variable name="stepping">
<xsl:choose>
<xsl:when test="@stepping"><xsl:value-of select="@stepping"/></xsl:when>
<xsl:otherwise></xsl:otherwise>
<xsl:otherwise/>
</xsl:choose>
</xsl:variable>
<xsl:call-template name="component">
@ -956,7 +959,7 @@
<xsl:variable name="touchScreen">
<xsl:choose>
<xsl:when test="@touchscreen"><xsl:value-of select="@touchscreen"/></xsl:when>
<xsl:otherwise></xsl:otherwise>
<xsl:otherwise/>
</xsl:choose>
</xsl:variable>
<xsl:variable name="autoLock">

View file

@ -526,7 +526,7 @@ Component.bindComponentControls = function(component, element, sAppClass)
case sAppClass + "-binding":
parms = Component.getComponentParms(control);
if (parms && parms['binding']) {
component.setBinding(parms['type'], parms['binding'], control);
component.setBinding(parms['type'], parms['binding'], control, parms['value']);
} else {
Component.log("Component '" + component.toString() + "' missing binding" + (parms? " for " + parms['type'] : ""), "warning");
}
@ -606,7 +606,7 @@ Component.prototype = {
return nMachine;
},
/**
* setBinding(sHTMLType, sBinding, control)
* setBinding(sHTMLType, sBinding, control, sValue)
*
* Component's setBinding() method is intended to be overridden by subclasses.
*
@ -614,9 +614,10 @@ Component.prototype = {
* @param {string|null} sHTMLType is the type of the HTML control (eg, "button", "list", "text", "submit", "textarea", "canvas")
* @param {string} sBinding is the value of the 'binding' parameter stored in the HTML control's "data-value" attribute (eg, "reset")
* @param {Object} control is the HTML control DOM object (eg, HTMLButtonElement)
* @param {string} [sValue] optional data value
* @return {boolean} true if binding was successful, false if unrecognized binding request
*/
setBinding: function(sHTMLType, sBinding, control) {
setBinding: function(sHTMLType, sBinding, control, sValue) {
switch (sBinding) {
case "clear":
if (!this.bindings[sBinding]) {