Setting the stage for a resource status update mechanism
This commit is contained in:
parent
754a4a4027
commit
2cb0be42f0
36 changed files with 872 additions and 773 deletions
|
|
@ -312,6 +312,7 @@ class Computer extends Component {
|
|||
/**
|
||||
* getMachineID()
|
||||
*
|
||||
* @this {Computer}
|
||||
* @return {string}
|
||||
*/
|
||||
getMachineID()
|
||||
|
|
@ -324,6 +325,7 @@ class Computer extends Component {
|
|||
*
|
||||
* If no explicit machine parms were provided, then we check for 'parms' in the bundled resources (if any).
|
||||
*
|
||||
* @this {Computer}
|
||||
* @param {Object} [parmsMachine]
|
||||
*/
|
||||
setMachineParms(parmsMachine)
|
||||
|
|
@ -351,6 +353,7 @@ class Computer extends Component {
|
|||
* 'state' back to the caller (ie, the name of the resource), so that the caller will then attempt to load the 'state'
|
||||
* resource to obtain the actual state.
|
||||
*
|
||||
* @this {Computer}
|
||||
* @param {string} sParm
|
||||
* @param {Object} [parmsComponent]
|
||||
* @return {string|undefined}
|
||||
|
|
@ -374,6 +377,7 @@ class Computer extends Component {
|
|||
/**
|
||||
* saveMachineParms()
|
||||
*
|
||||
* @this {Computer}
|
||||
* @return {string|null}
|
||||
*/
|
||||
saveMachineParms()
|
||||
|
|
@ -384,6 +388,7 @@ class Computer extends Component {
|
|||
/**
|
||||
* getUserID()
|
||||
*
|
||||
* @this {Computer}
|
||||
* @return {string}
|
||||
*/
|
||||
getUserID()
|
||||
|
|
@ -391,6 +396,28 @@ class Computer extends Component {
|
|||
return this.sUserID || "";
|
||||
}
|
||||
|
||||
/**
|
||||
* setResourceStatus(sMessage)
|
||||
*
|
||||
* @this {Computer}
|
||||
* @param {string} sMessage
|
||||
*/
|
||||
setResourceStatus(sMessage)
|
||||
{
|
||||
// var video = this.aVideo[0];
|
||||
// if (video) {
|
||||
// var eTextArea = video.getTextArea();
|
||||
// if (eTextArea) {
|
||||
// eTextArea.style.opacity = "1";
|
||||
// eTextArea.style.color = "#ffffff";
|
||||
// eTextArea.style.lineHeight = "1";
|
||||
// eTextArea.style.fontSize = "large";
|
||||
// eTextArea.style.background = "rgba(0, 0, 0, .5)";
|
||||
// eTextArea.value = sMessage;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
* doneLoad(sURL, sStateData, nErrorCode)
|
||||
*
|
||||
|
|
@ -1152,6 +1179,8 @@ class Computer extends Component {
|
|||
|
||||
/**
|
||||
* resetUserID()
|
||||
*
|
||||
* @this {Computer}
|
||||
*/
|
||||
resetUserID()
|
||||
{
|
||||
|
|
@ -1162,6 +1191,7 @@ class Computer extends Component {
|
|||
/**
|
||||
* queryUserID(fPrompt)
|
||||
*
|
||||
* @this {Computer}
|
||||
* @param {boolean} [fPrompt]
|
||||
* @returns {string|null|undefined}
|
||||
*/
|
||||
|
|
@ -1250,6 +1280,7 @@ class Computer extends Component {
|
|||
/**
|
||||
* saveServerState(sUserID, sState)
|
||||
*
|
||||
* @this {Computer}
|
||||
* @param {string} sUserID
|
||||
* @param {string|null} sState
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -226,7 +226,7 @@ class Panel extends Component {
|
|||
* @this {Panel}
|
||||
* @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 {HTMLElement} 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
|
||||
*/
|
||||
|
|
@ -247,8 +247,8 @@ class Panel extends Component {
|
|||
}
|
||||
|
||||
if (fPanel) {
|
||||
this.canvas = control;
|
||||
this.context = this.canvas.getContext("2d");
|
||||
this.canvas = /** @type {HTMLCanvasElement} */ (control);
|
||||
this.context = /** @type {CanvasRenderingContext2D} */ (this.canvas.getContext("2d"));
|
||||
|
||||
/*
|
||||
* Employ the same gross onresize() hack for IE9/IE10 that we had to use for the Video canvas
|
||||
|
|
@ -259,7 +259,7 @@ class Panel extends Component {
|
|||
canvas.style.height = (((canvas.clientWidth * cy) / cx) | 0) + "px";
|
||||
};
|
||||
}(this.canvas, this.canvas.width, this.canvas.height);
|
||||
this.canvas.onresize();
|
||||
this.canvas.onresize(null);
|
||||
}
|
||||
|
||||
this.xMem = this.yMem = 0;
|
||||
|
|
|
|||
|
|
@ -85,7 +85,6 @@ class ROM extends Component {
|
|||
* Most ROMs are not aliased, in which case the 'alias' property should have the default value of null.
|
||||
*/
|
||||
this.addrAlias = parmsROM['alias'];
|
||||
this.sFilePath = parmsROM['file'];
|
||||
|
||||
/*
|
||||
* The 'notify' property can now (as of v1.18.2) contain an array of parameters that the notified
|
||||
|
|
@ -107,10 +106,12 @@ class ROM extends Component {
|
|||
this.idNotify = this.idNotify.substr(0, i);
|
||||
}
|
||||
}
|
||||
if (this.sFilePath) {
|
||||
var sFileURL = this.sFilePath;
|
||||
var sFileName = Str.getBaseName(sFileURL);
|
||||
if (DEBUG) this.log('load("' + sFileURL + '")');
|
||||
|
||||
this.sFileURL = this.sFilePath = parmsROM['file'];
|
||||
|
||||
if (this.sFileURL) {
|
||||
var sFileName = Str.getBaseName(this.sFileURL);
|
||||
if (DEBUG) this.log('load("' + this.sFileURL + '")');
|
||||
/*
|
||||
* If the selected ROM file has a ".json" extension, then we assume it's pre-converted
|
||||
* JSON-encoded ROM data, so we load it as-is; ditto for ROM files with a ".hex" extension.
|
||||
|
|
@ -118,12 +119,8 @@ class ROM extends Component {
|
|||
*/
|
||||
var sFileExt = Str.getExtension(sFileName);
|
||||
if (sFileExt != DumpAPI.FORMAT.JSON && sFileExt != DumpAPI.FORMAT.HEX) {
|
||||
sFileURL = Web.getHost() + DumpAPI.ENDPOINT + '?' + DumpAPI.QUERY.FILE + '=' + this.sFilePath + '&' + DumpAPI.QUERY.FORMAT + '=' + DumpAPI.FORMAT.BYTES + '&' + DumpAPI.QUERY.DECIMAL + '=true';
|
||||
this.sFileURL = Web.getHost() + DumpAPI.ENDPOINT + '?' + DumpAPI.QUERY.FILE + '=' + this.sFilePath + '&' + DumpAPI.QUERY.FORMAT + '=' + DumpAPI.FORMAT.BYTES + '&' + DumpAPI.QUERY.DECIMAL + '=true';
|
||||
}
|
||||
var rom = this;
|
||||
Web.getResource(sFileURL, null, true, function(sURL, sResponse, nErrorCode) {
|
||||
rom.doneLoad(sURL, sResponse, nErrorCode);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -138,10 +135,17 @@ class ROM extends Component {
|
|||
*/
|
||||
initBus(cmp, bus, cpu, dbg)
|
||||
{
|
||||
var rom = this;
|
||||
this.cmp = cmp;
|
||||
this.bus = bus;
|
||||
this.cpu = cpu;
|
||||
this.dbg = dbg;
|
||||
this.copyROM();
|
||||
if (this.sFileURL) {
|
||||
this.cmp.setResourceStatus(this.sFileURL);
|
||||
Web.getResource(this.sFileURL, null, true, function(sURL, sResponse, nErrorCode) {
|
||||
rom.doneLoad(sURL, sResponse, nErrorCode);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -2171,10 +2171,10 @@ class Video extends Component {
|
|||
*
|
||||
* @this {Video}
|
||||
* @param {Object} parmsVideo
|
||||
* @param {Object} [canvas]
|
||||
* @param {Object} [context]
|
||||
* @param {Object} [textarea]
|
||||
* @param {Object} [container]
|
||||
* @param {HTMLCanvasElement} [canvas]
|
||||
* @param {CanvasRenderingContext2D} [context]
|
||||
* @param {HTMLTextAreaElement} [textarea]
|
||||
* @param {HTMLElement} [container]
|
||||
*/
|
||||
constructor(parmsVideo, canvas, context, textarea, container)
|
||||
{
|
||||
|
|
@ -2231,7 +2231,7 @@ class Video extends Component {
|
|||
|
||||
this.canvasScreen = canvas;
|
||||
this.contextScreen = context;
|
||||
this.textareaScreen = textarea;
|
||||
this.inputTextArea = textarea;
|
||||
this.inputScreen = textarea || canvas || null;
|
||||
|
||||
/*
|
||||
|
|
@ -2472,7 +2472,7 @@ class Video extends Component {
|
|||
for (var s in this.bindings) {
|
||||
if (s.indexOf("lock") > 0) this.kbd.setBinding("led", s, this.bindings[s]);
|
||||
}
|
||||
this.kbd.setBinding(this.textareaScreen? "textarea" : "canvas", "screen", this.inputScreen);
|
||||
this.kbd.setBinding(this.inputTextArea? "textarea" : "canvas", "screen", this.inputScreen);
|
||||
}
|
||||
|
||||
this.bEGASwitches = 0x09; // our default "switches" setting (see aEGAMonitorSwitches)
|
||||
|
|
@ -2587,6 +2587,19 @@ class Video extends Component {
|
|||
return this.inputScreen;
|
||||
}
|
||||
|
||||
/**
|
||||
* getTextArea()
|
||||
*
|
||||
* This is an interface used by the Computer component, so that it can display resource status messages.
|
||||
*
|
||||
* @this {Video}
|
||||
* @return {HTMLTextAreaElement|undefined}
|
||||
*/
|
||||
getTextArea()
|
||||
{
|
||||
return this.inputTextArea;
|
||||
}
|
||||
|
||||
/**
|
||||
* doFullScreen()
|
||||
*
|
||||
|
|
@ -6691,7 +6704,7 @@ class Video extends Component {
|
|||
var eVideo = aeVideo[iVideo];
|
||||
var parmsVideo = Component.getComponentParms(eVideo);
|
||||
|
||||
var eCanvas = document.createElement("canvas");
|
||||
var eCanvas = /** @type {HTMLCanvasElement} */ (document.createElement("canvas"));
|
||||
if (eCanvas === undefined || !eCanvas.getContext) {
|
||||
eVideo.innerHTML = "<br/>Missing <canvas> support. Please try a newer web browser.";
|
||||
return;
|
||||
|
|
@ -6724,7 +6737,7 @@ class Video extends Component {
|
|||
eChild.style.height = (((eParent.clientWidth * cy) / cx) | 0) + "px";
|
||||
};
|
||||
}(eVideo, eCanvas, parmsVideo['screenWidth'], parmsVideo['screenHeight']);
|
||||
eVideo.onresize();
|
||||
eVideo.onresize(null);
|
||||
}
|
||||
/*
|
||||
* The following is a related hack that allows the user to force the screen to use a particular aspect
|
||||
|
|
@ -6787,7 +6800,7 @@ class Video extends Component {
|
|||
*
|
||||
* See this Chromium issue for more information: https://code.google.com/p/chromium/issues/detail?id=118639
|
||||
*/
|
||||
var eTextArea = document.createElement("textarea");
|
||||
var eTextArea = /** @type {HTMLTextAreaElement} */ (document.createElement("textarea"));
|
||||
|
||||
/*
|
||||
* As noted in keyboard.js, the keyboard on an iOS device tends to pop up with the SHIFT key depressed,
|
||||
|
|
@ -6812,7 +6825,7 @@ class Video extends Component {
|
|||
/*
|
||||
* Now we can create the Video object, record it, and wire it up to the associated document elements.
|
||||
*/
|
||||
var eContext = eCanvas.getContext("2d");
|
||||
var eContext = /** @type {CanvasRenderingContext2D} */ (eCanvas.getContext("2d"));
|
||||
var video = new Video(parmsVideo, eCanvas, eContext, eTextArea /* || eInput */, eVideo);
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Reference in a new issue