/**
* @fileoverview This file implements the C1Pjs Keyboard component.
* @author Jeff Parsons
* @version 1.0
* Created 2012-Jun-20
*
* Copyright © 2012-2016 Jeff Parsons
*
* This file is part of C1Pjs, which is part of the JavaScript Machines Project (aka JSMachines)
* at and .
*
* C1Pjs is free software: you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation, either version 3
* of the License, or (at your option) any later version.
*
* C1Pjs is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with C1Pjs. If not,
* see .
*
* You are required to include the above copyright notice in every source code file of every
* copy or modified version of this work, and to display that copyright notice on every screen
* that loads or runs any version of this software (see C1PComputer.COPYRIGHT).
*
* Some C1Pjs files also attempt to load external resource files, such as character-image files,
* ROM files, and disk image files. Those external resource files are not considered part of the
* C1Pjs program for purposes of the GNU General Public License, and the author does not claim
* any copyright as to their contents.
*/
"use strict";
if (NODE) {
var str = require("../../shared/lib/strlib");
var web = require("../../shared/lib/weblib");
var Component = require("../../shared/lib/component");
}
/**
* C1PKeyboard(parmsKbd)
*
* The Keyboard component can be configured with the following (parmsKbd) properties:
*
* model: model number (one of: 542 or 600; 600 is the default)
*
* Its main purpose is to receive binding requests for various keyboard events,
* and to use those events to simulate the C1P's keyboard hardware; specifically,
* an OSI model 600 board (NOT the model 542).
*
* Keys on the C1P keyboard that differ from modern keyboards, along with their
* closest modern counterpart:
*
* C1P PC
* --- --
* 2" 2@
* 6& 6^
* 7' 7&
* 8( 8*
* 9) 9(
* 0 0)
* :* -_
* -= =+
* ;+ ;:
* LINEFEED CTRL-J
* RETURN ENTER (or CTRL-M)
* SHIFT-O DELETE (or CTRL-H)
* SHIFT-N ^
* SHIFT-P @ (used by the BASIC-IN-ROM to abandon the current line)
* SHIFT-L \
* SHIFT-K [
* SHIFT-M ]
* CTRL-C Same (used by the BASIC-IN-ROM to interrupt RUN and LIST, unless disabled with POKE 530,1)
* CTRL-O Same (used by the BASIC-IN-ROM to suppress output until another CTRL-O is typed)
* RUB-OUT (no mapping chosen for this key yet)
* REPEAT (no mapping chosen for this key yet)
*
* Problems with iOS Devices
* -------------------------
* The keyboard pops up with the SHIFT key depressed, which is not the initial keyboard state that the C1P expects.
* I tried to fix that by adding an 'autocapitalize="off"' attribute alongside the 'contenteditable="true"' attribute
* on the