Removed useless sHTMLClass parameter from all setBinding() methods
HTML controls with bindings are now identified by the single class attribute of "{APPCLASS}-binding" instead of the somewhat arbitrary "{APPCLASS}-input" or "{APPCLASS}-output" classes
This commit is contained in:
parent
f8864beb20
commit
64b2494eef
32 changed files with 221 additions and 246 deletions
|
|
@ -889,13 +889,12 @@ ChipSet.COPROC = { // TODO: Define a variable for this
|
|||
|
||||
/**
|
||||
* @this {ChipSet}
|
||||
* @param {string|null} sHTMLClass is the class of the HTML control (eg, "input", "output")
|
||||
* @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)
|
||||
* @return {boolean} true if binding was successful, false if unrecognized binding request
|
||||
*/
|
||||
ChipSet.prototype.setBinding = function(sHTMLClass, sHTMLType, sBinding, control)
|
||||
ChipSet.prototype.setBinding = function(sHTMLType, sBinding, control)
|
||||
{
|
||||
switch (sBinding) {
|
||||
case "sw1":
|
||||
|
|
|
|||
|
|
@ -894,16 +894,15 @@ Computer.prototype.stop = function(ms, nCycles)
|
|||
};
|
||||
|
||||
/**
|
||||
* setBinding(sHTMLClass, sHTMLType, sBinding, control)
|
||||
* setBinding(sHTMLType, sBinding, control)
|
||||
*
|
||||
* @this {Computer}
|
||||
* @param {string|null} sHTMLClass is the class of the HTML control (eg, "input", "output")
|
||||
* @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)
|
||||
* @return {boolean} true if binding was successful, false if unrecognized binding request
|
||||
*/
|
||||
Computer.prototype.setBinding = function(sHTMLClass, sHTMLType, sBinding, control)
|
||||
Computer.prototype.setBinding = function(sHTMLType, sBinding, control)
|
||||
{
|
||||
var computer = this;
|
||||
switch (sBinding) {
|
||||
|
|
|
|||
|
|
@ -477,16 +477,15 @@ CPU.prototype.displayVideo = function()
|
|||
};
|
||||
|
||||
/**
|
||||
* setBinding(sHTMLClass, sHTMLType, sBinding, control)
|
||||
* setBinding(sHTMLType, sBinding, control)
|
||||
*
|
||||
* @this {CPU}
|
||||
* @param {string|null} sHTMLClass is the class of the HTML control (eg, "input", "output")
|
||||
* @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)
|
||||
* @return {boolean} true if binding was successful, false if unrecognized binding request
|
||||
*/
|
||||
CPU.prototype.setBinding = function(sHTMLClass, sHTMLType, sBinding, control)
|
||||
CPU.prototype.setBinding = function(sHTMLType, sBinding, control)
|
||||
{
|
||||
var cpu = this;
|
||||
var fBound = false;
|
||||
|
|
|
|||
|
|
@ -1207,16 +1207,15 @@ if (DEBUGGER) {
|
|||
};
|
||||
|
||||
/**
|
||||
* setBinding(sHTMLClass, sHTMLType, sBinding, control)
|
||||
* setBinding(sHTMLType, sBinding, control)
|
||||
*
|
||||
* @this {Debugger}
|
||||
* @param {string|null} sHTMLClass is the class of the HTML control (eg, "input", "output")
|
||||
* @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)
|
||||
* @return {boolean} true if binding was successful, false if unrecognized binding request
|
||||
*/
|
||||
Debugger.prototype.setBinding = function(sHTMLClass, sHTMLType, sBinding, control)
|
||||
Debugger.prototype.setBinding = function(sHTMLType, sBinding, control)
|
||||
{
|
||||
var dbg = this;
|
||||
switch (sBinding) {
|
||||
|
|
|
|||
|
|
@ -407,16 +407,15 @@ FDC.aCmdInfo = {
|
|||
};
|
||||
|
||||
/**
|
||||
* setBinding(sHTMLClass, sHTMLType, sBinding, control)
|
||||
* setBinding(sHTMLType, sBinding, control)
|
||||
*
|
||||
* @this {FDC}
|
||||
* @param {string|null} sHTMLClass is the class of the HTML control (eg, "input", "output")
|
||||
* @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)
|
||||
* @return {boolean} true if binding was successful, false if unrecognized binding request
|
||||
*/
|
||||
FDC.prototype.setBinding = function(sHTMLClass, sHTMLType, sBinding, control)
|
||||
FDC.prototype.setBinding = function(sHTMLType, sBinding, control)
|
||||
{
|
||||
var fdc = this;
|
||||
|
||||
|
|
|
|||
|
|
@ -493,16 +493,15 @@ HDC.BIOS.DISK_CMD = {
|
|||
};
|
||||
|
||||
/**
|
||||
* setBinding(sHTMLClass, sHTMLType, sBinding, control)
|
||||
* setBinding(sHTMLType, sBinding, control)
|
||||
*
|
||||
* @this {HDC}
|
||||
* @param {string|null} sHTMLClass is the class of the HTML control (eg, "input", "output")
|
||||
* @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)
|
||||
* @return {boolean} true if binding was successful, false if unrecognized binding request
|
||||
*/
|
||||
HDC.prototype.setBinding = function(sHTMLClass, sHTMLType, sBinding, control)
|
||||
HDC.prototype.setBinding = function(sHTMLType, sBinding, control)
|
||||
{
|
||||
/*
|
||||
* This is reserved for future use; for now, hard disk images can be specified during initialization only (no "hot-swapping")
|
||||
|
|
|
|||
|
|
@ -770,29 +770,28 @@ Keyboard.LIMIT = {
|
|||
};
|
||||
|
||||
/**
|
||||
* setBinding(sHTMLClass, sHTMLType, sBinding, control)
|
||||
* setBinding(sHTMLType, sBinding, control)
|
||||
*
|
||||
* @this {Keyboard}
|
||||
* @param {string|null} sHTMLClass is the class of the HTML control (eg, "input", "output")
|
||||
* @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)
|
||||
* @return {boolean} true if binding was successful, false if unrecognized binding request
|
||||
*/
|
||||
Keyboard.prototype.setBinding = function(sHTMLClass, sHTMLType, sBinding, control)
|
||||
Keyboard.prototype.setBinding = function(sHTMLType, sBinding, control)
|
||||
{
|
||||
/*
|
||||
* There's a special binding that the Video component uses ("kbd") to effectively bind its
|
||||
* canvas to the entire keyboard, in Video.powerUp(); ie:
|
||||
*
|
||||
* video.kbd.setBinding("input", "canvas", "kbd", video.canvasScreen);
|
||||
* video.kbd.setBinding("canvas", "kbd", video.canvasScreen);
|
||||
* or:
|
||||
* video.kbd.setBinding("input", "textarea", "kbd", video.textareaScreen);
|
||||
* video.kbd.setBinding("textarea", "kbd", video.textareaScreen);
|
||||
*
|
||||
* However, it's also possible for the keyboard XML definition to define a control that serves
|
||||
* a similar purpose; eg:
|
||||
*
|
||||
* <control class="input" type="text" binding="kbd" width="2em">Kbd</control>
|
||||
* <control type="text" binding="kbd" width="2em">Kbd</control>
|
||||
*
|
||||
* The latter is purely experimental, while we work on finding ways to trigger the soft keyboard on
|
||||
* certain pesky devices (like the Kindle Fire). Note that even if you use the latter, the former will
|
||||
|
|
|
|||
|
|
@ -53,29 +53,28 @@ function Panel(parmsPanel) {
|
|||
Component.subclass(Component, Panel);
|
||||
|
||||
/**
|
||||
* setBinding(sHTMLClass, sHTMLType, sBinding, control)
|
||||
* setBinding(sHTMLType, sBinding, control)
|
||||
*
|
||||
* The Panel doesn't have any bindings of its own; it passes along all binding requests to
|
||||
* the Computer, CPU, Keyboard and Debugger components. The order shouldn't matter, since any
|
||||
* component that doesn't recognize the specified binding should simply ignore it.
|
||||
*
|
||||
* @this {Panel}
|
||||
* @param {string|null} sHTMLClass is the class of the HTML control (eg, "input", "output")
|
||||
* @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)
|
||||
* @return {boolean} true if binding was successful, false if unrecognized binding request
|
||||
*/
|
||||
Panel.prototype.setBinding = function(sHTMLClass, sHTMLType, sBinding, control)
|
||||
Panel.prototype.setBinding = function(sHTMLType, sBinding, control)
|
||||
{
|
||||
if (this.cmp && this.cmp.setBinding(sHTMLClass, sHTMLType, sBinding, control)) return true;
|
||||
if (this.cpu && this.cpu.setBinding(sHTMLClass, sHTMLType, sBinding, control)) return true;
|
||||
if (this.kbd && this.kbd.setBinding(sHTMLClass, sHTMLType, sBinding, control)) return true;
|
||||
if (DEBUGGER && this.dbg && this.dbg.setBinding(sHTMLClass, sHTMLType, sBinding, control)) return true;
|
||||
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;
|
||||
/*
|
||||
* TODO: Determine how to declare this superclass method in order to avoid a type warning
|
||||
*/
|
||||
return Component.prototype.setBinding.call(this, sHTMLClass, sHTMLType, sBinding, control);
|
||||
return Component.prototype.setBinding.call(this, sHTMLType, sBinding, control);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -282,16 +282,15 @@ SerialPort.prototype.syncMouse = function() {
|
|||
*/
|
||||
|
||||
/**
|
||||
* setBinding(sHTMLClass, sHTMLType, sBinding, control)
|
||||
* setBinding(sHTMLType, sBinding, control)
|
||||
*
|
||||
* @this {SerialPort}
|
||||
* @param {string|null} sHTMLClass is the class of the HTML control (eg, "input", "output")
|
||||
* @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)
|
||||
* @return {boolean} true if binding was successful, false if unrecognized binding request
|
||||
*/
|
||||
SerialPort.prototype.setBinding = function(sHTMLClass, sHTMLType, sBinding, control) {
|
||||
SerialPort.prototype.setBinding = function(sHTMLType, sBinding, control) {
|
||||
var serial = this;
|
||||
switch (sBinding) {
|
||||
case SerialPort.sIOBuffer:
|
||||
|
|
|
|||
|
|
@ -1983,9 +1983,9 @@ Video.prototype.initBus = function(cmp, bus, cpu, dbg)
|
|||
this.kbd = cmp.getComponentByType("Keyboard");
|
||||
if (this.kbd && this.canvasScreen) {
|
||||
for (var s in this.bindings) {
|
||||
if (s.indexOf("lock") > 0) this.kbd.setBinding("input", "led", s, this.bindings[s]);
|
||||
if (s.indexOf("lock") > 0) this.kbd.setBinding("led", s, this.bindings[s]);
|
||||
}
|
||||
this.kbd.setBinding("input", this.textareaScreen? "textarea" : "canvas", "kbd", this.textareaScreen || this.canvasScreen);
|
||||
this.kbd.setBinding(this.textareaScreen? "textarea" : "canvas", "kbd", this.textareaScreen || this.canvasScreen);
|
||||
}
|
||||
|
||||
this.bEGASW = 0x9; // our default "switches" setting (see aEGAMonitorSwitches)
|
||||
|
|
@ -1998,16 +1998,15 @@ Video.prototype.initBus = function(cmp, bus, cpu, dbg)
|
|||
};
|
||||
|
||||
/**
|
||||
* setBinding(sHTMLClass, sHTMLType, sBinding, control)
|
||||
* setBinding(sHTMLType, sBinding, control)
|
||||
*
|
||||
* @this {Video}
|
||||
* @param {string|null} sHTMLClass is the class of the HTML control (eg, "input", "output")
|
||||
* @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)
|
||||
* @return {boolean} true if binding was successful, false if unrecognized binding request
|
||||
*/
|
||||
Video.prototype.setBinding = function(sHTMLClass, sHTMLType, sBinding, control)
|
||||
Video.prototype.setBinding = function(sHTMLType, sBinding, control)
|
||||
{
|
||||
var video = this;
|
||||
var canvas, lockPointer;
|
||||
|
|
|
|||
|
|
@ -1682,16 +1682,15 @@ X86CPU.prototype.traceLog = function(prop, dst, src, flagsIn, flagsOut, result)
|
|||
};
|
||||
|
||||
/**
|
||||
* setBinding(sHTMLClass, sHTMLType, sBinding, control)
|
||||
* setBinding(sHTMLType, sBinding, control)
|
||||
*
|
||||
* @this {X86CPU}
|
||||
* @param {string|null} sHTMLClass is the class of the HTML control (eg, "input", "output")
|
||||
* @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)
|
||||
* @return {boolean} true if binding was successful, false if unrecognized binding request
|
||||
*/
|
||||
X86CPU.prototype.setBinding = function(sHTMLClass, sHTMLType, sBinding, control)
|
||||
X86CPU.prototype.setBinding = function(sHTMLType, sBinding, control)
|
||||
{
|
||||
var fBound = false;
|
||||
switch (sBinding) {
|
||||
|
|
@ -1723,7 +1722,7 @@ X86CPU.prototype.setBinding = function(sHTMLClass, sHTMLType, sBinding, control)
|
|||
fBound = true;
|
||||
break;
|
||||
default:
|
||||
fBound = CPU.prototype.setBinding.call(this, sHTMLClass, sHTMLType, sBinding, control);
|
||||
fBound = CPU.prototype.setBinding.call(this, sHTMLType, sBinding, control);
|
||||
break;
|
||||
}
|
||||
return fBound;
|
||||
|
|
|
|||
|
|
@ -351,27 +351,27 @@
|
|||
</xsl:if>
|
||||
<xsl:choose>
|
||||
<xsl:when test="@type = 'button'">
|
||||
<button class="{$APPCLASS}-{@class}" 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}"><xsl:apply-templates/></button>
|
||||
</xsl:when>
|
||||
<xsl:when test="@type = 'list'">
|
||||
<select class="{$APPCLASS}-{@class}" style="{$border}{$width}{$height}{$fontsize}{$style}" data-value="{$type},{$binding}">
|
||||
<select class="{$APPCLASS}-binding" style="{$border}{$width}{$height}{$fontsize}{$style}" data-value="{$type},{$binding}">
|
||||
<xsl:apply-templates select="disk|app|manifest" mode="component"/>
|
||||
</select>
|
||||
</xsl:when>
|
||||
<xsl:when test="@type = 'text'">
|
||||
<input class="{$APPCLASS}-{@class}" type="text" style="{$border}{$width}{$height}{$style}" data-value="{$type},{$binding}" value="{.}" autocapitalize="off" autocorrect="off"/>
|
||||
<input class="{$APPCLASS}-binding" type="text" style="{$border}{$width}{$height}{$style}" data-value="{$type},{$binding}" value="{.}" autocapitalize="off" autocorrect="off"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="@type = 'submit'">
|
||||
<input class="{$APPCLASS}-{@class}" type="submit" style="{$border}{$fontsize}{$style}" data-value="{$type},{$binding}" value="{.}"/>
|
||||
<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}-{@class}" 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>
|
||||
</xsl:when>
|
||||
<xsl:when test="@type = 'file'">
|
||||
<form class="{$APPCLASS}-{@class}" data-value="{$type},{$binding}">
|
||||
<form class="{$APPCLASS}-binding" data-value="{$type},{$binding}">
|
||||
<fieldset class="{$APPCLASS}-fieldset">
|
||||
<input type="file"/>
|
||||
<input type="submit" value="Load" disabled="true"/>
|
||||
|
|
@ -379,7 +379,7 @@
|
|||
</form>
|
||||
</xsl:when>
|
||||
<xsl:when test="@type = 'led'">
|
||||
<div class="{$APPCLASS}-{@class} {$APPCLASS}-{@type}" data-value="{$type},{$binding}"><xsl:value-of select="."/></div>
|
||||
<div class="{$APPCLASS}-binding {$APPCLASS}-{@type}" data-value="{$type},{$binding}"><xsl:value-of select="."/></div>
|
||||
</xsl:when>
|
||||
<xsl:when test="@type = 'separator'">
|
||||
<hr/>
|
||||
|
|
@ -391,7 +391,7 @@
|
|||
<div style="clear:both"> </div>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<div class="{$APPCLASS}-{@class}{$subClass} {$APPCLASS}-{@type}" style="-webkit-user-select:none;{$border}{$width}{$height}{$fontsize}{$style}" data-value="{$type},{$binding}"><xsl:apply-templates/></div>
|
||||
<div class="{$APPCLASS}-binding{$subClass} {$APPCLASS}-{@type}" style="-webkit-user-select:none;{$border}{$width}{$height}{$fontsize}{$style}" data-value="{$type},{$binding}"><xsl:apply-templates/></div>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:if test="@label">
|
||||
|
|
|
|||
Loading…
Reference in a new issue