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:
Jeff Parsons 2014-11-15 18:16:48 -08:00 committed by jeffpar
commit 64b2494eef
32 changed files with 221 additions and 246 deletions

View file

@ -163,13 +163,12 @@ C1PComputer.prototype.stop = function(msStart, nCycles)
/**
* @this {C1PComputer}
* @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")
* @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
*/
C1PComputer.prototype.setBinding = function(sHTMLClass, sHTMLType, sBinding, control)
C1PComputer.prototype.setBinding = function(sHTMLType, sBinding, control)
{
switch(sBinding) {
case "reset":

View file

@ -502,13 +502,12 @@ C1PCPU.prototype.reset = function(fPowerOn)
/**
* @this {C1PCPU}
* @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")
* @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
*/
C1PCPU.prototype.setBinding = function(sHTMLClass, sHTMLType, sBinding, control)
C1PCPU.prototype.setBinding = function(sHTMLType, sBinding, control)
{
var fBound = false;
switch(sBinding) {

View file

@ -487,48 +487,47 @@ if (DEBUGGER) {
/**
* @this {C1PDebugger}
* @param {string|null} c is the class of the HTML control (eg, "input", "output")
* @param {string|null} t is the type of the HTML control (eg, "button", "list", "text", "submit", "textarea")
* @param {string} s is the value of the 'binding' parameter stored in the HTML control's "data-value" attribute (eg, "debugInput")
* @param {Object} e is the HTML control DOM object (eg, HTMLButtonElement)
* @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
*/
C1PDebugger.prototype.setBinding = function(c, t, s, e)
C1PDebugger.prototype.setBinding = function(sHTMLType, sBinding, control)
{
var dbg = this;
switch(s) {
switch(sBinding) {
case "debugInput":
this.bindings[s] = e;
this.eDebug = e;
this.bindings[sBinding] = control;
this.eDebug = control;
this.eDebug.focus();
e.onkeypress = function(dbg, e) {
control.onkeypress = function(dbg, e) {
return function(event) {
if (event.keyCode == 13) {
s = e.value;
sBinding = e.value;
e.value = "";
C1PDebugger.input(dbg, s);
C1PDebugger.input(dbg, sBinding);
}
};
}(this, e);
}(this, control);
return true;
case "debugEnter":
this.bindings[s] = e;
this.bindings[sBinding] = control;
/*
* I've replaced the standard "onclick" code with a call to our onClickRepeat() helper in
* component.js, so that the "Enter" button can be held to repeat, just like the "Step" button.
*/
web.onClickRepeat(
e, 500, 100,
control, 500, 100,
function(fRepeat) {
if (dbg.eDebug) {
s = dbg.eDebug.value;
sBinding = dbg.eDebug.value;
//
// If we want to use the debugEnter button to repeatedly enter the same command,
// then don't clear the command string.
//
// dbg.eDebug.value = "";
//
C1PDebugger.input(dbg, s);
C1PDebugger.input(dbg, sBinding);
return true;
}
if (DEBUG) dbg.log("no debugger input buffer");
@ -537,9 +536,9 @@ if (DEBUGGER) {
);
return true;
case "step":
this.bindings[s] = e;
this.bindings[sBinding] = control;
web.onClickRepeat(
e, 500, 100,
control, 500, 100,
function(fRepeat) {
var fCompleted = false;
if (!dbg.isBusy(true)) {

View file

@ -657,13 +657,12 @@ C1PDiskController.prototype.resetDrive = function(iDrive, iDriveType, nMaxTracks
/**
* @this {C1PDiskController}
* @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")
* @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)
* @return {boolean} true if binding was successful, false if unrecognized binding request
*/
C1PDiskController.prototype.setBinding = function(sHTMLClass, sHTMLType, sBinding, control)
C1PDiskController.prototype.setBinding = function(sHTMLType, sBinding, control)
{
switch(sBinding) {

View file

@ -388,13 +388,12 @@ C1PKeyboard.prototype.reset = function()
/**
* @this {C1PKeyboard}
* @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")
* @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)
* @return {boolean} true if binding was successful, false if unrecognized binding request
*/
C1PKeyboard.prototype.setBinding = function(sHTMLClass, sHTMLType, sBinding, control)
C1PKeyboard.prototype.setBinding = function(sHTMLType, sBinding, control)
{
/*
* I want to bind to the first caller (ie, the Screen), not subsequent ones (eg, the Panel)

View file

@ -22,8 +22,8 @@
<rom id="romSystem" size="0x0800" image="/devices/c1p/rom/system.hex"/>
<video id="video" screenwidth="256" screenheight="192" cols="32" rows="32" charset="/devices/c1p/video/chargen1x.png" padding="8px"/>
<keyboard id="keyboard">
<control type="button" class="input" binding="ctrl-c">CTRL-C</control>
<control type="button" class="input" binding="break">BREAK</control>
<control type="button" binding="ctrl-c">CTRL-C</control>
<control type="button" binding="break">BREAK</control>
</keyboard>
<serial id="serialPort" demo="true"/>
</machine>
@ -80,9 +80,9 @@
<lt/>video id="video" screenwidth="256" screenheight="192" cols="32" rows="32"
charset="/devices/c1p/video/chargen1x.png" width="256px" padding="8px"/<gt/>
<lt/>keyboard id="keyboard"<gt/>
<lt/>control type="button" class="input" binding="ctrl-c"<gt/>CTRL-C<lt/>/control<gt/>
<lt/>control type="button" class="input" binding="ctrl-o"<gt/>CTRL-O<lt/>/control<gt/>
<lt/>control type="button" class="input" binding="break"<gt/>BREAK<lt/>/control<gt/>
<lt/>control type="button" binding="ctrl-c"<gt/>CTRL-C<lt/>/control<gt/>
<lt/>control type="button" binding="ctrl-o"<gt/>CTRL-O<lt/>/control<gt/>
<lt/>control type="button" binding="break"<gt/>BREAK<lt/>/control<gt/>
<lt/>/keyboard<gt/>
<lt/>/machine<gt/>
</pre>

View file

@ -55,19 +55,18 @@ Component.subclass(Component, C1PPanel);
* component that doesn't recognize the specified binding should simply ignore it.
*
* @this {C1PPanel}
* @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
*/
C1PPanel.prototype.setBinding = function(sHTMLClass, sHTMLType, sBinding, control)
C1PPanel.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;
return Component.prototype.setBinding.call(this, sHTMLClass, sHTMLType, sBinding, control);
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);
};
/**

View file

@ -100,13 +100,12 @@ C1PSerialPort.prototype.start = function()
/**
* @this {C1PSerialPort}
* @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")
* @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)
* @return {boolean} true if binding was successful, false if unrecognized binding request
*/
C1PSerialPort.prototype.setBinding = function(sHTMLClass, sHTMLType, sBinding, control)
C1PSerialPort.prototype.setBinding = function(sHTMLType, sBinding, control)
{
var serial = this;

View file

@ -172,13 +172,12 @@ C1PVideo.prototype.reset = function(fPowerOn)
/**
* @this {C1PVideo}
* @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")
* @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
*/
C1PVideo.prototype.setBinding = function(sHTMLClass, sHTMLType, sBinding, control)
C1PVideo.prototype.setBinding = function(sHTMLType, sBinding, control)
{
switch(sBinding) {
case "refresh":
@ -322,9 +321,9 @@ C1PVideo.prototype.setPower = function(fOn, cmp)
*/
this.kbd = cmp.getComponentByType("keyboard");
if (this.kbd) {
this.kbd.setBinding("input", "canvas", "keyDown", this.eCanvas);
this.kbd.setBinding("input", "canvas", "keyPress", this.eCanvas);
this.kbd.setBinding("input", "canvas", "keyUp", this.eCanvas);
this.kbd.setBinding("canvas", "keyDown", this.eCanvas);
this.kbd.setBinding("canvas", "keyPress", this.eCanvas);
this.kbd.setBinding("canvas", "keyUp", this.eCanvas);
}
}
else

View file

@ -266,27 +266,27 @@
</xsl:if>
<xsl:choose>
<xsl:when test="@type = 'button'">
<button class="{$APPCLASS}-{@class}" style="{$border}{$width}{$height}{$fontsize}{$style}" data-value="{$type},{$binding}"><xsl:apply-templates/></button>
<button class="{$APPCLASS}-binding" style="{$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="item" 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}" style="{$border}{$width}{$height}{$style}" data-value="{$type},{$binding}">
<form class="{$APPCLASS}-binding" style="{$border}{$width}{$height}{$style}" data-value="{$type},{$binding}">
<fieldset class="{$APPCLASS}-fieldset">
<input type="file"/>
<input type="submit" value="Load" disabled="true"/>
@ -300,7 +300,7 @@
<div style="clear:both"></div><br/>
</xsl:when>
<xsl:otherwise>
<div class="{$APPCLASS}-{@class}{$subclass}" style="{$border}{$width}{$height}{$style}" data-value="{$type},{$binding}"><xsl:apply-templates/></div>
<div class="{$APPCLASS}-binding{$subclass}" style="{$border}{$width}{$height}{$style}" data-value="{$type},{$binding}"><xsl:apply-templates/></div>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="@label">

View file

@ -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":

View file

@ -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) {

View file

@ -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;

View file

@ -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) {

View file

@ -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;

View file

@ -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")

View file

@ -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

View file

@ -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);
};
/**

View file

@ -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:

View file

@ -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;

View file

@ -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;

View file

@ -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">

View file

@ -189,10 +189,6 @@ Component.extend = function(o, p)
/**
* Component.subclass(superclass, subclass, methods, statics)
*
* TODO: Determine why every subclass created by this function ends up with a name prefix of "Component.subclass"
* in Chrome's call stack, rather than the (more logical) name of the subclass constructor. Is there a different
* design pattern I should be using that creates subclasses more to Chrome's liking?
*
* See: Flanagan, David (2011-04-18). JavaScript: The Definitive Guide: The Definitive Guide (Kindle Locations 9854-9903). OReilly Media - A. Kindle Edition (Example 9-11)
*
* @param {Object} superclass is the constructor of the superclass
@ -492,7 +488,7 @@ Component.bindExternalControl = function(component, sControl, sBinding, sType)
if (target) {
var eBinding = target.bindings[sControl];
if (eBinding) {
component.setBinding(null, null, sBinding, eBinding);
component.setBinding(null, sBinding, eBinding);
}
}
}
@ -527,11 +523,10 @@ Component.bindComponentControls = function(component, element, sAppClass)
var parms;
sClass = aClasses[iClass];
switch (sClass) {
case sAppClass + "-input":
case sAppClass + "-output":
case sAppClass + "-binding":
parms = Component.getComponentParms(control);
if (parms && parms['binding']) {
component.setBinding(sClass, parms['type'], parms['binding'], control);
component.setBinding(parms['type'], parms['binding'], control);
} else {
Component.log('Component.bindComponentControls("' + component.toString() + '"): missing binding' + (parms? ' for ' + parms['type'] : ''), "warning");
}
@ -610,18 +605,17 @@ Component.prototype = {
return nMachine;
},
/**
* setBinding(sHTMLClass, sHTMLType, sBinding, control)
* setBinding(sHTMLType, sBinding, control)
*
* Component's setBinding() method is intended to be overridden by subclasses.
*
* @this {Component}
* @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
*/
setBinding: function(sHTMLClass, sHTMLType, sBinding, control) {
setBinding: function(sHTMLType, sBinding, control) {
switch (sBinding) {
case "clear":
if (!this.bindings[sBinding]) {