Commit 285b780d authored by Christoffer Ackelman's avatar Christoffer Ackelman

JS: Autoformat files

parent 220549a4
...@@ -93,33 +93,31 @@ function Cli(cliTable) { ...@@ -93,33 +93,31 @@ function Cli(cliTable) {
var c = cmd.charAt(i); var c = cmd.charAt(i);
switch (state) { switch (state) {
case CliC.STATE_INIT: case CliC.STATE_INIT:
if (c == CliC.SPACE || c == CliC.TAB) if (c == CliC.SPACE || c == CliC.TAB) {
break; break;
else { } else {
state = CliC.STATE_VERB; state = CliC.STATE_VERB;
start_pos = i; start_pos = i;
} }
break; break;
case CliC.STATE_SPACE: case CliC.STATE_SPACE:
if (c == CliC.SPACE || c == CliC.TAB) if (c == CliC.SPACE || c == CliC.TAB) {
break; break;
}
if (c == '/') { if (c == '/') {
state = CliC.STATE_QUAL; state = CliC.STATE_QUAL;
start_pos = i; start_pos = i;
} } else if (c == '=') {
else if (c == '=') {
if (this.qualifierCount === 0) { if (this.qualifierCount === 0) {
state = CliC.STATE_ERROR; state = CliC.STATE_ERROR;
this.status = CliC.SYNTAX_ERROR; this.status = CliC.SYNTAX_ERROR;
break; break;
} }
state = CliC.STATE_EQUAL; state = CliC.STATE_EQUAL;
} } else if (c == '"') {
else if (c == '"') {
state = CliC.STATE_QUOTE_VERB; state = CliC.STATE_QUOTE_VERB;
break; break;
} } else {
else {
state = CliC.STATE_VERB; state = CliC.STATE_VERB;
start_pos = i; start_pos = i;
} }
...@@ -130,18 +128,20 @@ function Cli(cliTable) { ...@@ -130,18 +128,20 @@ function Cli(cliTable) {
state = CliC.STATE_ERROR; state = CliC.STATE_ERROR;
break; break;
} }
if (this.verbCount === 0) if (this.verbCount === 0) {
this.verb[this.verbCount++] = cmd.substring(start_pos, i).toUpperCase(); this.verb[this.verbCount++] = cmd.substring(start_pos, i)
else .toUpperCase();
} else {
this.verb[this.verbCount++] = cmd.substring(start_pos, i); this.verb[this.verbCount++] = cmd.substring(start_pos, i);
state = CliC.STATE_SPACE;
} }
else if (c == '/') { state = CliC.STATE_SPACE;
} else if (c == '/') {
if (this.verbCount == CliC.VERB_VECT_SIZE) { if (this.verbCount == CliC.VERB_VECT_SIZE) {
state = CliC.STATE_ERROR; state = CliC.STATE_ERROR;
break; break;
} }
this.verb[this.verbCount++] = cmd.substring(start_pos, i).toUpperCase(); this.verb[this.verbCount++] =
cmd.substring(start_pos, i).toUpperCase();
state = CliC.STATE_QUAL; state = CliC.STATE_QUAL;
start_pos = i; start_pos = i;
} }
...@@ -158,33 +158,36 @@ function Cli(cliTable) { ...@@ -158,33 +158,36 @@ function Cli(cliTable) {
break; break;
case CliC.STATE_QUAL: case CliC.STATE_QUAL:
if (c == CliC.SPACE || c == CliC.TAB) { if (c == CliC.SPACE || c == CliC.TAB) {
this.qualifier[this.qualifierCount++] = cmd.substring(start_pos, i).toUpperCase(); this.qualifier[this.qualifierCount++] =
cmd.substring(start_pos, i).toUpperCase();
state = CliC.STATE_SPACE; state = CliC.STATE_SPACE;
} } else if (c == '=') {
else if (c == '=') { this.qualifier[this.qualifierCount++] =
this.qualifier[this.qualifierCount++] = cmd.substring(start_pos, i).toUpperCase(); cmd.substring(start_pos, i).toUpperCase();
state = CliC.STATE_EQUAL; state = CliC.STATE_EQUAL;
} } else if (c == '/') {
else if (c == '/') { this.qualifier[this.qualifierCount++] =
this.qualifier[this.qualifierCount++] = cmd.substring(start_pos, i).toUpperCase(); cmd.substring(start_pos, i).toUpperCase();
state = CliC.STATE_QUAL; state = CliC.STATE_QUAL;
start_pos = i; start_pos = i;
} }
break; break;
case CliC.STATE_QUALVALUE: case CliC.STATE_QUALVALUE:
if (c == CliC.SPACE || c == CliC.TAB) { if (c == CliC.SPACE || c == CliC.TAB) {
this.qualValue[this.qualifierCount - 1] = cmd.substring(start_pos, i); this.qualValue[this.qualifierCount - 1] =
cmd.substring(start_pos, i);
state = CliC.STATE_SPACE; state = CliC.STATE_SPACE;
} } else if (c == '/') {
else if (c == '/') { this.qualValue[this.qualifierCount - 1] =
this.qualValue[this.qualifierCount - 1] = cmd.substring(start_pos, i); cmd.substring(start_pos, i);
state = CliC.STATE_QUAL; state = CliC.STATE_QUAL;
start_pos = i; start_pos = i;
} }
break; break;
case CliC.STATE_QUALVALUE_EXACT: case CliC.STATE_QUALVALUE_EXACT:
if (c == '"') { if (c == '"') {
this.qualValue[this.qualifierCount - 1] = cmd.substring(start_pos, i); this.qualValue[this.qualifierCount - 1] =
cmd.substring(start_pos, i);
state = CliC.STATE_SPACE; state = CliC.STATE_SPACE;
} }
break; break;
...@@ -197,21 +200,22 @@ function Cli(cliTable) { ...@@ -197,21 +200,22 @@ function Cli(cliTable) {
start_pos = i; start_pos = i;
break; break;
case CliC.STATE_EQUAL: case CliC.STATE_EQUAL:
if (c == CliC.SPACE || c == CliC.TAB) if (c == CliC.SPACE || c == CliC.TAB) {
break; break;
}
if (c == '"') { if (c == '"') {
state = CliC.STATE_QUOTE_QUALVALUE; state = CliC.STATE_QUOTE_QUALVALUE;
} } else {
else {
state = CliC.STATE_QUALVALUE; state = CliC.STATE_QUALVALUE;
start_pos = i; start_pos = i;
} }
break; break;
} }
if (state == CliC.STATE_ERROR) if (state == CliC.STATE_ERROR) {
break; break;
} }
}
switch (state) { switch (state) {
case CliC.STATE_INIT: case CliC.STATE_INIT:
case CliC.STATE_ERROR: case CliC.STATE_ERROR:
...@@ -221,10 +225,12 @@ function Cli(cliTable) { ...@@ -221,10 +225,12 @@ function Cli(cliTable) {
state = CliC.STATE_ERROR; state = CliC.STATE_ERROR;
break; break;
} }
if (this.verbCount === 0) if (this.verbCount === 0) {
this.verb[this.verbCount++] = cmd.substring(start_pos, i).toUpperCase(); this.verb[this.verbCount++] = cmd.substring(start_pos, i)
else .toUpperCase();
} else {
this.verb[this.verbCount++] = cmd.substring(start_pos, i); this.verb[this.verbCount++] = cmd.substring(start_pos, i);
}
break; break;
case CliC.STATE_VERB_EXACT: case CliC.STATE_VERB_EXACT:
if (this.verbCount == CliC.VERB_VECT_SIZE) { if (this.verbCount == CliC.VERB_VECT_SIZE) {
...@@ -234,7 +240,8 @@ function Cli(cliTable) { ...@@ -234,7 +240,8 @@ function Cli(cliTable) {
this.verb[this.verbCount++] = cmd.substring(start_pos, i); this.verb[this.verbCount++] = cmd.substring(start_pos, i);
break; break;
case CliC.STATE_QUAL: case CliC.STATE_QUAL:
this.qualifier[this.qualifierCount++] = cmd.substring(start_pos, i).toUpperCase(); this.qualifier[this.qualifierCount++] =
cmd.substring(start_pos, i).toUpperCase();
break; break;
case CliC.STATE_QUALVALUE: case CliC.STATE_QUALVALUE:
this.qualValue[this.qualifierCount - 1] = cmd.substring(start_pos, i); this.qualValue[this.qualifierCount - 1] = cmd.substring(start_pos, i);
...@@ -262,9 +269,11 @@ function Cli(cliTable) { ...@@ -262,9 +269,11 @@ function Cli(cliTable) {
// Identify verbs and qualifiers // Identify verbs and qualifiers
var found = false; var found = false;
for (i = 0; i < this.cliTable.length; i++) { for (i = 0; i < this.cliTable.length; i++) {
if (this.verb[0].length > this.cliTable[i].command.length) if (this.verb[0].length > this.cliTable[i].command.length) {
continue; continue;
if (this.verb[0] == (this.cliTable[i].command.substring(0, this.verb[0].length))) { }
if (this.verb[0] ==
(this.cliTable[i].command.substring(0, this.verb[0].length))) {
this.verb[0] = this.cliTable[i].command; this.verb[0] = this.cliTable[i].command;
found = true; found = true;
break; break;
...@@ -279,28 +288,40 @@ function Cli(cliTable) { ...@@ -279,28 +288,40 @@ function Cli(cliTable) {
this.configuredVerbs = 0; this.configuredVerbs = 0;
if (this.cliTable[this.cliTableIndex].qualifier !== null) { if (this.cliTable[this.cliTableIndex].qualifier !== null) {
for (i = 0; i < this.cliTable[this.cliTableIndex].qualifier.length; i++) { for (i = 0; i < this.cliTable[this.cliTableIndex].qualifier.length; i++) {
if (this.cliTable[this.cliTableIndex].qualifier[i] === null) if (this.cliTable[this.cliTableIndex].qualifier[i] === null) {
break; break;
if (this.cliTable[this.cliTableIndex].qualifier[i] == ("cli_arg1")) }
if (this.cliTable[this.cliTableIndex].qualifier[i] == ("cli_arg1")) {
this.configuredVerbs++; this.configuredVerbs++;
if (this.cliTable[this.cliTableIndex].qualifier[i] == ("cli_arg2")) }
if (this.cliTable[this.cliTableIndex].qualifier[i] == ("cli_arg2")) {
this.configuredVerbs++; this.configuredVerbs++;
if (this.cliTable[this.cliTableIndex].qualifier[i] == ("cli_arg3")) }
if (this.cliTable[this.cliTableIndex].qualifier[i] == ("cli_arg3")) {
this.configuredVerbs++; this.configuredVerbs++;
if (this.cliTable[this.cliTableIndex].qualifier[i] == ("cli_arg4")) }
if (this.cliTable[this.cliTableIndex].qualifier[i] == ("cli_arg4")) {
this.configuredVerbs++; this.configuredVerbs++;
if (this.cliTable[this.cliTableIndex].qualifier[i] == ("cli_arg5")) }
if (this.cliTable[this.cliTableIndex].qualifier[i] == ("cli_arg5")) {
this.configuredVerbs++; this.configuredVerbs++;
} }
}
for (var j = 0; j < this.qualifierCount; j++) { for (var j = 0; j < this.qualifierCount; j++) {
found = false; found = false;
for (i = 0; i < this.cliTable[this.cliTableIndex].qualifier.length; i++) { for (i = 0; i < this.cliTable[this.cliTableIndex].qualifier.length;
if (this.cliTable[this.cliTableIndex].qualifier[i] === null) i++) {
if (this.cliTable[this.cliTableIndex].qualifier[i] === null) {
break; break;
if (this.qualifier[j].length > this.cliTable[this.cliTableIndex].qualifier[i].length) }
if (this.qualifier[j].length >
this.cliTable[this.cliTableIndex].qualifier[i].length) {
continue; continue;
if (this.qualifier[j] == (this.cliTable[this.cliTableIndex].qualifier[i].substring(0, this.qualifier[j].length))) { }
if (this.qualifier[j] ==
(this.cliTable[this.cliTableIndex].qualifier[i].substring(0,
this.qualifier[j].length))) {
this.cliQualifierIndex[j] = i; this.cliQualifierIndex[j] = i;
found = true; found = true;
this.qualifier[j] = this.cliTable[this.cliTableIndex].qualifier[i]; this.qualifier[j] = this.cliTable[this.cliTableIndex].qualifier[i];
...@@ -311,8 +332,7 @@ function Cli(cliTable) { ...@@ -311,8 +332,7 @@ function Cli(cliTable) {
return ""; return "";
} }
} }
} } else if (this.qualifierCount > 0) {
else if (this.qualifierCount > 0) {
this.status = CliC.QUALNOTFOUND; this.status = CliC.QUALNOTFOUND;
return ""; return "";
} }
...@@ -327,29 +347,34 @@ function Cli(cliTable) { ...@@ -327,29 +347,34 @@ function Cli(cliTable) {
this.qualifierFound = function (qual) { this.qualifierFound = function (qual) {
if (qual == ("cli_arg1")) { if (qual == ("cli_arg1")) {
if (this.verbCount < 2 || this.configuredVerbs < 1) if (this.verbCount < 2 || this.configuredVerbs < 1) {
return false; return false;
}
return true; return true;
} }
if (qual == ("cli_arg2")) { if (qual == ("cli_arg2")) {
if (this.verbCount < 3 || this.configuredVerbs < 2) if (this.verbCount < 3 || this.configuredVerbs < 2) {
return false; return false;
}
return true; return true;
} }
if (qual == ("cli_arg3")) { if (qual == ("cli_arg3")) {
if (this.verbCount < 4 || this.configuredVerbs < 3) if (this.verbCount < 4 || this.configuredVerbs < 3) {
return false; return false;
}
return true; return true;
} }
if (qual == ("cli_arg4")) { if (qual == ("cli_arg4")) {
if (this.verbCount < 5 || this.configuredVerbs < 4) if (this.verbCount < 5 || this.configuredVerbs < 4) {
return false; return false;
}
return true; return true;
} }
for (var i = 0; i < this.qualifierCount; i++) { for (var i = 0; i < this.qualifierCount; i++) {
if (qual == (this.qualifier[i])) if (qual == (this.qualifier[i])) {
return true; return true;
} }
}
return false; return false;
}; };
...@@ -360,32 +385,37 @@ function Cli(cliTable) { ...@@ -360,32 +385,37 @@ function Cli(cliTable) {
*/ */
this.getQualValue = function (qual) { this.getQualValue = function (qual) {
if (qual == ("cli_arg1")) { if (qual == ("cli_arg1")) {
if (this.verbCount < 2 || this.configuredVerbs < 1) if (this.verbCount < 2 || this.configuredVerbs < 1) {
return ""; return "";
}
return this.verb[1]; return this.verb[1];
} }
if (qual == ("cli_arg2")) { if (qual == ("cli_arg2")) {
if (this.verbCount < 3 || this.configuredVerbs < 2) if (this.verbCount < 3 || this.configuredVerbs < 2) {
return ""; return "";
}
return this.verb[2]; return this.verb[2];
} }
if (qual == ("cli_arg3")) { if (qual == ("cli_arg3")) {
if (this.verbCount < 4 || this.configuredVerbs < 3) if (this.verbCount < 4 || this.configuredVerbs < 3) {
return this.verb[3]; return this.verb[3];
} }
}
if (qual == ("cli_arg4")) { if (qual == ("cli_arg4")) {
if (this.verbCount < 5 || this.configuredVerbs < 4) if (this.verbCount < 5 || this.configuredVerbs < 4) {
return ""; return "";
}
return this.verb[4]; return this.verb[4];
} }
for (var i = 0; i < this.qualifierCount; i++) { for (var i = 0; i < this.qualifierCount; i++) {
if (qual == (this.qualifier[i])) { if (qual == (this.qualifier[i])) {
if (this.qualValue[i] === null) if (this.qualValue[i] === null) {
return ""; return "";
else } else {
return this.qualValue[i]; return this.qualValue[i];
} }
} }
}
return ""; return "";
}; };
} }
\ No newline at end of file
...@@ -176,29 +176,33 @@ function Gdh() { ...@@ -176,29 +176,33 @@ function Gdh() {
this.listSend = false; this.listSend = false;
this.init = function () { this.init = function () {
if (window.location.hostname === "") if (window.location.hostname === "") {
this.ws = new WebSocket("ws:127.0.0.1:4448"); this.ws = new WebSocket("ws:127.0.0.1:4448");
else } else {
this.ws = new WebSocket("ws://" + window.location.hostname + ":4448"); this.ws = new WebSocket("ws://" + window.location.hostname + ":4448");
}
this.ws.binaryType = "arraybuffer"; this.ws.binaryType = "arraybuffer";
this.ws.gdh = this; this.ws.gdh = this;
this.ws.onopen = function (e) { this.ws.onopen = function (e) {
if (this.gdh.open_cb !== null) if (this.gdh.open_cb !== null) {
this.gdh.open_cb(); this.gdh.open_cb();
}
}; };
this.ws.onclose = function () { this.ws.onclose = function () {
if (this.debug) console.log("Socket closed"); if (this.debug) {
if (this.gdh.close_cb !== null) console.log("Socket closed");
}
if (this.gdh.close_cb !== null) {
this.gdh.close_cb(); this.gdh.close_cb();
}
}; };
this.ws.onmessage = function (e) { this.ws.onmessage = function (e) {
if (typeof e.data == "string") { if (typeof e.data == "string") {
console.log("String message received", e, e.data); console.log("String message received", e, e.data);
} } else {
else {
if (e.data instanceof ArrayBuffer) { if (e.data instanceof ArrayBuffer) {
var dv = new DataView(e.data); var dv = new DataView(e.data);
var type = dv.getUint8(0); var type = dv.getUint8(0);
...@@ -207,7 +211,9 @@ function Gdh() { ...@@ -207,7 +211,9 @@ function Gdh() {
switch (type) { switch (type) {
case Msg.GET_OBJECT_INFO_BOOLEAN: { case Msg.GET_OBJECT_INFO_BOOLEAN: {
if (this.gdh.debug) console.log("GetObjectInfoBoolean received"); if (this.gdh.debug) {
console.log("GetObjectInfoBoolean received");
}
var value = dv.getUint8(9); var value = dv.getUint8(9);
var func_cb = this.gdh.pending[id].func_cb; var func_cb = this.gdh.pending[id].func_cb;
func_cb(id, sts, value); func_cb(id, sts, value);
...@@ -215,7 +221,9 @@ function Gdh() { ...@@ -215,7 +221,9 @@ function Gdh() {
break; break;
} }
case Msg.GET_OBJECT_INFO_INT: { case Msg.GET_OBJECT_INFO_INT: {
if (this.gdh.debug) console.log("GetObjectInfoInt received"); if (this.gdh.debug) {
console.log("GetObjectInfoInt received");
}
var value = dv.getUint32(9); var value = dv.getUint32(9);
var pending_data = this.gdh.pending[id]; var pending_data = this.gdh.pending[id];
pending_data.func_cb(id, pending_data.data, sts, value); pending_data.func_cb(id, pending_data.data, sts, value);
...@@ -223,7 +231,9 @@ function Gdh() { ...@@ -223,7 +231,9 @@ function Gdh() {
break; break;
} }
case Msg.GET_OBJECT_INFO_FLOAT: { case Msg.GET_OBJECT_INFO_FLOAT: {
if (this.gdh.debug) console.log("GetObjectInfoFloat received"); if (this.gdh.debug) {
console.log("GetObjectInfoFloat received");
}
var value = dv.getFloat32(9); var value = dv.getFloat32(9);
var pending_data = this.gdh.pending[id]; var pending_data = this.gdh.pending[id];
pending_data.func_cb(id, pending_data.data, sts, value); pending_data.func_cb(id, pending_data.data, sts, value);
...@@ -231,7 +241,9 @@ function Gdh() { ...@@ -231,7 +241,9 @@ function Gdh() {
break; break;
} }
case Msg.GET_OBJECT_INFO_FLOAT_ARRAY: { case Msg.GET_OBJECT_INFO_FLOAT_ARRAY: {
if (this.gdh.debug) console.log("GetObjectInfoFloatArray received"); if (this.gdh.debug) {
console.log("GetObjectInfoFloatArray received");
}
var asize = dv.getInt32(9); var asize = dv.getInt32(9);
var value = new Array(asize); var value = new Array(asize);
k = 13; k = 13;
...@@ -245,37 +257,53 @@ function Gdh() { ...@@ -245,37 +257,53 @@ function Gdh() {
break; break;
} }
case Msg.SET_OBJECT_INFO_BOOLEAN: { case Msg.SET_OBJECT_INFO_BOOLEAN: {
if (this.gdh.debug) console.log("SetObjectInfoBoolean received", id, sts); if (this.gdh.debug) {
console.log("SetObjectInfoBoolean received", id, sts);
}
break; break;
} }
case Msg.SET_OBJECT_INFO_INT: { case Msg.SET_OBJECT_INFO_INT: {
if (this.gdh.debug) console.log("SetObjectInfoInt received", id, sts); if (this.gdh.debug) {
console.log("SetObjectInfoInt received", id, sts);
}
break; break;
} }
case Msg.SET_OBJECT_INFO_FLOAT: { case Msg.SET_OBJECT_INFO_FLOAT: {
if (this.gdh.debug) console.log("SetObjectInfoFloat received", id, sts); if (this.gdh.debug) {
console.log("SetObjectInfoFloat received", id, sts);
}
break; break;
} }
case Msg.SET_OBJECT_INFO_STRING: { case Msg.SET_OBJECT_INFO_STRING: {
if (this.gdh.debug) console.log("SetObjectInfoString received", id, sts); if (this.gdh.debug) {
console.log("SetObjectInfoString received", id, sts);
}
break; break;
} }
case Msg.TOGGLE_OBJECT_INFO: { case Msg.TOGGLE_OBJECT_INFO: {
if (this.gdh.debug) console.log("ToggleObjectInfo received", id, sts); if (this.gdh.debug) {
console.log("ToggleObjectInfo received", id, sts);
}
break; break;
} }
case Msg.REF_OBJECT_INFO: { case Msg.REF_OBJECT_INFO: {
if (this.gdh.debug) console.log("RefObjectInfo received", id, sts); if (this.gdh.debug) {
console.log("RefObjectInfo received", id, sts);
}
delete this.gdh.pending[id]; delete this.gdh.pending[id];
break; break;
} }
case Msg.UNREF_OBJECT_INFO: { case Msg.UNREF_OBJECT_INFO: {
if (this.gdh.debug) console.log("UnrefObjectInfo received", id, sts); if (this.gdh.debug) {
console.log("UnrefObjectInfo received", id, sts);
}
delete this.gdh.pending[id]; delete this.gdh.pending[id];
break; break;
} }
case Msg.REF_OBJECT_INFO_LIST: { case Msg.REF_OBJECT_INFO_LIST: {
if (this.gdh.debug) console.log("RefObjectInfoList received", id, sts); if (this.gdh.debug) {
console.log("RefObjectInfoList received", id, sts);
}
var func_cb = this.gdh.pending[id].func_cb; var func_cb = this.gdh.pending[id].func_cb;
func_cb(id, sts); func_cb(id, sts);
delete this.gdh.pending[id]; delete this.gdh.pending[id];
...@@ -284,7 +312,9 @@ function Gdh() { ...@@ -284,7 +312,9 @@ function Gdh() {
case Msg.GET_OBJECT_REF_INFO_ALL: { case Msg.GET_OBJECT_REF_INFO_ALL: {
var j = 9; var j = 9;
var size = dv.getUint32(j); var size = dv.getUint32(j);
if (this.gdh.debug) console.log("GetObjectRefInfoAll received", id, size); if (this.gdh.debug) {
console.log("GetObjectRefInfoAll received", id, size);
}
j += 4; j += 4;
for (var i = 0; i < size; i++) { for (var i = 0; i < size; i++) {
var eid = dv.getUint32(j); var eid = dv.getUint32(j);
...@@ -292,20 +322,21 @@ function Gdh() { ...@@ -292,20 +322,21 @@ function Gdh() {
var esize = dv.getUint32(j); var esize = dv.getUint32(j);
j += 4; j += 4;
var sub = this.gdh.sub[eid]; var sub = this.gdh.sub[eid];
if (typeof sub == 'undefined') if (typeof sub == 'undefined') {
j += esize; j += esize;
else { } else {
var value; var value;
switch (sub.type) { switch (sub.type) {
case Pwr.eType_Boolean: case Pwr.eType_Boolean:
if (sub.elements <= 1) { if (sub.elements <= 1) {
value = dv.getUint8(j); value = dv.getUint8(j);
j += 1; j += 1;
} } else {
else {
var elements = esize; var elements = esize;
if (elements != sub.elements) if (elements != sub.elements) {
console.log("Subscription size error", elements, sub.elements, eid); console.log("Subscription size error", elements,
sub.elements, eid);
}
value = new Array(elements); value = new Array(elements);
for (var k = 0; k < elements; k++) { for (var k = 0; k < elements; k++) {
value[k] = dv.getUint8(j); value[k] = dv.getUint8(j);
...@@ -317,11 +348,12 @@ function Gdh() { ...@@ -317,11 +348,12 @@ function Gdh() {
if (sub.elements <= 1) { if (sub.elements <= 1) {
value = dv.getFloat32(j); value = dv.getFloat32(j);
j += 4; j += 4;
} } else {
else {
var elements = esize / 4; var elements = esize / 4;
if (elements != sub.elements) if (elements != sub.elements) {
console.log("Subscription size error", elements, sub.elements, eid); console.log("Subscription size error", elements,
sub.elements, eid);
}
value = new Array(elements); value = new Array(elements);
for (var k = 0; k < elements; k++) { for (var k = 0; k < elements; k++) {
value[k] = dv.getFloat32(j); value[k] = dv.getFloat32(j);
...@@ -343,11 +375,12 @@ function Gdh() { ...@@ -343,11 +375,12 @@ function Gdh() {
if (sub.elements <= 1) { if (sub.elements <= 1) {
value = dv.getInt32(j); value = dv.getInt32(j);
j += 4; j += 4;
} } else {
else {
var elements = esize / 4; var elements = esize / 4;
if (elements != sub.elements) if (elements != sub.elements) {
console.log("Subscription size error", elements, sub.elements, eid); console.log("Subscription size error", elements,
sub.elements, eid);
}
value = new Array(elements); value = new Array(elements);
for (var k = 0; k < elements; k++) { for (var k = 0; k < elements; k++) {
value[k] = dv.getInt32(j); value[k] = dv.getInt32(j);
...@@ -368,11 +401,12 @@ function Gdh() { ...@@ -368,11 +401,12 @@ function Gdh() {
iarr[k] = dv.getUint8(j++); iarr[k] = dv.getUint8(j++);
} }
value = String.fromCharCode.apply(null, iarr); value = String.fromCharCode.apply(null, iarr);
} } else {
else {
var elements = sub.elements; var elements = sub.elements;
if (elements != sub.elements) if (elements != sub.elements) {
console.log("Subscription size error", elements, sub.elements, eid); console.log("Subscription size error", elements,
sub.elements, eid);
}
value = new Array(elements); value = new Array(elements);
for (var l = 0; l < elements; l++) { for (var l = 0; l < elements; l++) {
var nsize = dv.getInt16(j); var nsize = dv.getInt16(j);
...@@ -404,7 +438,9 @@ function Gdh() { ...@@ -404,7 +438,9 @@ function Gdh() {
var result = []; var result = [];
var j = 9; var j = 9;
var size = dv.getUint32(j); var size = dv.getUint32(j);
if (this.gdh.debug) console.log("GetAllXttChildren received", id, size); if (this.gdh.debug) {
console.log("GetAllXttChildren received", id, size);
}
console.log("GetAllXttChildren received", sts, id, size); console.log("GetAllXttChildren received", sts, id, size);
j += 4; j += 4;
for (var i = 0; i < size; i++) { for (var i = 0; i < size; i++) {
...@@ -451,7 +487,9 @@ function Gdh() { ...@@ -451,7 +487,9 @@ function Gdh() {
var result = []; var result = [];
var j = 9; var j = 9;
var size = dv.getUint32(j); var size = dv.getUint32(j);
if (this.gdh.debug) console.log("GetAllClassAttributes received", id, size); if (this.gdh.debug) {
console.log("GetAllClassAttributes received", id, size);
}
j += 4; j += 4;
for (var i = 0; i < size; i++) { for (var i = 0; i < size; i++) {
var info = new AttributeInfo(); var info = new AttributeInfo();
...@@ -488,7 +526,9 @@ function Gdh() { ...@@ -488,7 +526,9 @@ function Gdh() {
case Msg.GET_OBJECT: case Msg.GET_OBJECT:
case Msg.GET_OBJECT_FROM_AREF: case Msg.GET_OBJECT_FROM_AREF:
case Msg.GET_OBJECT_FROM_NAME: { case Msg.GET_OBJECT_FROM_NAME: {
if (this.gdh.debug) console.log("GetObject received", id, sts); if (this.gdh.debug) {
console.log("GetObject received", id, sts);
}
var info = null; var info = null;
if ((sts & 1) !== 0) { if ((sts & 1) !== 0) {
var j = 9; var j = 9;
...@@ -555,7 +595,9 @@ function Gdh() { ...@@ -555,7 +595,9 @@ function Gdh() {
var result = []; var result = [];
var size = dv.getUint16(j); var size = dv.getUint16(j);
j += 2; j += 2;
if (this.gdh.debug) console.log("CrrSignal received", id, size); if (this.gdh.debug) {
console.log("CrrSignal received", id, size);
}
for (var i = 0; i < size; i++) { for (var i = 0; i < size; i++) {
var info = new CrrInfo(); var info = new CrrInfo();
info.type = dv.getUint16(j); info.type = dv.getUint16(j);
...@@ -590,7 +632,9 @@ function Gdh() { ...@@ -590,7 +632,9 @@ function Gdh() {
case Msg.GET_OPWIND_MENU: { case Msg.GET_OPWIND_MENU: {
var result = new OpwindMenuInfo(); var result = new OpwindMenuInfo();
var j = 9; var j = 9;
if (this.gdh.debug) console.log("GetOpwindMenu received", id, size); if (this.gdh.debug) {
console.log("GetOpwindMenu received", id, size);
}
console.log("GetOpwindMenu received", sts, id); console.log("GetOpwindMenu received", sts, id);
if (sts & 1) { if (sts & 1) {
...@@ -666,7 +710,9 @@ function Gdh() { ...@@ -666,7 +710,9 @@ function Gdh() {
} }
case Msg.CHECK_USER: { case Msg.CHECK_USER: {
var j = 9; var j = 9;
if (this.gdh.debug) console.log("Check user received", id, size); if (this.gdh.debug) {
console.log("Check user received", id, size);
}
console.log("Check user received", sts, id); console.log("Check user received", sts, id);
var priv = 0; var priv = 0;
...@@ -699,7 +745,9 @@ function Gdh() { ...@@ -699,7 +745,9 @@ function Gdh() {
var result = []; var result = [];
var j = 9; var j = 9;
var size = dv.getUint32(j); var size = dv.getUint32(j);
if (this.gdh.debug) console.log("MhSync received", id, size); if (this.gdh.debug) {
console.log("MhSync received", id, size);
}
j += 4; j += 4;
for (var i = 0; i < size; i++) { for (var i = 0; i < size; i++) {
var e = new MhEvent(); var e = new MhEvent();
...@@ -907,8 +955,7 @@ function Gdh() { ...@@ -907,8 +955,7 @@ function Gdh() {
this.subscriptionCount++; this.subscriptionCount++;
if (!this.listSent) { if (!this.listSent) {
return sub.refid; return sub.refid;
} } else {
else {
var size = 0; var size = 0;
var len = 0; var len = 0;
...@@ -920,7 +967,9 @@ function Gdh() { ...@@ -920,7 +967,9 @@ function Gdh() {
buf[3] = (this.next_id >> 8) & 0xFF; buf[3] = (this.next_id >> 8) & 0xFF;
buf[4] = (this.next_id >> 16) & 0xFF; buf[4] = (this.next_id >> 16) & 0xFF;
buf[5] = (this.next_id >> 24) & 0xFF; buf[5] = (this.next_id >> 24) & 0xFF;
if (this.debug) console.log("RefObjectInfo: ", sub.refid); if (this.debug) {
console.log("RefObjectInfo: ", sub.refid);
}
var k = 6; var k = 6;
buf[k++] = sub.refid & 0xFF; buf[k++] = sub.refid & 0xFF;
buf[k++] = (sub.refid >> 8) & 0xFF; buf[k++] = (sub.refid >> 8) & 0xFF;
...@@ -939,8 +988,11 @@ function Gdh() { ...@@ -939,8 +988,11 @@ function Gdh() {
buf[k++] = sub.name.charCodeAt(j); buf[k++] = sub.name.charCodeAt(j);
} }
this.pending[this.next_id] = new PendingData(this.refObjectInfoReply, null); this.pending[this.next_id] =
if (this.debug) console.log("Sending RefObjectInfo", this.next_id, size, k); new PendingData(this.refObjectInfoReply, null);
if (this.debug) {
console.log("Sending RefObjectInfo", this.next_id, size, k);
}
this.ws.send(buf); this.ws.send(buf);
this.next_id++; this.next_id++;
...@@ -949,7 +1001,9 @@ function Gdh() { ...@@ -949,7 +1001,9 @@ function Gdh() {
} }
}; };
this.refObjectInfoReply = function (id, sts) { this.refObjectInfoReply = function (id, sts) {
if (this.debug) console.log("refObjectInfoReply", id, sts); if (this.debug) {
console.log("refObjectInfoReply", id, sts);
}
}; };
this.unrefObjectInfo = function (refid) { this.unrefObjectInfo = function (refid) {
var size = 0; var size = 0;
...@@ -963,15 +1017,20 @@ function Gdh() { ...@@ -963,15 +1017,20 @@ function Gdh() {
buf[3] = (this.next_id >> 8) & 0xFF; buf[3] = (this.next_id >> 8) & 0xFF;
buf[4] = (this.next_id >> 16) & 0xFF; buf[4] = (this.next_id >> 16) & 0xFF;
buf[5] = (this.next_id >> 24) & 0xFF; buf[5] = (this.next_id >> 24) & 0xFF;
if (this.debug) console.log("UnrefObjectInfo: ", refid); if (this.debug) {
console.log("UnrefObjectInfo: ", refid);
}
var k = 6; var k = 6;
buf[k++] = refid & 0xFF; buf[k++] = refid & 0xFF;
buf[k++] = (refid >> 8) & 0xFF; buf[k++] = (refid >> 8) & 0xFF;
buf[k++] = (refid >> 16) & 0xFF; buf[k++] = (refid >> 16) & 0xFF;
buf[k++] = (refid >> 24) & 0xFF; buf[k++] = (refid >> 24) & 0xFF;
this.pending[this.next_id] = new PendingData(this.unrefObjectInfoReply, null); this.pending[this.next_id] =
if (this.debug) console.log("Sending UnrefObjectInfo", this.next_id, size, k, refid); new PendingData(this.unrefObjectInfoReply, null);
if (this.debug) {
console.log("Sending UnrefObjectInfo", this.next_id, size, k, refid);
}
this.ws.send(buf); this.ws.send(buf);
this.next_id++; this.next_id++;
...@@ -999,9 +1058,12 @@ function Gdh() { ...@@ -999,9 +1058,12 @@ function Gdh() {
buf[9] = (len >> 24) & 0xFF; buf[9] = (len >> 24) & 0xFF;
var k = 10; var k = 10;
for (var i in this.sub) { for (var i in this.sub) {
if (i === 0) if (i === 0) {
continue; continue;
if (this.debug) console.log("RefObjectInfoList: ", this.sub[i].refid); }
if (this.debug) {
console.log("RefObjectInfoList: ", this.sub[i].refid);
}
buf[k++] = this.sub[i].refid & 0xFF; buf[k++] = this.sub[i].refid & 0xFF;
buf[k++] = (this.sub[i].refid >> 8) & 0xFF; buf[k++] = (this.sub[i].refid >> 8) & 0xFF;
buf[k++] = (this.sub[i].refid >> 16) & 0xFF; buf[k++] = (this.sub[i].refid >> 16) & 0xFF;
...@@ -1020,14 +1082,19 @@ function Gdh() { ...@@ -1020,14 +1082,19 @@ function Gdh() {
} }
} }
this.pending[this.next_id] = new PendingData(return_cb, null); this.pending[this.next_id] = new PendingData(return_cb, null);
if (this.debug) console.log("Sending RefObjectInfoList", this.next_id, size, k, this.next_id); if (this.debug) {
console.log("Sending RefObjectInfoList", this.next_id, size, k,
this.next_id);
}
this.ws.send(buf); this.ws.send(buf);
this.next_id++; this.next_id++;
this.listSent = true; this.listSent = true;
}; };
this.refObjectInfoListReply = function (id, sts) { this.refObjectInfoListReply = function (id, sts) {
if (this.debug) console.log("refObjectInfoListReply", id, sts); if (this.debug) {
console.log("refObjectInfoListReply", id, sts);
}
}; };
this.getRefObjectInfoAll = function (return_cb) { this.getRefObjectInfoAll = function (return_cb) {
var buf = new Uint8Array(6); var buf = new Uint8Array(6);
...@@ -1037,15 +1104,21 @@ function Gdh() { ...@@ -1037,15 +1104,21 @@ function Gdh() {
buf[4] = (this.next_id >> 16) & 0xFF; buf[4] = (this.next_id >> 16) & 0xFF;
buf[5] = (this.next_id >> 24) & 0xFF; buf[5] = (this.next_id >> 24) & 0xFF;
this.pending[this.next_id] = new PendingData(return_cb, null); this.pending[this.next_id] = new PendingData(return_cb, null);
if (this.debug) console.log("Sending getRefObjectInfoAll", this.next_id); if (this.debug) {
console.log("Sending getRefObjectInfoAll", this.next_id);
}
this.ws.send(buf); this.ws.send(buf);
this.next_id++; this.next_id++;
}; };
this.getRefObjectInfoAllReply = function (id, sts) { this.getRefObjectInfoAllReply = function (id, sts) {
if (this.debug) console.log("getRefObjectInfoAllReply", id, sts); if (this.debug) {
console.log("getRefObjectInfoAllReply", id, sts);
}
}; };
this.getObjectRefInfo = function (id) { this.getObjectRefInfo = function (id) {
if (this.debug) console.log("getObjectRefInfo", id, this.sub[id].value); if (this.debug) {
console.log("getObjectRefInfo", id, this.sub[id].value);
}
return this.sub[id].value; return this.sub[id].value;
}; };
this.setObjectInfoBoolean = function (name, value) { this.setObjectInfoBoolean = function (name, value) {
...@@ -1066,7 +1139,9 @@ function Gdh() { ...@@ -1066,7 +1139,9 @@ function Gdh() {
buf[k++] = name.charCodeAt(i); buf[k++] = name.charCodeAt(i);
} }
this.ws.send(buf); this.ws.send(buf);
if (this.debug) console.log("Sending setObjectInfoBoolean", this.next_id, name, value); if (this.debug) {
console.log("Sending setObjectInfoBoolean", this.next_id, name, value);
}
this.next_id++; this.next_id++;
return new PwrtStatus(1); return new PwrtStatus(1);
...@@ -1091,7 +1166,9 @@ function Gdh() { ...@@ -1091,7 +1166,9 @@ function Gdh() {
} }
// this.pending[this.next_id] = new PendingData( return_cb, null); // this.pending[this.next_id] = new PendingData( return_cb, null);
this.ws.send(buf); this.ws.send(buf);
if (this.debug) console.log("Sending setObjectInfoInt", this.next_id, name, value); if (this.debug) {
console.log("Sending setObjectInfoInt", this.next_id, name, value);
}
this.next_id++; this.next_id++;
return new PwrtStatus(1); return new PwrtStatus(1);
...@@ -1120,7 +1197,9 @@ function Gdh() { ...@@ -1120,7 +1197,9 @@ function Gdh() {
} }
// this.pending[this.next_id] = new PendingData( return_cb, null); // this.pending[this.next_id] = new PendingData( return_cb, null);
this.ws.send(buf); this.ws.send(buf);
if (this.debug) console.log("Sending setObjectInfoFloat", this.next_id, name, value); if (this.debug) {
console.log("Sending setObjectInfoFloat", this.next_id, name, value);
}
this.next_id++; this.next_id++;
return new PwrtStatus(1); return new PwrtStatus(1);
...@@ -1137,8 +1216,9 @@ function Gdh() { ...@@ -1137,8 +1216,9 @@ function Gdh() {
buf[6] = value.length & 0xFF; buf[6] = value.length & 0xFF;
buf[7] = (value.length >> 8) & 0xFF; buf[7] = (value.length >> 8) & 0xFF;
var k = 8; var k = 8;
for (i = 0; i < value.length; i++) for (i = 0; i < value.length; i++) {
buf[k++] = value.charCodeAt(i); buf[k++] = value.charCodeAt(i);
}
buf[k++] = name.length & 0xFF; buf[k++] = name.length & 0xFF;
buf[k++] = (name.length >> 8) & 0xFF; buf[k++] = (name.length >> 8) & 0xFF;
for (i = 0; i < name.length; i++) { for (i = 0; i < name.length; i++) {
...@@ -1146,7 +1226,9 @@ function Gdh() { ...@@ -1146,7 +1226,9 @@ function Gdh() {
} }
// this.pending[this.next_id] = new PendingData( return_cb, null); // this.pending[this.next_id] = new PendingData( return_cb, null);
this.ws.send(buf); this.ws.send(buf);
if (this.debug) console.log("Sending setObjectInfoString", this.next_id, name, value); if (this.debug) {
console.log("Sending setObjectInfoString", this.next_id, name, value);
}
this.next_id++; this.next_id++;
return new PwrtStatus(1); return new PwrtStatus(1);
...@@ -1167,7 +1249,9 @@ function Gdh() { ...@@ -1167,7 +1249,9 @@ function Gdh() {
} }
// this.pending[this.next_id] = new PendingData( return_cb, null); // this.pending[this.next_id] = new PendingData( return_cb, null);
this.ws.send(buf); this.ws.send(buf);
if (this.debug) console.log("Sending toggleObjectInfoBoolean", this.next_id, name, value); if (this.debug) {
console.log("Sending toggleObjectInfoBoolean", this.next_id, name, value);
}
this.next_id++; this.next_id++;
return new PwrtStatus(1); return new PwrtStatus(1);
...@@ -1189,7 +1273,9 @@ function Gdh() { ...@@ -1189,7 +1273,9 @@ function Gdh() {
buf[12] = (oid.oix >> 16) & 0xFF; buf[12] = (oid.oix >> 16) & 0xFF;
buf[13] = (oid.oix >> 24) & 0xFF; buf[13] = (oid.oix >> 24) & 0xFF;
this.pending[this.next_id] = new PendingData(return_cb, data); this.pending[this.next_id] = new PendingData(return_cb, data);
if (this.debug) console.log("Sending getAllXttChildren", this.next_id); if (this.debug) {
console.log("Sending getAllXttChildren", this.next_id);
}
this.ws.send(buf); this.ws.send(buf);
this.next_id++; this.next_id++;
}; };
...@@ -1214,7 +1300,10 @@ function Gdh() { ...@@ -1214,7 +1300,10 @@ function Gdh() {
buf[16] = (oid.oix >> 16) & 0xFF; buf[16] = (oid.oix >> 16) & 0xFF;
buf[17] = (oid.oix >> 24) & 0xFF; buf[17] = (oid.oix >> 24) & 0xFF;
this.pending[this.next_id] = new PendingData(return_cb, data); this.pending[this.next_id] = new PendingData(return_cb, data);
if (this.debug) console.log("Sending getAllClassAttributes", this.next_id, cid, oid.vid, oid.oix); if (this.debug) {
console.log("Sending getAllClassAttributes", this.next_id, cid, oid.vid,
oid.oix);
}
this.ws.send(buf); this.ws.send(buf);
this.next_id++; this.next_id++;
}; };
...@@ -1237,7 +1326,9 @@ function Gdh() { ...@@ -1237,7 +1326,9 @@ function Gdh() {
buf[14] = (oid.oix >> 16) & 0xFF; buf[14] = (oid.oix >> 16) & 0xFF;
buf[15] = (oid.oix >> 24) & 0xFF; buf[15] = (oid.oix >> 24) & 0xFF;
this.pending[this.next_id] = new PendingData(return_cb, data); this.pending[this.next_id] = new PendingData(return_cb, data);
if (this.debug) console.log("Sending getObject", this.next_id, oid.vid, oid.oix); if (this.debug) {
console.log("Sending getObject", this.next_id, oid.vid, oid.oix);
}
this.ws.send(buf); this.ws.send(buf);
this.next_id++; this.next_id++;
}; };
...@@ -1276,7 +1367,9 @@ function Gdh() { ...@@ -1276,7 +1367,9 @@ function Gdh() {
buf[30] = (aref.flags >> 16) & 0xFF; buf[30] = (aref.flags >> 16) & 0xFF;
buf[31] = (aref.flags >> 24) & 0xFF; buf[31] = (aref.flags >> 24) & 0xFF;
this.pending[this.next_id] = new PendingData(return_cb, data); this.pending[this.next_id] = new PendingData(return_cb, data);
if (this.debug) console.log("Sending getObject", this.next_id, oid.vid, oid.oix); if (this.debug) {
console.log("Sending getObject", this.next_id, oid.vid, oid.oix);
}
this.ws.send(buf); this.ws.send(buf);
this.next_id++; this.next_id++;
}; };
...@@ -1297,7 +1390,9 @@ function Gdh() { ...@@ -1297,7 +1390,9 @@ function Gdh() {
buf[k++] = name.charCodeAt(i); buf[k++] = name.charCodeAt(i);
} }
this.pending[this.next_id] = new PendingData(return_cb, data); this.pending[this.next_id] = new PendingData(return_cb, data);
if (this.debug) console.log("Sending getObjectFromName", this.next_id, name); if (this.debug) {
console.log("Sending getObjectFromName", this.next_id, name);
}
this.ws.send(buf); this.ws.send(buf);
this.next_id++; this.next_id++;
}; };
...@@ -1318,7 +1413,9 @@ function Gdh() { ...@@ -1318,7 +1413,9 @@ function Gdh() {
buf[12] = (oid.oix >> 16) & 0xFF; buf[12] = (oid.oix >> 16) & 0xFF;
buf[13] = (oid.oix >> 24) & 0xFF; buf[13] = (oid.oix >> 24) & 0xFF;
this.pending[this.next_id] = new PendingData(return_cb, data); this.pending[this.next_id] = new PendingData(return_cb, data);
if (this.debug) console.log("Sending crrObject", this.next_id, oid.vid, oid.oix); if (this.debug) {
console.log("Sending crrObject", this.next_id, oid.vid, oid.oix);
}
this.ws.send(buf); this.ws.send(buf);
this.next_id++; this.next_id++;
}; };
...@@ -1339,7 +1436,9 @@ function Gdh() { ...@@ -1339,7 +1436,9 @@ function Gdh() {
buf[k++] = name.charCodeAt(i); buf[k++] = name.charCodeAt(i);
} }
this.pending[this.next_id] = new PendingData(return_cb, data); this.pending[this.next_id] = new PendingData(return_cb, data);
if (this.debug) console.log("Sending getOpwindMenu", this.next_id); if (this.debug) {
console.log("Sending getOpwindMenu", this.next_id);
}
this.ws.send(buf); this.ws.send(buf);
this.next_id++; this.next_id++;
}; };
...@@ -1366,7 +1465,9 @@ function Gdh() { ...@@ -1366,7 +1465,9 @@ function Gdh() {
buf[k++] = passwd.charCodeAt(i); buf[k++] = passwd.charCodeAt(i);
} }
this.pending[this.next_id] = new PendingData(return_cb, data); this.pending[this.next_id] = new PendingData(return_cb, data);
if (this.debug) console.log("Sending login", this.next_id); if (this.debug) {
console.log("Sending login", this.next_id);
}
this.ws.send(buf); this.ws.send(buf);
this.next_id++; this.next_id++;
}; };
...@@ -1384,7 +1485,9 @@ function Gdh() { ...@@ -1384,7 +1485,9 @@ function Gdh() {
buf[9] = (value >> 24) & 0xFF; buf[9] = (value >> 24) & 0xFF;
this.pending[this.next_id] = new PendingData(return_cb, data); this.pending[this.next_id] = new PendingData(return_cb, data);
this.ws.send(buf); this.ws.send(buf);
if (this.debug) console.log("Sending getMsg", this.next_id, value); if (this.debug) {
console.log("Sending getMsg", this.next_id, value);
}
this.next_id++; this.next_id++;
}; };
...@@ -1400,7 +1503,9 @@ function Gdh() { ...@@ -1400,7 +1503,9 @@ function Gdh() {
buf[8] = (sync >> 16) & 0xFF; buf[8] = (sync >> 16) & 0xFF;
buf[9] = (sync >> 24) & 0xFF; buf[9] = (sync >> 24) & 0xFF;
this.pending[this.next_id] = new PendingData(return_cb, data); this.pending[this.next_id] = new PendingData(return_cb, data);
if (this.debug) console.log("Sending mhSync", this.next_id); if (this.debug) {
console.log("Sending mhSync", this.next_id);
}
this.ws.send(buf); this.ws.send(buf);
this.next_id++; this.next_id++;
}; };
...@@ -1428,7 +1533,9 @@ function Gdh() { ...@@ -1428,7 +1533,9 @@ function Gdh() {
buf[k++] = event_id.birthTime.charCodeAt(i); buf[k++] = event_id.birthTime.charCodeAt(i);
} }
this.pending[this.next_id] = new PendingData(return_cb, data); this.pending[this.next_id] = new PendingData(return_cb, data);
if (this.debug) console.log("Sending mhAcknowledge", this.next_id); if (this.debug) {
console.log("Sending mhAcknowledge", this.next_id);
}
console.log("Sending mhAcknowledge", this.next_id); console.log("Sending mhAcknowledge", this.next_id);
this.ws.send(buf); this.ws.send(buf);
this.next_id++; this.next_id++;
......
...@@ -21,96 +21,55 @@ var Bitmaps = { ...@@ -21,96 +21,55 @@ var Bitmaps = {
maintenance: 34, maintenance: 34,
blockl: 36, blockl: 36,
blockr: 38, blockr: 38,
img: [null, null, null, null, null, null, null, null, null, null, img: [null, null, null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null], null, null],
pending: [null, null, null, null, null, null, null, null, null, null, pending: [null, null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null], null, null, null],
images: [ images: [// leaf
// leaf 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAMCAYAAABSgIzaAAAASElEQVQokWP4jwMwMDBgYBR5XBpwGYZVIzYNGDZB+QyEFOBiM+CyCacGBI0hgEGjsxkYGCiwkSI/4tKMz0DqxCM2A4hOOcQCAObFEQyI2PpKAAAAAElFTkSuQmCC', // leaf inverted
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAMCAYAAABSgIzaAAAASElEQVQokWP4jwMwMDBgYBR5XBpwGYZVIzYNGDZB+QyEFOBiM+CyCacGBI0hgEGjsxkYGCiwkSI/4tKMz0DqxCM2A4hOOcQCAObFEQyI2PpKAAAAAElFTkSuQmCC', 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAMCAYAAABSgIzaAAAAQUlEQVQokWNgYGD4jw1jA2hqsGvAZRhWjdg0oIsh8QkqwMXGbhMuDXAxdAFsNDobyifTRor8SFGoUhSPFKUcYjEAMsMz2y6w8kgAAAAASUVORK5CYII=', // map
// leaf inverted 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAMCAYAAABSgIzaAAAAKElEQVQokWP4DwUMDAwYGB9gwKUQm0FoGL/JOGwb1TgINZKFSbYOCgD1JxQJG0vK9AAAAABJRU5ErkJggg==', // map inverted
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAMCAYAAABSgIzaAAAAQUlEQVQokWNgYGD4jw1jA2hqsGvAZRhWjdg0oIsh8QkqwMXGbhMuDXAxdAFsNDobyifTRor8SFGoUhSPFKUcYjEAMsMz2y6w8kgAAAAASUVORK5CYII=', 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAMCAYAAABSgIzaAAAAK0lEQVQokWNgYGD4z8DA8B8bgMlhxbgUEgIMBE3Ggkc1Dk6N5AAGUm2DYQAkYTDe0vu7CAAAAABJRU5ErkJggg==', // openmap
// map 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAMCAYAAABSgIzaAAAAQklEQVQokaXOwQ4AIAgCUP7/p+nUlpMSzY2bDwWHA5IEkFJCtaiKxE7dvsue8HZNJEPneoAuSq+OYAf9wy4K0Mk5C+d++RWimsw3AAAAAElFTkSuQmCC', // openmap inverted
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAMCAYAAABSgIzaAAAAKElEQVQokWP4DwUMDAwYGB9gwKUQm0FoGL/JOGwb1TgINZKFSbYOCgD1JxQJG0vK9AAAAABJRU5ErkJggg==', 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAMCAYAAABSgIzaAAAAPUlEQVQokaXRQQoAQAgCQP//6brKZmSt0M2hIACI4yBURqiKXQp0ThuhGwmt7Vy00XvqCa7QN1wjhtYLCCYyCkvDVnkJOQAAAABJRU5ErkJggg==', // object
// map inverted 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAAH0lEQVQokWP4TyJgYGBg+E8iZiDFdHrZMKqBGA2kYAD8gaJsjwzf9wAAAABJRU5ErkJggg==', // object inverted
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAMCAYAAABSgIzaAAAAK0lEQVQokWNgYGD4z8DA8B8bgMlhxbgUEgIMBE3Ggkc1Dk6N5AAGUm2DYQAkYTDe0vu7CAAAAABJRU5ErkJggg==', 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAAIklEQVQokWNgYGD4TxL+TyJg+P//P9GmwzXQ3oZRDdSOBwAGOSrkrXppgQAAAABJRU5ErkJggg==', // attrenum
// openmap 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAMCAYAAABSgIzaAAAAPklEQVQokWP4////fwYGBgxMCDBgU4jNICyYsOlYbENoJNIW7BqJsYm2NuJyBVE2EqWRfjbiUoQ3oAgpwgUANLqccvbgec0AAAAASUVORK5CYII=', // attrenum inverted
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAMCAYAAABSgIzaAAAAQklEQVQokaXOwQ4AIAgCUP7/p+nUlpMSzY2bDwWHA5IEkFJCtaiKxE7dvsue8HZNJEPneoAuSq+OYAf9wy4K0Mk5C+d++RWimsw3AAAAAElFTkSuQmCC', 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAMCAYAAABSgIzaAAAAPElEQVQokWNgYGD4jw0wMDDgx9gUEgMYiDIdDaNoJBZg1UiUTTS1EZcriLKRKI30sxGXIgKBhF8RrqgBAOTOqGZ5aiCnAAAAAElFTkSuQmCC', // attrarra
// openmap inverted 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAMCAYAAABSgIzaAAAAMElEQVQokWP4////fwYGBgxMCDBgU4jNICwYv+nY5InWOGojXW0khLEahtc6PDYCAB9hxkjBPICvAAAAAElFTkSuQmCC', // attrarray inverted
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAMCAYAAABSgIzaAAAAPUlEQVQokaXRQQoAQAgCQP//6brKZmSt0M2hIACI4yBURqiKXQp0ThuhGwmt7Vy00XvqCa7QN1wjhtYLCCYyCkvDVnkJOQAAAABJRU5ErkJggg==', 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAMCAYAAABSgIzaAAAALUlEQVQokWNgYGD4jw0wMDDgx9gUEgMYCJmOTZ5ojaM20tVGQgCHK/AnLVwAAPonfpBwU5f4AAAAAElFTkSuQmCC', // attrarel
// object 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAAIklEQVQokWP4////fwYGBpwYHTDANGADeDWM2jAEbSAFAADB26JsIjYj1AAAAABJRU5ErkJggg==', // attrarel inverted
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAAH0lEQVQokWP4TyJgYGBg+E8iZiDFdHrZMKqBGA2kYAD8gaJsjwzf9wAAAABJRU5ErkJggg==', 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAAIElEQVQokWNgYGD4jw8wMDCgYwZcEvg1jNowBG0gBQMAQN8q5COZl1cAAAAASUVORK5CYII=', // attr
// object inverted 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAAIUlEQVQokWP4TyJgGIQaGBgY/pOIibcEroEkTLIfhoEGADzs8B5gcUg/AAAAAElFTkSuQmCC', // attr inverted
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAAIklEQVQokWNgYGD4TxL+TyJg+P//P9GmwzXQ3oZRDdSOBwAGOSrkrXppgQAAAABJRU5ErkJggg==', 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAAJUlEQVQokWNgYGD4TyIedBr+kwgY/v//T7TpcA0k2TAIQ4nmGgDFzt0jExR7hgAAAABJRU5ErkJggg==', // crrwrite
// attrenum 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAAN0lEQVQokaWNQQoAMAjD8v9P633WVWhBkJIotQQoYPYbrHYrqC9D+MG54OBMuMC54GApuPBed9OxiMNLGke1JwAAAABJRU5ErkJggg==', // crrwrite inverted
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAMCAYAAABSgIzaAAAAPklEQVQokWP4////fwYGBgxMCDBgU4jNICyYsOlYbENoJNIW7BqJsYm2NuJyBVE2EqWRfjbiUoQ3oAgpwgUANLqccvbgec0AAAAASUVORK5CYII=', 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAANElEQVQokWNgYGD4jw3DABY57IqxsQlqwGELSYop1ECEYgo0EKmYQg1EKMbUQEAxRAMpAABRMgoFjbTzXgAAAABJRU5ErkJggg==', // crrread
// attrenum inverted 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAAPElEQVQokWNgYGD4j4yRATY5BmyKkGks4qgS2BSj2UYFDdgAdW2gvpOwhDW6ItwaCGI8JuHWgMOtWD0PACufaaWhXDFDAAAAAElFTkSuQmCC', // crrread inverted
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAMCAYAAABSgIzaAAAAPElEQVQokWNgYGD4jw0wMDDgx9gUEgMYiDIdDaNoJBZg1UiUTTS1EZcriLKRKI30sxGXIgKBhF8RrqgBAOTOqGZ5aiCnAAAAAElFTkSuQmCC', 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAAPElEQVQokWP4jwYYGBjgGKscNkXINLo4hgZsipFto44GbJi6NlDfSehhjUxjyGMVxQMYcJmEVwPB5ICEAdcbY6vf9TVAAAAAAElFTkSuQmCC', // ack
// attrarra 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAAS0lEQVQokZ2Q2w4AIAhCz///ND11M3RVmxuDUBRAtw8QHRyC4SSJSDjDht1Yhxdudks+bFNxYsX9G6rz2qVHxqRspGi2Wpoji/dqaLh22DbO2VuXAAAAAElFTkSuQmCC', // ack inverted
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAMCAYAAABSgIzaAAAAMElEQVQokWP4////fwYGBgxMCDBgU4jNICwYv+nY5InWOGojXW0khLEahtc6PDYCAB9hxkjBPICvAAAAAElFTkSuQmCC', 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAASklEQVQokWP4////fwYGBqIwVC2cgSKBTQzKxhDA0ICmGau12BRCMLJp2BQgy8H9gM9ELGJkasAXvFg9TQjgDCVc8YBXAwFMmgYASkT1C9E5Ya0AAAAASUVORK5CYII=', // alarm
// attrarray inverted 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAARklEQVQokZ2QQQoAMAjD+v9Pu9PA1ThQQRBtoFUBJSkk0SlwOwKykCAEcn+BK8hih/aAe++y7IDuhWgXfcKHCuBBfX6ASR3Vn8ZINQzCrQAAAABJRU5ErkJggg==', // alarm inverted
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAMCAYAAABSgIzaAAAALUlEQVQokWNgYGD4jw0wMDDgx9gUEgMYCJmOTZ5ojaM20tVGQgCHK/AnLVwAAPonfpBwU5f4AAAAAElFTkSuQmCC', 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAAQ0lEQVQokWNgYGD4j45hAJscA8UakBXi0ITddDy2YJqOrBiLJjI1oLsdj1/I0IAnCLFpwtSALYQwNKB7FJ2NooEUDAAtGwcI+Svs4gAAAABJRU5ErkJggg==', // eventacked
// attrarel 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAAL0lEQVQokWP4TyJgGCkaGBgQyhhwSeASw9CAYho2A3CZiE0xVg34FOPUgA+QrAEA1FYi+tWeG/cAAAAASUVORK5CYII=', // eventacked inverted
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAAIklEQVQokWP4////fwYGBpwYHTDANGADeDWM2jAEbSAFAADB26JsIjYj1AAAAABJRU5ErkJggg==', 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAAMElEQVQokWNgYGD4TyIeGRr+//+PXQOaBC4xVElkBdgMwHASTBEOxdj9gEcxHYIVAC5kqlZXl5JMAAAAAElFTkSuQmCC', // eventalarm
// attrarel inverted 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAAJ0lEQVQokWP4jwMwMDBgF8elGIZHNeDSANOEVRyXBpwGUcUGqvoBAK+H8xt0qXFWAAAAAElFTkSuQmCC', // eventalarm inverted
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAAIElEQVQokWNgYGD4jw8wMDCgYwZcEvg1jNowBG0gBQMAQN8q5COZl1cAAAAASUVORK5CYII=', 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAAJ0lEQVQokWNgYGD4jw3///8fqzgDLsUwMKoBlwaSg5UAHoiIw2cDAFMz2iY65DAoAAAAAElFTkSuQmC', // eventreturn
// attr 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAASUlEQVQokZ2RUQoAIAjFdv9L11dhskeUEIQ2mcYIAXjeisA+EahFA9ad/siAA0wqSUsnu87wDZh3VEodO6Rr1c51rc8fd9OoMQHLk7dXak3qLwAAAABJRU5ErkJggg==', // eventreturn inverted
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAAIUlEQVQokWP4TyJgGIQaGBgY/pOIibcEroEkTLIfhoEGADzs8B5gcUg/AAAAAElFTkSuQmCC', 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAAR0lEQVQokZ2S2woAIAhD9/8/vV6tjgMNhLxMN1SSTGYb46JkfS2gJglQ/ncRAZ5JTCXQYsFRwxpAvFtKoeMvmoqDv1jc5DQONycV+bfOetgAAAAASUVORK5CYII=', // info
// attr inverted 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAAOUlEQVQokWNgYGD4///////E0AwMDP8hPDQAk8QhjlMCuzg2G3AB6tlAez8MglAiCZNiw/////8DACmmtFrq9aGNAAAAAElFTkSuQmCC', // info inverted
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAAJUlEQVQokWNgYGD4TyIedBr+kwgY/v//T7TpcA0k2TAIQ4nmGgDFzt0jExR7hgAAAABJRU5ErkJggg==', 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAAN0lEQVQokWP4////fwYGhv/E0FA2w390jCSJIc6ASwKnBmw24MLUs4H2fhgEoUQKIMkGBgaG/wDZFBj2pVi3HgAAAABJRU5ErkJggg==', // system
// crrwrite 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAAN0lEQVQokWNgYGD4TyJm+E8sgGugig3YxHFqwGcIQQ3obAwN6G7GawMuhVg1EFKMUwM+QJ+IAwDD1Gyi1EZc6gAAAABJRU5ErkJggg==', // system inverted
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAAN0lEQVQokaWNQQoAMAjD8v9P633WVWhBkJIotQQoYPYbrHYrqC9D+MG54OBMuMC54GApuPBed9OxiMNLGke1JwAAAABJRU5ErkJggg==', 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAAO0lEQVQokWP4TyJg+P///38GBgaiMFwDVWzAJo5TA15DCGnAYKNrwHAzPhtwKcSqgZBinBqIigeaRhwAPuZgrlZXy70AAAAASUVORK5CYII=', // maintenance
// crrwrite inverted 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAAP0lEQVQokZWPQQoAMAzC8v9Pu8soDOxaBS82QkWNgPKTJ/BYsLekAOxfquwHWyfws6ED7OgtfNk9bAuTSGBJOufqnHIsmYkzAAAAAElFTkSuQmCC', // maintenance inverted
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAANElEQVQokWNgYGD4jw3DABY57IqxsQlqwGELSYop1ECEYgo0EKmYQg1EKMbUQEAxRAMpAABRMgoFjbTzXgAAAABJRU5ErkJggg==', 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAAQUlEQVQokZWPQQ4AMAQE5/+f1kuTCkuROGAmADCVPsJsBfdCsX0u3N7sJFfXsAqW8BMaID+9gE3SJayEFo7CFwY7GtAw3ouVj50AAAAASUVORK5CYII=', // blockl
// crrread 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAAQElEQVQokZ2QQQ4AMAjC+v9Pu9MWl5AJ42a0IlKBgCIadgGgQ8imqo9D3zDBvJoyR+zwlWHS9SUHaOf4QOywtQCQGucn0g2dEQAAAABJRU5ErkJggg==', // blockl inverted
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAAPElEQVQokWNgYGD4j4yRATY5BmyKkGks4qgS2BSj2UYFDdgAdW2gvpOwhDW6ItwaCGI8JuHWgMOtWD0PACufaaWhXDFDAAAAAElFTkSuQmCC', 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAAOklEQVQokWNgYGD4Tyz+////fwZSFBOtAaoQQsM46JLY+HAbUEwgrJmwyZTZQJYfSAolmsQDWTENwwByoOYaWbAqegAAAABJRU5ErkJggg==', // blockr
// crrread inverted 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAAPElEQVQokWP4jwMwMDBgF8enAZsmvBqw2cSARQBDIQqbGEUoaggpQBcj3Qay/IAN4AwlfBrIigeiNeACADpU5yeYXn+XAAAAAElFTkSuQmCC', // blockr inverted
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAAPElEQVQokWP4jwYYGBjgGKscNkXINLo4hgZsipFto44GbJi6NlDfSehhjUxjyGMVxQMYcJmEVwPB5ICEAdcbY6vf9TVAAAAAAElFTkSuQmCC', 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAAPElEQVQokWNgYGD4jw3///8fqzgDPg04NOG3AUMTugA2hWhqiFKEzCeoAF2MRBvI8gNJoUT1eCBaAy4MAMhm5hr5iTaWAAAAAElFTkSuQmCC']
// ack
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAAS0lEQVQokZ2Q2w4AIAhCz///ND11M3RVmxuDUBRAtw8QHRyC4SSJSDjDht1Yhxdudks+bFNxYsX9G6rz2qVHxqRspGi2Wpoji/dqaLh22DbO2VuXAAAAAElFTkSuQmCC',
// ack inverted
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAASklEQVQokWP4////fwYGBqIwVC2cgSKBTQzKxhDA0ICmGau12BRCMLJp2BQgy8H9gM9ELGJkasAXvFg9TQjgDCVc8YBXAwFMmgYASkT1C9E5Ya0AAAAASUVORK5CYII=',
// alarm
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAARklEQVQokZ2QQQoAMAjD+v9Pu9PA1ThQQRBtoFUBJSkk0SlwOwKykCAEcn+BK8hih/aAe++y7IDuhWgXfcKHCuBBfX6ASR3Vn8ZINQzCrQAAAABJRU5ErkJggg==',
// alarm inverted
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAAQ0lEQVQokWNgYGD4j45hAJscA8UakBXi0ITddDy2YJqOrBiLJjI1oLsdj1/I0IAnCLFpwtSALYQwNKB7FJ2NooEUDAAtGwcI+Svs4gAAAABJRU5ErkJggg==',
// eventacked
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAAL0lEQVQokWP4TyJgGCkaGBgQyhhwSeASw9CAYho2A3CZiE0xVg34FOPUgA+QrAEA1FYi+tWeG/cAAAAASUVORK5CYII=',
// eventacked inverted
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAAMElEQVQokWNgYGD4TyIeGRr+//+PXQOaBC4xVElkBdgMwHASTBEOxdj9gEcxHYIVAC5kqlZXl5JMAAAAAElFTkSuQmCC',
// eventalarm
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAAJ0lEQVQokWP4jwMwMDBgF8elGIZHNeDSANOEVRyXBpwGUcUGqvoBAK+H8xt0qXFWAAAAAElFTkSuQmCC',
// eventalarm inverted
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAAJ0lEQVQokWNgYGD4jw3///8fqzgDLsUwMKoBlwaSg5UAHoiIw2cDAFMz2iY65DAoAAAAAElFTkSuQmC',
// eventreturn
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAASUlEQVQokZ2RUQoAIAjFdv9L11dhskeUEIQ2mcYIAXjeisA+EahFA9ad/siAA0wqSUsnu87wDZh3VEodO6Rr1c51rc8fd9OoMQHLk7dXak3qLwAAAABJRU5ErkJggg==',
// eventreturn inverted
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAAR0lEQVQokZ2S2woAIAhD9/8/vV6tjgMNhLxMN1SSTGYb46JkfS2gJglQ/ncRAZ5JTCXQYsFRwxpAvFtKoeMvmoqDv1jc5DQONycV+bfOetgAAAAASUVORK5CYII=',
// info
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAAOUlEQVQokWNgYGD4///////E0AwMDP8hPDQAk8QhjlMCuzg2G3AB6tlAez8MglAiCZNiw/////8DACmmtFrq9aGNAAAAAElFTkSuQmCC',
// info inverted
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAAN0lEQVQokWP4////fwYGhv/E0FA2w390jCSJIc6ASwKnBmw24MLUs4H2fhgEoUQKIMkGBgaG/wDZFBj2pVi3HgAAAABJRU5ErkJggg==',
// system
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAAN0lEQVQokWNgYGD4TyJm+E8sgGugig3YxHFqwGcIQQ3obAwN6G7GawMuhVg1EFKMUwM+QJ+IAwDD1Gyi1EZc6gAAAABJRU5ErkJggg==',
// system inverted
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAAO0lEQVQokWP4TyJg+P///38GBgaiMFwDVWzAJo5TA15DCGnAYKNrwHAzPhtwKcSqgZBinBqIigeaRhwAPuZgrlZXy70AAAAASUVORK5CYII=',
// maintenance
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAAP0lEQVQokZWPQQoAMAzC8v9Pu8soDOxaBS82QkWNgPKTJ/BYsLekAOxfquwHWyfws6ED7OgtfNk9bAuTSGBJOufqnHIsmYkzAAAAAElFTkSuQmCC',
// maintenance inverted
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAAQUlEQVQokZWPQQ4AMAQE5/+f1kuTCkuROGAmADCVPsJsBfdCsX0u3N7sJFfXsAqW8BMaID+9gE3SJayEFo7CFwY7GtAw3ouVj50AAAAASUVORK5CYII=',
// blockl
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAAQElEQVQokZ2QQQ4AMAjC+v9Pu9MWl5AJ42a0IlKBgCIadgGgQ8imqo9D3zDBvJoyR+zwlWHS9SUHaOf4QOywtQCQGucn0g2dEQAAAABJRU5ErkJggg==',
// blockl inverted
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAAOklEQVQokWNgYGD4Tyz+////fwZSFBOtAaoQQsM46JLY+HAbUEwgrJmwyZTZQJYfSAolmsQDWTENwwByoOYaWbAqegAAAABJRU5ErkJggg==',
// blockr
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAAPElEQVQokWP4jwMwMDBgF8enAZsmvBqw2cSARQBDIQqbGEUoaggpQBcj3Qay/IAN4AwlfBrIigeiNeACADpU5yeYXn+XAAAAAElFTkSuQmCC',
// blockr inverted
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAAPElEQVQokWNgYGD4jw3///8fqzgDPg04NOG3AUMTugA2hWhqiFKEzCeoAF2MRBvI8gNJoUT1eCBaAy4MAMhm5hr5iTaWAAAAAElFTkSuQmCC'
]
}; };
...@@ -184,8 +143,9 @@ function PlowArray(ctx) { ...@@ -184,8 +143,9 @@ function PlowArray(ctx) {
} }
this.insertNode = function (elem, destination, code) { this.insertNode = function (elem, destination, code) {
var idx = this.find(elem); var idx = this.find(elem);
if (idx != -1) if (idx != -1) {
return; return;
}
if (destination == null) { if (destination == null) {
switch (code) { switch (code) {
...@@ -198,24 +158,25 @@ function PlowArray(ctx) { ...@@ -198,24 +158,25 @@ function PlowArray(ctx) {
elem.level = 0; elem.level = 0;
this.a.unshift(elem); this.a.unshift(elem);
} }
} } else {
else {
var dest_idx = this.find(destination); var dest_idx = this.find(destination);
if (dest_idx == -1) if (dest_idx == -1) {
return; return;
}
switch (code) { switch (code) {
case Plow.DEST_INTOFIRST: case Plow.DEST_INTOFIRST:
if (dest_idx == this.a.length - 1) if (dest_idx == this.a.length - 1) {
this.a.push(elem); this.a.push(elem);
else } else {
this.a.splice(dest_idx + 1, 0, elem); this.a.splice(dest_idx + 1, 0, elem);
}
elem.level = destination.level + 1; elem.level = destination.level + 1;
break; break;
case Plow.DEST_INTOLAST: { case Plow.DEST_INTOLAST: {
if (dest_idx == this.a.length - 1) if (dest_idx == this.a.length - 1) {
this.a.push(elem); this.a.push(elem);
else { } else {
idx = this.a.length; idx = this.a.length;
for (var i = dest_idx + 1; i < this.a.length; i++) { for (var i = dest_idx + 1; i < this.a.length; i++) {
if (this.a[i].level <= destination.level) { if (this.a[i].level <= destination.level) {
...@@ -223,31 +184,34 @@ function PlowArray(ctx) { ...@@ -223,31 +184,34 @@ function PlowArray(ctx) {
break; break;
} }
} }
if (idx == this.a.length) if (idx == this.a.length) {
this.a.push(elem); this.a.push(elem);
else } else {
this.a.splice(idx, 0, elem); this.a.splice(idx, 0, elem);
} }
}
elem.level = destination.level + 1; elem.level = destination.level + 1;
break; break;
} }
case Plow.DEST_AFTER: { case Plow.DEST_AFTER: {
if (dest_idx == this.a.length - 1) if (dest_idx == this.a.length - 1) {
this.a.push(elem); this.a.push(elem);
else { } else {
var i; var i;
for (i = idx; i < this.a.length; i++) { for (i = idx; i < this.a.length; i++) {
if (this.a[i].level < destination.level) if (this.a[i].level < destination.level) {
break; break;
} }
}
this.a.splice(i, 0, elem); this.a.splice(i, 0, elem);
} }
elem.level = destination.level; elem.level = destination.level;
break; break;
} }
case Plow.DEST_BEFORE: case Plow.DEST_BEFORE:
if (idx > 0) if (idx > 0) {
idx--; idx--;
}
this.a.splice(idx, 0, elem); this.a.splice(idx, 0, elem);
elem.level = destination.level; elem.level = destination.level;
break; break;
...@@ -257,8 +221,9 @@ function PlowArray(ctx) { ...@@ -257,8 +221,9 @@ function PlowArray(ctx) {
this.remove = function (elem) { this.remove = function (elem) {
var idx = this.find(elem); var idx = this.find(elem);
if (idx == -1) if (idx == -1) {
return; return;
}
this.ctx.event_cb(Plow.eEvent_ObjectDeleted, this.a[idx + 1], 0, 0); this.ctx.event_cb(Plow.eEvent_ObjectDeleted, this.a[idx + 1], 0, 0);
this.a.splice(idx, 1); this.a.splice(idx, 1);
} }
...@@ -270,13 +235,15 @@ function PlowArray(ctx) { ...@@ -270,13 +235,15 @@ function PlowArray(ctx) {
return this.a[idx]; return this.a[idx];
} }
this.draw = function (g, p, node, highlight) { this.draw = function (g, p, node, highlight) {
for (var i = 0; i < this.a.length; i++) for (var i = 0; i < this.a.length; i++) {
this.a[i].draw(g, p, node, highlight); this.a[i].draw(g, p, node, highlight);
} }
}
this.set_borders = function (node) { this.set_borders = function (node) {
for (var i = 0; i < this.a.length; i++) for (var i = 0; i < this.a.length; i++) {
this.a[i].set_borders(node); this.a[i].set_borders(node);
} }
}
this.configure = function () { this.configure = function () {
for (var i = 0; i < this.a.length; i++) { for (var i = 0; i < this.a.length; i++) {
this.a[i].pos.x = this.a[i].level * 1.0; this.a[i].pos.x = this.a[i].level * 1.0;
...@@ -285,47 +252,56 @@ function PlowArray(ctx) { ...@@ -285,47 +252,56 @@ function PlowArray(ctx) {
} }
this.close_node = function (node) { this.close_node = function (node) {
var idx = this.find(node); var idx = this.find(node);
if (idx == -1) if (idx == -1) {
return; return;
}
var level = node.level; var level = node.level;
var i; var i;
for (i = idx + 1; i < this.a.length; i++) { for (i = idx + 1; i < this.a.length; i++) {
if (this.a[i].level <= level) if (this.a[i].level <= level) {
break; break;
} }
}
var next_idx = i; var next_idx = i;
if (next_idx == idx + 1) if (next_idx == idx + 1) {
return; return;
}
for (i = idx + 1; i < next_idx; i++) { for (i = idx + 1; i < next_idx; i++) {
// Event backcall // Event backcall
if (ctx.select_object == this.a[idx + 1]) if (ctx.select_object == this.a[idx + 1]) {
ctx.select_object = null; ctx.select_object = null;
}
this.ctx.event_cb(Plow.eEvent_ObjectDeleted, this.a[idx + 1], 0, 0); this.ctx.event_cb(Plow.eEvent_ObjectDeleted, this.a[idx + 1], 0, 0);
this.a.splice(idx + 1, 1); this.a.splice(idx + 1, 1);
} }
} }
this.get_parent_object = function (node) { this.get_parent_object = function (node) {
var idx = this.find(node); var idx = this.find(node);
if (idx == -1) if (idx == -1) {
return null; return null;
}
for (var i = idx; i >= 0; i--) { for (var i = idx; i >= 0; i--) {
if (this.a[i].level < node.level) if (this.a[i].level < node.level) {
return this.a[i]; return this.a[i];
} }
}
return null; return null;
} }
this.get_first_child = function (node) { this.get_first_child = function (node) {
var idx = this.find(node); var idx = this.find(node);
if (idx == -1) if (idx == -1) {
return null; return null;
}
if (this.a.length == idx - 1) if (this.a.length == idx - 1) {
return null; return null;
}
if (this.a[idx + 1].level > node.level) if (this.a[idx + 1].level > node.level) {
return this.a[idx + 1]; return this.a[idx + 1];
}
return null; return null;
} }
...@@ -337,20 +313,23 @@ function PlowArray(ctx) { ...@@ -337,20 +313,23 @@ function PlowArray(ctx) {
continue; continue;
} }
if (found) { if (found) {
if (this.a[i].level == node.level) if (this.a[i].level == node.level) {
return this.a[i]; return this.a[i];
if (this.a[i].level < node.level) }
if (this.a[i].level < node.level) {
return null; return null;
} }
} }
}
return null; return null;
} }
this.get_next_object = function (node) { this.get_next_object = function (node) {
for (var i = 0; i < this.a.length; i++) { for (var i = 0; i < this.a.length; i++) {
if (this.a[i] == node) { if (this.a[i] == node) {
if (i == this.a.length - 1) if (i == this.a.length - 1) {
return null; return null;
}
return this.a[i + 1]; return this.a[i + 1];
} }
} }
...@@ -359,29 +338,33 @@ function PlowArray(ctx) { ...@@ -359,29 +338,33 @@ function PlowArray(ctx) {
this.get_previous_object = function (node) { this.get_previous_object = function (node) {
for (var i = 0; i < this.a.length; i++) { for (var i = 0; i < this.a.length; i++) {
if (this.a[i] == node) { if (this.a[i] == node) {
if (i == 0) if (i == 0) {
return null; return null;
}
return this.a[i - 1]; return this.a[i - 1];
} }
} }
return null; return null;
} }
this.get_first_object = function () { this.get_first_object = function () {
if (this.a.length == 0) if (this.a.length == 0) {
return null; return null;
}
return this.a[0]; return this.a[0];
} }
this.get_last_object = function () { this.get_last_object = function () {
if (this.a.length == 0) if (this.a.length == 0) {
return null; return null;
}
return this.a[this.a.length - 1]; return this.a[this.a.length - 1];
} }
this.find = function (elem) { this.find = function (elem) {
for (var i = 0; i < this.a.length; i++) { for (var i = 0; i < this.a.length; i++) {
if (this.a[i] == elem) if (this.a[i] == elem) {
return i; return i;
} }
}
return -1; return -1;
} }
} }
...@@ -415,13 +398,15 @@ function PlowNode(ctx, nc, level) { ...@@ -415,13 +398,15 @@ function PlowNode(ctx, nc, level) {
this.relative_position = 0; this.relative_position = 0;
this.set_annotation = function (number, text) { this.set_annotation = function (number, text) {
if (number >= 10) if (number >= 10) {
return; return;
}
this.annotv[number] = text; this.annotv[number] = text;
} }
this.set_annotation_pixmap = function (number, pixmap) { this.set_annotation_pixmap = function (number, pixmap) {
if (number >= 10) if (number >= 10) {
return; return;
}
this.pixmapv[number] = pixmap; this.pixmapv[number] = pixmap;
} }
this.draw_object = function () { this.draw_object = function () {
...@@ -433,39 +418,45 @@ function PlowNode(ctx, nc, level) { ...@@ -433,39 +418,45 @@ function PlowNode(ctx, nc, level) {
var width = (this.x_right - this.x_left) * this.ctx.zoom_factor; var width = (this.x_right - this.x_left) * this.ctx.zoom_factor;
var height = (this.y_high - this.y_low) * this.ctx.zoom_factor + 2; var height = (this.y_high - this.y_low) * this.ctx.zoom_factor + 2;
g.fillStyle = "white"; g.fillStyle = "white";
if (this.select) if (this.select) {
g.fillStyle = "lightblue"; g.fillStyle = "lightblue";
}
g.fillRect(x, y, width, height); g.fillRect(x, y, width, height);
this.nc.draw(g, this.pos, this, this.highlight); this.nc.draw(g, this.pos, this, this.highlight);
} }
this.connect = function () { this.connect = function () {
if (this.trace_object == "" || this.trace_attribute == "") if (this.trace_object == "" || this.trace_attribute == "") {
return; return;
}
var n = this.trace_attribute.indexOf('#'); var n = this.trace_attribute.indexOf('#');
if (n != -1) if (n != -1) {
this.trace_attribute = this.trace_attribute.substring(0, n); this.trace_attribute = this.trace_attribute.substring(0, n);
}
var o = this.trace_object + "." + this.trace_attribute; var o = this.trace_object + "." + this.trace_attribute;
this.p = ctx.gdh.refObjectInfo(o, this.trace_attr_type); this.p = ctx.gdh.refObjectInfo(o, this.trace_attr_type);
console.log("connecting", o, this.p); console.log("connecting", o, this.p);
} }
this.scan = function () { this.scan = function () {
if (this.p == 0) if (this.p == 0) {
return; return;
}
var v1 = ctx.gdh.getRefObjectInfo(this.p); var v1 = ctx.gdh.getRefObjectInfo(this.p);
var evaluate = true; var evaluate = true;
if (this.first_scan) if (this.first_scan) {
this.first_scan = false; this.first_scan = false;
else if (v1 == this.old_value) } else if (v1 == this.old_value) {
return; return;
}
if (v1) if (v1) {
this.highlight = true; this.highlight = true;
else } else {
this.highlight = false; this.highlight = false;
}
this.old_value = v1; this.old_value = v1;
this.draw_object(); this.draw_object();
...@@ -494,15 +485,16 @@ function PlowNode(ctx, nc, level) { ...@@ -494,15 +485,16 @@ function PlowNode(ctx, nc, level) {
if (select) { if (select) {
this.select = true; this.select = true;
this.ctx.select_object = this; this.ctx.select_object = this;
} } else {
else {
this.select = false; this.select = false;
if (this.ctx.select_object == this) if (this.ctx.select_object == this) {
this.ctx.select_object = null; this.ctx.select_object = null;
} }
if (select != this.select) }
if (select != this.select) {
this.draw_object(); this.draw_object();
} }
}
this.set_invert = function (invert) { this.set_invert = function (invert) {
this.invert = invert; this.invert = invert;
this.draw_object(); this.draw_object();
...@@ -515,8 +507,9 @@ function PlowNode(ctx, nc, level) { ...@@ -515,8 +507,9 @@ function PlowNode(ctx, nc, level) {
} }
this.in_icon = function (x, y) { this.in_icon = function (x, y) {
if (x >= this.x_left * this.ctx.zoom_factor && if (x >= this.x_left * this.ctx.zoom_factor &&
x <= (this.x_left + 1.75) * this.ctx.zoom_factor) x <= (this.x_left + 1.75) * this.ctx.zoom_factor) {
return true; return true;
}
return false; return false;
} }
this.measure = function () { this.measure = function () {
...@@ -547,14 +540,19 @@ function PlowAnnot(ctx, x, y, text_size, text_color, annot_type, number) { ...@@ -547,14 +540,19 @@ function PlowAnnot(ctx, x, y, text_size, text_color, annot_type, number) {
this.ctx = ctx; this.ctx = ctx;
this.draw = function (g, p0, node, highlight) { this.draw = function (g, p0, node, highlight) {
if (node == null) if (node == null) {
return; return;
if (node.annotv[this.number] == null) }
if (node.annotv[this.number] == null) {
return; return;
}
var tsize = 0; var tsize = 0;
var idx = this.ctx.zoom_factor / this.ctx.base_zoom_factor * (this.text_size + 4) - 4; var idx = this.ctx.zoom_factor / this.ctx.base_zoom_factor *
if (idx < 0) return; (this.text_size + 4) - 4;
if (idx < 0) {
return;
}
switch (idx) { switch (idx) {
case 0: case 0:
...@@ -587,30 +585,37 @@ function PlowAnnot(ctx, x, y, text_size, text_color, annot_type, number) { ...@@ -587,30 +585,37 @@ function PlowAnnot(ctx, x, y, text_size, text_color, annot_type, number) {
g.font = tsize + "px Arial"; g.font = tsize + "px Arial";
if (node.invert) if (node.invert) {
g.fillStyle = "white"; g.fillStyle = "white";
else } else {
g.fillStyle = "black"; g.fillStyle = "black";
if (highlight) }
if (highlight) {
g.fillStyle = "red"; g.fillStyle = "red";
}
g.lineWidth = 0.5; g.lineWidth = 0.5;
var x = (this.p.x + p0.x) * this.ctx.zoom_factor; var x = (this.p.x + p0.x) * this.ctx.zoom_factor;
var y = (this.p.y + p0.y) * this.ctx.zoom_factor - tsize / 4; var y = (this.p.y + p0.y) * this.ctx.zoom_factor - tsize / 4;
if ((this.annot_type & Plow.RELATIVE_POSITION) != 0) { if ((this.annot_type & Plow.RELATIVE_POSITION) != 0) {
var rel_x = (p0.x + node.relative_position + this.RELATIVE_OFFSET) * this.ctx.zoom_factor; var rel_x = (p0.x + node.relative_position + this.RELATIVE_OFFSET) *
if (x < rel_x) this.ctx.zoom_factor;
if (x < rel_x) {
x = rel_x; x = rel_x;
} }
}
var tokens = node.annotv[this.number].split('\n'); var tokens = node.annotv[this.number].split('\n');
for (var i = 0; i < tokens.length; i++) { for (var i = 0; i < tokens.length; i++) {
g.fillText(tokens[i], x, y); g.fillText(tokens[i], x, y);
y += tsize * 1.4; y += tsize * 1.4;
} }
if ((this.annot_type & Plow.NEXT_RELATIVE_POSITION) != 0 || (this.annot_type & Plow.RELATIVE_POSITION) != 0) { if ((this.annot_type & Plow.NEXT_RELATIVE_POSITION) != 0 ||
node.relative_position = (x + g.measureText(node.annotv[this.number]).width) / this.ctx.zoom_factor - p0.x; (this.annot_type & Plow.RELATIVE_POSITION) != 0) {
node.relative_position =
(x + g.measureText(node.annotv[this.number]).width) /
this.ctx.zoom_factor - p0.x;
} }
} }
this.set_borders = function (node) { this.set_borders = function (node) {
...@@ -628,10 +633,12 @@ function PlowAnnotPixmap(ctx, x, y, number) { ...@@ -628,10 +633,12 @@ function PlowAnnotPixmap(ctx, x, y, number) {
var img; var img;
var bix = node.pixmapv[this.number]; var bix = node.pixmapv[this.number];
if (typeof bix === 'undefined' || bix === null) if (typeof bix === 'undefined' || bix === null) {
return; return;
if (node.invert) }
if (node.invert) {
bix++; bix++;
}
img = Bitmaps.img[bix]; img = Bitmaps.img[bix];
if (img == null) { if (img == null) {
...@@ -642,24 +649,27 @@ function PlowAnnotPixmap(ctx, x, y, number) { ...@@ -642,24 +649,27 @@ function PlowAnnotPixmap(ctx, x, y, number) {
Bitmaps.pending[bix].push(new PlowPoint(this.ctx, x, y)); Bitmaps.pending[bix].push(new PlowPoint(this.ctx, x, y));
img.onload = function () { img.onload = function () {
for (var i = 0; i < Bitmaps.pending[bix].length; i++) for (var i = 0; i < Bitmaps.pending[bix].length; i++) {
gctx.drawImage(img, Bitmaps.pending[bix][i].x, Bitmaps.pending[bix][i].y); gctx.drawImage(img, Bitmaps.pending[bix][i].x,
Bitmaps.pending[bix] = null; Bitmaps.pending[bix][i].y);
} }
Bitmaps.pending[bix] = null;
} }
else { } else {
if (!img.complete) if (!img.complete) {
Bitmaps.pending[bix].push(new PlowPoint(this.ctx, x, y)); Bitmaps.pending[bix].push(new PlowPoint(this.ctx, x, y));
else } else {
gctx.drawImage(img, x, y); gctx.drawImage(img, x, y);
} }
}
} }
this.set_borders = function (node) { this.set_borders = function (node) {
} }
} }
function PlowRect(ctx, x, y, width, height, fill_color, border_color, fill, fix_color) { function PlowRect(ctx, x, y, width, height, fill_color, border_color, fill,
fix_color) {
this.ll = new PlowPoint(ctx, x, y); this.ll = new PlowPoint(ctx, x, y);
this.ur = new PlowPoint(ctx, x + width, y + height); this.ur = new PlowPoint(ctx, x + width, y + height);
this.border_color = border_color; this.border_color = border_color;
...@@ -689,8 +699,9 @@ function PlowRect(ctx, x, y, width, height, fill_color, border_color, fill, fix_ ...@@ -689,8 +699,9 @@ function PlowRect(ctx, x, y, width, height, fill_color, border_color, fill, fix_
default: default:
g.strokeStyle = "black"; g.strokeStyle = "black";
} }
if (highlight) if (highlight) {
g.strokeStyle = "red"; g.strokeStyle = "red";
}
g.strokeRect(x, y, width, height); g.strokeRect(x, y, width, height);
if (this.fill) { if (this.fill) {
...@@ -708,30 +719,36 @@ function PlowRect(ctx, x, y, width, height, fill_color, border_color, fill, fix_ ...@@ -708,30 +719,36 @@ function PlowRect(ctx, x, y, width, height, fill_color, border_color, fill, fix_
g.fillStyle = "lightgreen"; g.fillStyle = "lightgreen";
break; break;
case Plow.COLOR_WHITE: case Plow.COLOR_WHITE:
if (node.invert) if (node.invert) {
g.fillStyle = "black"; g.fillStyle = "black";
else } else {
g.fillStyle = "white"; g.fillStyle = "white";
}
break; break;
default: default:
if (node.invert) if (node.invert) {
g.fillStyle = "white"; g.fillStyle = "white";
else } else {
g.fillStyle = "black"; g.fillStyle = "black";
} }
}
g.fillRect(x, y, width, height); g.fillRect(x, y, width, height);
} }
} }
this.set_borders = function (node) { this.set_borders = function (node) {
if (this.ll.x + node.pos.x < node.x_left) if (this.ll.x + node.pos.x < node.x_left) {
node.x_left = this.ll.x + node.pos.x; node.x_left = this.ll.x + node.pos.x;
if (this.ur.x + node.pos.x > node.x_right) }
if (this.ur.x + node.pos.x > node.x_right) {
node.x_right = this.ur.x + node.pos.x; node.x_right = this.ur.x + node.pos.x;
if (this.ll.y + node.pos.y < node.y_low) }
if (this.ll.y + node.pos.y < node.y_low) {
node.y_low = this.ll.y + node.pos.y; node.y_low = this.ll.y + node.pos.y;
if (this.ur.y + node.pos.y > node.y_high) }
if (this.ur.y + node.pos.y > node.y_high) {
node.y_high = this.ur.y + node.pos.y; node.y_high = this.ur.y + node.pos.y;
} }
}
} }
function GDraw(ctx) { function GDraw(ctx) {
...@@ -762,21 +779,25 @@ function PlowCtx() { ...@@ -762,21 +779,25 @@ function PlowCtx() {
this.event_object = null; this.event_object = null;
this.draw = function () { this.draw = function () {
if (this.nodraw > 0) if (this.nodraw > 0) {
return; return;
}
this.gdraw.gctx.fillStyle = "white"; this.gdraw.gctx.fillStyle = "white";
this.gdraw.gctx.fillRect(0, 0, this.gdraw.canvas.width, this.gdraw.canvas.height); this.gdraw.gctx.fillRect(0, 0, this.gdraw.canvas.width,
this.gdraw.canvas.height);
this.a.draw(this.gdraw.gctx, null, null, false); this.a.draw(this.gdraw.gctx, null, null, false);
}; };
this.connect = function () { this.connect = function () {
for (var i = 0; i < this.a.size(); i++) for (var i = 0; i < this.a.size(); i++) {
this.a.get(i).connect(); this.a.get(i).connect();
}
}; };
this.scan = function () { this.scan = function () {
console.log("ctx scan", this.a.size()); console.log("ctx scan", this.a.size());
for (var i = 0; i < this.a.size(); i++) for (var i = 0; i < this.a.size(); i++) {
this.a.get(i).scan(); this.a.get(i).scan();
}
}; };
this.set_nodraw = function () { this.set_nodraw = function () {
this.nodraw++; this.nodraw++;
...@@ -795,10 +816,11 @@ function PlowCtx() { ...@@ -795,10 +816,11 @@ function PlowCtx() {
for (var i = 0; i < this.a.size(); i++) { for (var i = 0; i < this.a.size(); i++) {
if (this.a.get(i) instanceof PlowNode) { if (this.a.get(i) instanceof PlowNode) {
sts = this.a.get(i).event_handler(event, x, y); sts = this.a.get(i).event_handler(event, x, y);
if (sts == 1) if (sts == 1) {
break; break;
} }
} }
}
if (sts == 1) { if (sts == 1) {
this.event_cb(event, this.event_object, x, y); this.event_cb(event, this.event_object, x, y);
this.draw(); this.draw();
...@@ -819,15 +841,17 @@ function PlowCtx() { ...@@ -819,15 +841,17 @@ function PlowCtx() {
this.set_select = function (select) { this.set_select = function (select) {
for (var i = 0; i < this.a.size(); i++) { for (var i = 0; i < this.a.size(); i++) {
if (this.a.get(i) instanceof PlowNode) if (this.a.get(i) instanceof PlowNode) {
this.a.get(i).set_select(select); this.a.get(i).set_select(select);
} }
}
}; };
this.set_invert = function (invert) { this.set_invert = function (invert) {
for (var i = 0; i < this.a.size(); i++) { for (var i = 0; i < this.a.size(); i++) {
if (this.a.get(i) instanceof PlowNode) if (this.a.get(i) instanceof PlowNode) {
this.a.get(i).set_invert(invert); this.a.get(i).set_invert(invert);
} }
}
}; };
this.get_select = function () { this.get_select = function () {
...@@ -840,8 +864,9 @@ function PlowCtx() { ...@@ -840,8 +864,9 @@ function PlowCtx() {
this.a.insertNode(n, destination, destCode); this.a.insertNode(n, destination, destCode);
}; };
this.remove = function (n) { this.remove = function (n) {
if (this.select_object == n) if (this.select_object == n) {
this.select_object = null; this.select_object = null;
}
this.a.remove(n); this.a.remove(n);
}; };
this.insert_nc = function (nc) { this.insert_nc = function (nc) {
...@@ -873,12 +898,16 @@ function PlowCtx() { ...@@ -873,12 +898,16 @@ function PlowCtx() {
this.a.close_node(o); this.a.close_node(o);
}; };
this.is_visible = function (o) { this.is_visible = function (o) {
if ((o.y_high * this.zoom_factor <= window.pageYOffset + window.innerHeight - this.gdraw.offset_top) && if ((o.y_high * this.zoom_factor <= window.pageYOffset +
(o.y_low * this.zoom_factor >= window.pageYOffset - this.gdraw.offset_top)) window.innerHeight - this.gdraw.offset_top) &&
(o.y_low * this.zoom_factor >= window.pageYOffset -
this.gdraw.offset_top)) {
return true; return true;
}
return false; return false;
}; };
this.scroll = function (y, factor) { this.scroll = function (y, factor) {
window.scrollTo(window.scrollX, y * this.zoom_factor - window.innerHeight * factor + this.gdraw.offset_top) window.scrollTo(window.scrollX, y * this.zoom_factor - window.innerHeight *
factor + this.gdraw.offset_top)
}; };
} }
\ No newline at end of file
...@@ -98,36 +98,11 @@ var Pwr = { ...@@ -98,36 +98,11 @@ var Pwr = {
mAccess_RtEventsAck: 1 << 18, mAccess_RtEventsAck: 1 << 18,
mAccess_RtPlc: 1 << 19, mAccess_RtPlc: 1 << 19,
mAccess_RtNavigator: 1 << 20, mAccess_RtNavigator: 1 << 20,
mAccess_AllRt: 1 << 2 | mAccess_AllRt: 1 << 2 | 1 << 3 | 1 << 4 | 1 << 5 | 1 << 0 | 1 << 1 | 1 << 25 |
1 << 3 | 1 << 18 | 1 << 19 | 1 << 20 | 1 << 6 | 1 << 7 | 1 << 8 | 1 << 9 | 1 << 10 |
1 << 4 | 1 << 11 | 1 << 12 | 1 << 13 | 1 << 14 | 1 << 15,
1 << 5 | mAccess_AllOperators: 1 << 6 | 1 << 7 | 1 << 8 | 1 << 9 | 1 << 10 | 1 << 11 |
1 << 0 | 1 << 12 | 1 << 13 | 1 << 14 | 1 << 15,
1 << 1 |
1 << 25 |
1 << 18 |
1 << 19 |
1 << 20 |
1 << 6 |
1 << 7 |
1 << 8 |
1 << 9 |
1 << 10 |
1 << 11 |
1 << 12 |
1 << 13 |
1 << 14 |
1 << 15,
mAccess_AllOperators: 1 << 6 |
1 << 7 |
1 << 8 |
1 << 9 |
1 << 10 |
1 << 11 |
1 << 12 |
1 << 13 |
1 << 14 |
1 << 15,
mAccess_AllPwr: ~0, mAccess_AllPwr: ~0,
mAdef_pointer: 1, mAdef_pointer: 1,
......
...@@ -50,16 +50,13 @@ function MhEvent() { ...@@ -50,16 +50,13 @@ function MhEvent() {
this.syncIdx; this.syncIdx;
} }
/** Start Ev **/
function EvOpenChildrenData(node, open_next) { function EvOpenChildrenData(node, open_next) {
this.node = node; this.node = node;
this.open_next = open_next; this.open_next = open_next;
} }
var EvC = { var EvC = {
eType_AlarmList: 0, eType_AlarmList: 0, eType_EventList: 1, eType_BlockList: 2
eType_EventList: 1,
eType_BlockList: 2
}; };
...@@ -105,89 +102,100 @@ function Ev() { ...@@ -105,89 +102,100 @@ function Ev() {
this.ctx.gdraw.canvas.addEventListener("click", function (event) { this.ctx.gdraw.canvas.addEventListener("click", function (event) {
var y = event.pageY - self.ctx.gdraw.offset_top; var y = event.pageY - self.ctx.gdraw.offset_top;
var x = event.pageX; var x = event.pageX;
if (event.shiftKey) if (event.shiftKey) {
ev.ctx.event_handler(Plow.eEvent_MB1ClickShift, x, y); ev.ctx.event_handler(Plow.eEvent_MB1ClickShift, x, y);
else } else {
ev.ctx.event_handler(Plow.eEvent_MB1Click, x, y); ev.ctx.event_handler(Plow.eEvent_MB1Click, x, y);
}
}); });
document.addEventListener("keydown", function (event) { document.addEventListener("keydown", function (event) {
if (event.keyCode == 40) { if (event.keyCode == 40) {
self.ctx.event_handler(Plow.eEvent_Key_Down); self.ctx.event_handler(Plow.eEvent_Key_Down);
event.preventDefault(); event.preventDefault();
} } else if (event.keyCode == 39) {
else if (event.keyCode == 39) { if (event.shiftKey) {
if (event.shiftKey)
self.ctx.event_handler(Plow.eEvent_Key_ShiftRight); self.ctx.event_handler(Plow.eEvent_Key_ShiftRight);
else } else {
self.ctx.event_handler(Plow.eEvent_Key_Right); self.ctx.event_handler(Plow.eEvent_Key_Right);
event.preventDefault();
} }
else if (event.keyCode == 37) { event.preventDefault();
} else if (event.keyCode == 37) {
self.ctx.event_handler(Plow.eEvent_Key_Left); self.ctx.event_handler(Plow.eEvent_Key_Left);
event.preventDefault(); event.preventDefault();
} } else if (event.keyCode == 38) {
else if (event.keyCode == 38) {
self.ctx.event_handler(Plow.eEvent_Key_Up); self.ctx.event_handler(Plow.eEvent_Key_Up);
event.preventDefault(); event.preventDefault();
} } else if (event.keyCode == 82) {
else if (event.keyCode == 82) { if (event.ctrlKey) {
if (event.ctrlKey)
self.ctx.event_handler(Plow.eEvent_Key_CtrlR); self.ctx.event_handler(Plow.eEvent_Key_CtrlR);
event.preventDefault();
} }
else if (event.keyCode == 76) {
if (event.ctrlKey)
self.ctx.event_handler(Plow.eEvent_Key_CtrlL);
event.preventDefault(); event.preventDefault();
} else if (event.keyCode == 76) {
if (event.ctrlKey) {
self.ctx.event_handler(Plow.eEvent_Key_CtrlL);
} }
else if (event.keyCode == 71) { event.preventDefault();
if (event.ctrlKey) } else if (event.keyCode == 71) {
if (event.ctrlKey) {
self.ctx.event_handler(Plow.eEvent_Key_CtrlG); self.ctx.event_handler(Plow.eEvent_Key_CtrlG);
}
event.preventDefault(); event.preventDefault();
} }
}); });
// Ack // Ack
document.getElementById("toolitem1").addEventListener("click", function (event) { document.getElementById("toolitem1")
.addEventListener("click", function (event) {
console.log("Ack"); console.log("Ack");
self.ack(); self.ack();
}); });
// Navigator sup object // Navigator sup object
document.getElementById("toolitem2").addEventListener("click", function (event) { document.getElementById("toolitem2")
.addEventListener("click", function (event) {
var o = self.ctx.get_select(); var o = self.ctx.get_select();
if (o === null || typeof o === 'undefined') if (o === null || typeof o === 'undefined') {
return; return;
}
console.log("toolitem2", o.userdata.e.supObject.vid, console.log("toolitem2", o.userdata.e.supObject.vid,
o.userdata.e.supObject.oix); o.userdata.e.supObject.oix);
self.ctx.gdh.getObjectFromAref(o.userdata.e.supObject, GdhOp.GET_OP_SELF, self.open_navigator_cb, null); self.ctx.gdh.getObjectFromAref(o.userdata.e.supObject,
GdhOp.GET_OP_SELF, self.open_navigator_cb, null);
console.log("toolitem2 event"); console.log("toolitem2 event");
}); });
// Trace sup object // Trace sup object
document.getElementById("toolitem3").addEventListener("click", function (event) { document.getElementById("toolitem3")
.addEventListener("click", function (event) {
console.log("toolitem5 event"); console.log("toolitem5 event");
var o = self.ctx.get_select(); var o = self.ctx.get_select();
if (o === null) if (o === null) {
return; return;
}
var newwindow = window.open("", "_blank"); var newwindow = window.open("", "_blank");
self.ctx.gdh.getObjectFromAref(o.userdata.e.supObject, GdhOp.GET_OP_METHOD_PLC, self.open_plc_cb, newwindow); self.ctx.gdh.getObjectFromAref(o.userdata.e.supObject,
GdhOp.GET_OP_METHOD_PLC, self.open_plc_cb, newwindow);
}); });
// Graph event name // Graph event name
document.getElementById("toolitem4").addEventListener("click", function (event) { document.getElementById("toolitem4")
.addEventListener("click", function (event) {
var o = self.ctx.get_select(); var o = self.ctx.get_select();
if (o.userdata instanceof EvItemAlarm) { if (o.userdata instanceof EvItemAlarm) {
var newwindow = window.open("", "_blank"); var newwindow = window.open("", "_blank");
self.ctx.gdh.getObjectFromName(o.userdata.e.eventName, GdhOp.GET_OP_METHOD_GRAPH, self.open_graph_cb, newwindow); self.ctx.gdh.getObjectFromName(o.userdata.e.eventName,
GdhOp.GET_OP_METHOD_GRAPH, self.open_graph_cb, newwindow);
} }
}); });
// Object raph event name // Object raph event name
document.getElementById("toolitem5").addEventListener("click", function (event) { document.getElementById("toolitem5")
.addEventListener("click", function (event) {
var o = self.ctx.get_select(); var o = self.ctx.get_select();
if (o.userdata instanceof EvItemAlarm) { if (o.userdata instanceof EvItemAlarm) {
var newwindow = window.open("", "_blank"); var newwindow = window.open("", "_blank");
self.ctx.gdh.getObjectFromName(o.userdata.e.eventName, GdhOp.GET_OP_METHOD_OBJECTGRAPH, self.open_graph_cb, newwindow); self.ctx.gdh.getObjectFromName(o.userdata.e.eventName,
GdhOp.GET_OP_METHOD_OBJECTGRAPH, self.open_graph_cb, newwindow);
} }
}); });
// Navigator event name // Navigator event name
document.getElementById("toolitem6").addEventListener("click", function (event) { document.getElementById("toolitem6")
.addEventListener("click", function (event) {
var o = self.ctx.get_select(); var o = self.ctx.get_select();
console.log("storage", localStorage.getItem("XttMethodNavigator")); console.log("storage", localStorage.getItem("XttMethodNavigator"));
localStorage.setItem("XttMethodNavigator", o.userdata.e.eventName); localStorage.setItem("XttMethodNavigator", o.userdata.e.eventName);
...@@ -196,48 +204,60 @@ function Ev() { ...@@ -196,48 +204,60 @@ function Ev() {
window.opener.focus(); window.opener.focus();
}); });
// Trace event name // Trace event name
document.getElementById("toolitem7").addEventListener("click", function (event) { document.getElementById("toolitem7")
.addEventListener("click", function (event) {
var o = self.ctx.get_select(); var o = self.ctx.get_select();
if (o === null) if (o === null) {
return; return;
}
var newwindow = window.open("", "_blank"); var newwindow = window.open("", "_blank");
self.ctx.gdh.getObjectFromName(o.userdata.e.eventName, GdhOp.GET_OP_METHOD_PLC, self.open_plc_cb, newwindow); self.ctx.gdh.getObjectFromName(o.userdata.e.eventName,
GdhOp.GET_OP_METHOD_PLC, self.open_plc_cb, newwindow);
console.log("toolitem7 event"); console.log("toolitem7 event");
}); });
// History event name // History event name
document.getElementById("toolitem8").addEventListener("click", function (event) { document.getElementById("toolitem8")
.addEventListener("click", function (event) {
console.log("toolitem8 event"); console.log("toolitem8 event");
}); });
// Object event name // Object event name
document.getElementById("toolitem9").addEventListener("click", function (event) { document.getElementById("toolitem9")
.addEventListener("click", function (event) {
console.log("toolitem9 event"); console.log("toolitem9 event");
var o = self.ctx.get_select(); var o = self.ctx.get_select();
if (o === null) if (o === null) {
return; return;
}
var item = o.userdata; var item = o.userdata;
item.open_attributes(self); item.open_attributes(self);
}); });
// Crossref event name // Crossref event name
document.getElementById("toolitem10").addEventListener("click", function (event) { document.getElementById("toolitem10")
.addEventListener("click", function (event) {
var o = self.ctx.get_select(); var o = self.ctx.get_select();
if (o === null) if (o === null) {
return; return;
}
self.ctx.gdh.crrSignal(o.userdata.e.eventName, self.open_crr_cb, o); self.ctx.gdh.crrSignal(o.userdata.e.eventName, self.open_crr_cb, o);
console.log("toolitem10 event"); console.log("toolitem10 event");
}); });
// Help event name // Help event name
document.getElementById("toolitem11").addEventListener("click", function (event) { document.getElementById("toolitem11")
.addEventListener("click", function (event) {
console.log("toolitem11 event"); console.log("toolitem11 event");
}); });
// Class help event name // Class help event name
document.getElementById("toolitem12").addEventListener("click", function (event) { document.getElementById("toolitem12")
.addEventListener("click", function (event) {
console.log("toolitem12 event"); console.log("toolitem12 event");
var o = self.ctx.get_select(); var o = self.ctx.get_select();
if (o == null) if (o == null) {
return; return;
}
if (o.userdata instanceof EvItemAlarm) { if (o.userdata instanceof EvItemAlarm) {
var newwindow = window.open("", "_blank"); var newwindow = window.open("", "_blank");
self.ctx.gdh.getObjectFromName(o.userdata.e.eventName, GdhOp.GET_OP_METHOD_HELPCLASS, self.open_helpclass_cb, newwindow); self.ctx.gdh.getObjectFromName(o.userdata.e.eventName,
GdhOp.GET_OP_METHOD_HELPCLASS, self.open_helpclass_cb, newwindow);
} }
}); });
...@@ -248,8 +268,9 @@ function Ev() { ...@@ -248,8 +268,9 @@ function Ev() {
} }
this.gdh_init_cb = function () { this.gdh_init_cb = function () {
if (self.priv == null) if (self.priv == null) {
self.ctx.gdh.login("", "", self.login_cb, self); self.ctx.gdh.login("", "", self.login_cb, self);
}
//self.ctx.gdh.mhSync( self.mhSyncIdx, self.sync_cb, self); //self.ctx.gdh.mhSync( self.mhSyncIdx, self.sync_cb, self);
...@@ -259,18 +280,21 @@ function Ev() { ...@@ -259,18 +280,21 @@ function Ev() {
this.login_cb = function (id, data, sts, result) { this.login_cb = function (id, data, sts, result) {
console.log("Login:", sts, result); console.log("Login:", sts, result);
if (sts & 1) if (sts & 1) {
self.priv = result; self.priv = result;
else } else {
self.priv = 0; self.priv = 0;
}
}; };
this.sync_cb = function (id, data, sts, result) { this.sync_cb = function (id, data, sts, result) {
if (!(sts & 1)) if (!(sts & 1)) {
return; return;
}
if (result.length === 0) if (result.length === 0) {
return; return;
}
if (self.type == EvC.eType_AlarmList) { if (self.type == EvC.eType_AlarmList) {
...@@ -300,10 +324,10 @@ function Ev() { ...@@ -300,10 +324,10 @@ function Ev() {
if (item.e.eventStatus & MhC.mEventStatus_NotRet) { if (item.e.eventStatus & MhC.mEventStatus_NotRet) {
item.e.eventStatus &= ~MhC.mEventStatus_NotAck; item.e.eventStatus &= ~MhC.mEventStatus_NotAck;
item.update(); item.update();
} } else {
else
self.ctx.remove(item.node); self.ctx.remove(item.node);
} }
}
break; break;
case MhC.eEvent_Return: case MhC.eEvent_Return:
var item = self.find_event(e.targetId); var item = self.find_event(e.targetId);
...@@ -311,20 +335,20 @@ function Ev() { ...@@ -311,20 +335,20 @@ function Ev() {
if (item.e.eventStatus & MhC.mEventStatus_NotAck) { if (item.e.eventStatus & MhC.mEventStatus_NotAck) {
item.e.eventStatus &= ~MhC.mEventStatus_NotRet; item.e.eventStatus &= ~MhC.mEventStatus_NotRet;
item.update(); item.update();
} } else {
else
self.ctx.remove(item.node); self.ctx.remove(item.node);
} }
}
break; break;
} }
if (self.mhSyncIdx < result[i].syncIdx) if (self.mhSyncIdx < result[i].syncIdx) {
self.mhSyncIdx = result[i].syncIdx; self.mhSyncIdx = result[i].syncIdx;
} }
}
self.ctx.configure(); self.ctx.configure();
self.ctx.reset_nodraw(); self.ctx.reset_nodraw();
self.ctx.draw(); self.ctx.draw();
} } else if (self.type == EvC.eType_EventList) {
else if (self.type == EvC.eType_EventList) {
self.ctx.set_nodraw(); self.ctx.set_nodraw();
for (var i = result.length - 1; i >= 0; i--) { for (var i = result.length - 1; i >= 0; i--) {
var e = result[i]; var e = result[i];
...@@ -334,9 +358,10 @@ function Ev() { ...@@ -334,9 +358,10 @@ function Ev() {
} }
new EvItemAlarm(self, e, null, Plow.DEST_BEFORE); new EvItemAlarm(self, e, null, Plow.DEST_BEFORE);
if (self.mhSyncIdx < result[i].syncIdx) if (self.mhSyncIdx < result[i].syncIdx) {
self.mhSyncIdx = result[i].syncIdx; self.mhSyncIdx = result[i].syncIdx;
} }
}
self.ctx.configure(); self.ctx.configure();
self.ctx.reset_nodraw(); self.ctx.reset_nodraw();
self.ctx.draw(); self.ctx.draw();
...@@ -344,14 +369,14 @@ function Ev() { ...@@ -344,14 +369,14 @@ function Ev() {
}; };
this.find_event = function (event_id) { this.find_event = function (event_id) {
for (var o = this.ctx.get_first_object(); for (var o = this.ctx.get_first_object(); o !== null;
o !== null;
o = this.ctx.get_next_object(o)) { o = this.ctx.get_next_object(o)) {
var item = o.get_userdata(); var item = o.get_userdata();
if (item.e.eventId.nix == event_id.nix && if (item.e.eventId.nix == event_id.nix &&
item.e.eventId.idx == event_id.idx) item.e.eventId.idx == event_id.idx) {
return item; return item;
} }
}
return null; return null;
} }
...@@ -367,8 +392,9 @@ function Ev() { ...@@ -367,8 +392,9 @@ function Ev() {
// Ack last // Ack last
var node = this.ctx.get_first_object(); var node = this.ctx.get_first_object();
if (node === null) if (node === null) {
return; return;
}
var item = node.get_userdata(); var item = node.get_userdata();
console.log("Ack", item.e.eventText); console.log("Ack", item.e.eventText);
...@@ -377,9 +403,9 @@ function Ev() { ...@@ -377,9 +403,9 @@ function Ev() {
if (item.e.eventStatus & MhC.mEventStatus_NotRet) { if (item.e.eventStatus & MhC.mEventStatus_NotRet) {
item.e.eventStatus &= ~MhC.mEventStatus_NotAck; item.e.eventStatus &= ~MhC.mEventStatus_NotAck;
item.update(); item.update();
} } else {
else
this.ctx.remove(item.node); this.ctx.remove(item.node);
}
this.ctx.configure(); this.ctx.configure();
this.ctx.draw(); this.ctx.draw();
} }
...@@ -390,77 +416,86 @@ function Ev() { ...@@ -390,77 +416,86 @@ function Ev() {
this.open_objectgraph_cb = function (id, data, sts, result) { this.open_objectgraph_cb = function (id, data, sts, result) {
if ((sts & 1) != 0) { if ((sts & 1) != 0) {
data.location.href = "ge.html?graph=" + result.param1 + "&instance=" + result.fullname; data.location.href =
"ge.html?graph=" + result.param1 + "&instance=" + result.fullname;
data.document.title = result.fullname; data.document.title = result.fullname;
} } else {
else
data.document.write("Error status " + sts); data.document.write("Error status " + sts);
} }
}
this.open_graph_cb = function (id, data, sts, result) { this.open_graph_cb = function (id, data, sts, result) {
if ((sts & 1) != 0) { if ((sts & 1) != 0) {
var idx = result.param1.indexOf('.'); var idx = result.param1.indexOf('.');
if (idx != -1) if (idx != -1) {
result.param1 = result.param1.substring(0, idx); result.param1 = result.param1.substring(0, idx);
}
var instancestr = ""; var instancestr = "";
if (result.fullname !== "") if (result.fullname !== "") {
instancestr = "&instance=" + result.fullname; instancestr = "&instance=" + result.fullname;
}
data.location.href = "ge.html?graph=" + result.param1 + instancestr; data.location.href = "ge.html?graph=" + result.param1 + instancestr;
data.document.title = result.param1; data.document.title = result.param1;
} } else {
else
data.document.write("Error status " + sts); data.document.write("Error status " + sts);
} }
}
this.open_plc_cb = function (id, data, sts, result) { this.open_plc_cb = function (id, data, sts, result) {
if ((sts & 1) != 0) { if ((sts & 1) != 0) {
var param1; var param1;
if (result.param1 !== "") if (result.param1 !== "") {
param1 = "&obj=" + result.param1; param1 = "&obj=" + result.param1;
else } else {
param1 = ""; param1 = "";
console.log("flow.html?vid=" + result.objid.vid + "&oix=" + result.objid.oix + param1);
data.location.href = "flow.html?vid=" + result.objid.vid + "&oix=" + result.objid.oix + param1;
data.document.title = "Trace " + result.fullname;
} }
else console.log("flow.html?vid=" + result.objid.vid + "&oix=" +
result.objid.oix + param1);
data.location.href =
"flow.html?vid=" + result.objid.vid + "&oix=" + result.objid.oix +
param1;
data.document.title = "Trace " + result.fullname;
} else {
data.document.write("Error status " + sts); data.document.write("Error status " + sts);
} }
}
this.open_navigator_cb = function (id, data, sts, result) { this.open_navigator_cb = function (id, data, sts, result) {
console.log("Open navigator", sts); console.log("Open navigator", sts);
if ((sts & 1) != 0) { if ((sts & 1) != 0) {
localStorage.setItem("XttMethodNavigator", result.fullname); localStorage.setItem("XttMethodNavigator", result.fullname);
console.log("storage", localStorage.getItem("XttMethodNavigator")); console.log("storage", localStorage.getItem("XttMethodNavigator"));
} } else {
else
console.log("Error status " + sts); console.log("Error status " + sts);
} }
}
this.open_objectgraph_cb = function (id, data, sts, result) { this.open_objectgraph_cb = function (id, data, sts, result) {
if ((sts & 1) != 0) { if ((sts & 1) != 0) {
var classname = result.classname.toLowerCase(); var classname = result.classname.toLowerCase();
if (classname.substring(0, 1) == "$") if (classname.substring(0, 1) == "$") {
classname = classname.substring(1); classname = classname.substring(1);
}
var graphname = "pwr_c_" + classname; var graphname = "pwr_c_" + classname;
data.location.href = "ge.html?graph=" + graphname + "&instance=" + result.fullname; data.location.href =
"ge.html?graph=" + graphname + "&instance=" + result.fullname;
data.document.title = graphname + " " + result.fullname; data.document.title = graphname + " " + result.fullname;
} } else {
else
data.document.write("Error status " + sts); data.document.write("Error status " + sts);
} }
}
this.open_helpclass_cb = function (id, data, sts, result) { this.open_helpclass_cb = function (id, data, sts, result) {
if ((sts & 1) != 0) { if ((sts & 1) != 0) {
console.log("open_helpclass", result.param1); console.log("open_helpclass", result.param1);
var url = location.protocol + "//" + location.host + result.param1; var url = location.protocol + "//" + location.host + result.param1;
data.location.href = url; data.location.href = url;
} } else {
else
data.document.write("Error status " + sts); data.document.write("Error status " + sts);
} }
}
this.methods_init = function () { this.methods_init = function () {
localStorage.setItem("EvMethodNavigator", ""); localStorage.setItem("EvMethodNavigator", "");
...@@ -470,9 +505,10 @@ function Ev() { ...@@ -470,9 +505,10 @@ function Ev() {
this.ctx.set_nodraw(); this.ctx.set_nodraw();
for (var i = 0; i < this.ctx.a.size(); i++) { for (var i = 0; i < this.ctx.a.size(); i++) {
var node = this.ctx.a.get(i); var node = this.ctx.a.get(i);
if (node.level == 0) if (node.level == 0) {
node.userdata.close(this); node.userdata.close(this);
} }
}
this.ctx.reset_nodraw(); this.ctx.reset_nodraw();
this.ctx.draw(); this.ctx.draw();
} }
...@@ -485,24 +521,32 @@ function Ev() { ...@@ -485,24 +521,32 @@ function Ev() {
this.trace_scan = function (id, sts) { this.trace_scan = function (id, sts) {
self.scan_update = false; self.scan_update = false;
if (self.scan_update) if (self.scan_update) {
self.ctx.draw(); self.ctx.draw();
}
}; };
this.createNodeClasses = function () { this.createNodeClasses = function () {
var r1 = new PlowRect(this.ctx, 0, 0, 50, 1.0, Plow.COLOR_WHITE, Plow.COLOR_WHITE, true, false); var r1 = new PlowRect(this.ctx, 0, 0, 50, 1.0, Plow.COLOR_WHITE,
var r2a = new PlowRect(this.ctx, 0.1, 0.15, 0.7, 0.7, Plow.COLOR_RED, Plow.COLOR_BLACK, true, false); Plow.COLOR_WHITE, true, false);
var r2b = new PlowRect(this.ctx, 0.1, 0.15, 0.7, 0.7, Plow.COLOR_YELLOW, Plow.COLOR_BLACK, true, false); var r2a = new PlowRect(this.ctx, 0.1, 0.15, 0.7, 0.7, Plow.COLOR_RED,
var r2info = new PlowRect(this.ctx, 0.1, 0.15, 0.7, 0.7, Plow.COLOR_WHITE, Plow.COLOR_BLACK, true, false); Plow.COLOR_BLACK, true, false);
var r2success = new PlowRect(this.ctx, 0.1, 0.15, 0.7, 0.7, Plow.COLOR_GREEN, Plow.COLOR_BLACK, true, false); var r2b = new PlowRect(this.ctx, 0.1, 0.15, 0.7, 0.7, Plow.COLOR_YELLOW,
Plow.COLOR_BLACK, true, false);
var r2info = new PlowRect(this.ctx, 0.1, 0.15, 0.7, 0.7, Plow.COLOR_WHITE,
Plow.COLOR_BLACK, true, false);
var r2success = new PlowRect(this.ctx, 0.1, 0.15, 0.7, 0.7,
Plow.COLOR_GREEN, Plow.COLOR_BLACK, true, false);
var a1 = new PlowAnnot(this.ctx, 1, 0.9, 4, Plow.COLOR_BLACK, 0, 0); var a1 = new PlowAnnot(this.ctx, 1, 0.9, 4, Plow.COLOR_BLACK, 0, 0);
var p1 = new PlowAnnotPixmap(this.ctx, 1.8, 0.2, 0); var p1 = new PlowAnnotPixmap(this.ctx, 1.8, 0.2, 0);
var p2 = new PlowAnnotPixmap(this.ctx, 2.4, 0.2, 1); var p2 = new PlowAnnotPixmap(this.ctx, 2.4, 0.2, 1);
var p3 = new PlowAnnotPixmap(this.ctx, 3.2, 0.2, 2); var p3 = new PlowAnnotPixmap(this.ctx, 3.2, 0.2, 2);
var p4 = new PlowAnnotPixmap(this.ctx, 4.0, 0.2, 3); var p4 = new PlowAnnotPixmap(this.ctx, 4.0, 0.2, 3);
var a2 = new PlowAnnot(this.ctx, 4.8, 0.9, 4, Plow.COLOR_BLACK, 0, 1); var a2 = new PlowAnnot(this.ctx, 4.8, 0.9, 4, Plow.COLOR_BLACK, 0, 1);
var a3 = new PlowAnnot(this.ctx, 11.5, 0.9, 4, Plow.COLOR_BLACK, Plow.NEXT_RELATIVE_POSITION, 2); var a3 = new PlowAnnot(this.ctx, 11.5, 0.9, 4, Plow.COLOR_BLACK,
var a4 = new PlowAnnot(this.ctx, 22.5, 0.9, 4, Plow.COLOR_BLACK, Plow.RELATIVE_POSITION, 3); Plow.NEXT_RELATIVE_POSITION, 2);
var a4 = new PlowAnnot(this.ctx, 22.5, 0.9, 4, Plow.COLOR_BLACK,
Plow.RELATIVE_POSITION, 3);
// A alarm with red square // A alarm with red square
this.ncAlarmA = new PlowNodeClass(this.ctx); this.ncAlarmA = new PlowNodeClass(this.ctx);
...@@ -577,8 +621,9 @@ function Ev() { ...@@ -577,8 +621,9 @@ function Ev() {
this.plow_event = function (event, object, x, y) { this.plow_event = function (event, object, x, y) {
var item = null; var item = null;
if (object != null) if (object != null) {
item = object.get_userdata(); item = object.get_userdata();
}
switch (event) { switch (event) {
case Plow.eEvent_ObjectDeleted: case Plow.eEvent_ObjectDeleted:
...@@ -590,12 +635,10 @@ function Ev() { ...@@ -590,12 +635,10 @@ function Ev() {
if (item != null && item.e.eventMoreText !== "" && if (item != null && item.e.eventMoreText !== "" &&
x >= object.measure().ll_x + 70 && x <= object.measure().ll_x + 90) { x >= object.measure().ll_x + 70 && x <= object.measure().ll_x + 90) {
window.alert(item.e.eventMoreText); window.alert(item.e.eventMoreText);
} } else if (object.select) {
else if (object.select) {
object.set_select(false); object.set_select(false);
object.set_invert(false); object.set_invert(false);
} } else {
else {
self.ctx.set_select(false); self.ctx.set_select(false);
object.set_select(true); object.set_select(true);
self.ctx.set_invert(false); self.ctx.set_invert(false);
...@@ -614,11 +657,11 @@ function Ev() { ...@@ -614,11 +657,11 @@ function Ev() {
o.set_invert(false); o.set_invert(false);
next.set_select(true); next.set_select(true);
next.set_invert(true); next.set_invert(true);
if (!self.ctx.is_visible(next)) if (!self.ctx.is_visible(next)) {
self.ctx.scroll(next.y_low, 0.10); self.ctx.scroll(next.y_low, 0.10);
} }
} }
else { } else {
o = self.ctx.a.a[0]; o = self.ctx.a.a[0];
o.set_select(true); o.set_select(true);
o.set_invert(true); o.set_invert(true);
...@@ -637,10 +680,11 @@ function Ev() { ...@@ -637,10 +680,11 @@ function Ev() {
next.set_invert(true); next.set_invert(true);
o.draw(self.ctx.gdraw.gctx, null, null, 0); o.draw(self.ctx.gdraw.gctx, null, null, 0);
next.draw(self.ctx.gdraw.gctx, null, null, 0); next.draw(self.ctx.gdraw.gctx, null, null, 0);
if (!self.ctx.is_visible(next)) if (!self.ctx.is_visible(next)) {
self.ctx.scroll(next.y_low, 0.90); self.ctx.scroll(next.y_low, 0.90);
} }
} }
}
break; break;
} }
...@@ -660,7 +704,8 @@ function Ev() { ...@@ -660,7 +704,8 @@ function Ev() {
var o = self.ctx.get_select(); var o = self.ctx.get_select();
if (o.userdata instanceof EvItemAlarm) { if (o.userdata instanceof EvItemAlarm) {
var newwindow = window.open("", "_blank"); var newwindow = window.open("", "_blank");
self.ctx.gdh.getObject(o.userdata.objid, GdhOp.GET_OP_METHOD_PLC, self.open_plc_cb, newwindow); self.ctx.gdh.getObject(o.userdata.objid, GdhOp.GET_OP_METHOD_PLC,
self.open_plc_cb, newwindow);
} }
break; break;
} }
...@@ -668,7 +713,8 @@ function Ev() { ...@@ -668,7 +713,8 @@ function Ev() {
var o = self.ctx.get_select(); var o = self.ctx.get_select();
if (o.userdata instanceof EvItemAlarm) { if (o.userdata instanceof EvItemAlarm) {
var newwindow = window.open("", "_blank"); var newwindow = window.open("", "_blank");
self.ctx.gdh.getObject(o.userdata.objid, GdhOp.GET_OP_METHOD_PLC, self.open_objectgraph_cb, newwindow); self.ctx.gdh.getObject(o.userdata.objid, GdhOp.GET_OP_METHOD_PLC,
self.open_objectgraph_cb, newwindow);
} }
break; break;
} }
...@@ -680,24 +726,25 @@ function Ev() { ...@@ -680,24 +726,25 @@ function Ev() {
var query = window.location.search.substring(1); var query = window.location.search.substring(1);
var type; var type;
if (query === "") if (query === "") {
return EvC.eType_AlarmList; return EvC.eType_AlarmList;
}
var vars = query.split('&'); var vars = query.split('&');
var typestr = vars[0].substring(5); var typestr = vars[0].substring(5);
if (typestr == "event") if (typestr == "event") {
type = EvC.eType_EventList; type = EvC.eType_EventList;
else if (typestr == "block") } else if (typestr == "block") {
type = EvC.eType_BlockList; type = EvC.eType_BlockList;
else } else {
type = EvC.eType_AlarmList; type = EvC.eType_AlarmList;
}
return type; return type;
}; };
} }
function EvItemAlarm(ev, e, function EvItemAlarm(ev, e, destination, destCode) {
destination, destCode) {
this.node; this.node;
this.e = e; this.e = e;
...@@ -824,30 +871,32 @@ function EvItemAlarm(ev, e, ...@@ -824,30 +871,32 @@ function EvItemAlarm(ev, e,
} }
break; break;
case EvC.eType_AlarmList: case EvC.eType_AlarmList:
if (this.e.eventStatus & MhC.mEventStatus_NotRet) if (this.e.eventStatus & MhC.mEventStatus_NotRet) {
this.node.set_annotation_pixmap(1, Bitmaps.alarm); this.node.set_annotation_pixmap(1, Bitmaps.alarm);
if (this.e.eventStatus & MhC.mEventStatus_NotAck) }
if (this.e.eventStatus & MhC.mEventStatus_NotAck) {
this.node.set_annotation_pixmap(0, Bitmaps.ack); this.node.set_annotation_pixmap(0, Bitmaps.ack);
if (this.e.eventMoreText !== "") }
if (this.e.eventMoreText !== "") {
this.node.set_annotation_pixmap(2, Bitmaps.info); this.node.set_annotation_pixmap(2, Bitmaps.info);
}
break; break;
} }
this.update = function () { this.update = function () {
if (this.e.eventStatus & MhC.mEventStatus_NotRet) if (this.e.eventStatus & MhC.mEventStatus_NotRet) {
this.node.set_annotation_pixmap(1, Bitmaps.alarm); this.node.set_annotation_pixmap(1, Bitmaps.alarm);
else } else {
this.node.set_annotation_pixmap(1, null); this.node.set_annotation_pixmap(1, null);
}
if (this.e.eventStatus & MhC.mEventStatus_NotAck) if (this.e.eventStatus & MhC.mEventStatus_NotAck) {
this.node.set_annotation_pixmap(0, Bitmaps.ack); this.node.set_annotation_pixmap(0, Bitmaps.ack);
else } else {
this.node.set_annotation_pixmap(0, null); this.node.set_annotation_pixmap(0, null);
} }
}
} }
var ev = new Ev(); var ev = new Ev();
ev.init(); ev.init();
/** End Ev **/
"use strict"; "use strict";
/** Start Flow **/
var Flow = { var Flow = {
DRAWOFFSET: 2, DRAWOFFSET: 2,
...@@ -247,7 +245,9 @@ function FlowArray(ctx) { ...@@ -247,7 +245,9 @@ function FlowArray(ctx) {
var tokens = lines[i].split(' '); var tokens = lines[i].split(' ');
var key = parseInt(tokens[0]); var key = parseInt(tokens[0]);
if (this.ctx.debug) console.log("array : " + lines[i]); if (this.ctx.debug) {
console.log("array : " + lines[i]);
}
switch (key) { switch (key) {
case Flow.eSave_Array: case Flow.eSave_Array:
...@@ -324,26 +324,29 @@ function FlowArray(ctx) { ...@@ -324,26 +324,29 @@ function FlowArray(ctx) {
console.log("Syntax error in FlowArray", key); console.log("Syntax error in FlowArray", key);
break; break;
} }
if (end) if (end) {
break; break;
} }
}
return i; return i;
}; };
this.draw = function (g, p, node, highlight) { this.draw = function (g, p, node, highlight) {
for (var i = 0; i < this.a.length; i++) for (var i = 0; i < this.a.length; i++) {
this.a[i].draw(g, p, node, highlight); this.a[i].draw(g, p, node, highlight);
} }
}
this.search_by_name = function (name) { this.search_by_name = function (name) {
var uname = name.toUpperCase(); var uname = name.toUpperCase();
for (var i = 0; i < this.a.length; i++) { for (var i = 0; i < this.a.length; i++) {
if (this.a[i] instanceof FlowNode) { if (this.a[i] instanceof FlowNode) {
console.log("Search", this.a[i].n_name, name); console.log("Search", this.a[i].n_name, name);
if (this.a[i].n_name.toUpperCase() == uname) if (this.a[i].n_name.toUpperCase() == uname) {
return this.a[i]; return this.a[i];
} }
} }
}
return null; return null;
} }
} }
...@@ -365,7 +368,9 @@ function FlowNodeClass(ctx) { ...@@ -365,7 +368,9 @@ function FlowNodeClass(ctx) {
var tokens = lines[i].split(' '); var tokens = lines[i].split(' ');
var key = parseInt(tokens[0]); var key = parseInt(tokens[0]);
if (this.ctx.debug) console.log("nodeclass : " + lines[i]); if (this.ctx.debug) {
console.log("nodeclass : " + lines[i]);
}
switch (key) { switch (key) {
case Flow.eSave_NodeClass_nc_name: case Flow.eSave_NodeClass_nc_name:
...@@ -386,9 +391,10 @@ function FlowNodeClass(ctx) { ...@@ -386,9 +391,10 @@ function FlowNodeClass(ctx) {
console.log("Syntax error in FlowNodeClass"); console.log("Syntax error in FlowNodeClass");
break; break;
} }
if (end) if (end) {
break; break;
} }
}
return i; return i;
} }
...@@ -415,7 +421,9 @@ function FlowConClass(ctx) { ...@@ -415,7 +421,9 @@ function FlowConClass(ctx) {
var tokens = lines[i].split(' '); var tokens = lines[i].split(' ');
var key = parseInt(tokens[0]); var key = parseInt(tokens[0]);
if (this.ctx.debug) console.log("conclass : " + lines[i]); if (this.ctx.debug) {
console.log("conclass : " + lines[i]);
}
switch (key) { switch (key) {
case Flow.eSave_ConClass: case Flow.eSave_ConClass:
...@@ -454,9 +462,10 @@ function FlowConClass(ctx) { ...@@ -454,9 +462,10 @@ function FlowConClass(ctx) {
console.log("Syntax error in FlowConClass"); console.log("Syntax error in FlowConClass");
break; break;
} }
if (end) if (end) {
break; break;
} }
}
return i; return i;
} }
...@@ -473,7 +482,9 @@ function FlowPoint(ctx) { ...@@ -473,7 +482,9 @@ function FlowPoint(ctx) {
var tokens = lines[i].split(' '); var tokens = lines[i].split(' ');
var key = parseInt(tokens[0]); var key = parseInt(tokens[0]);
if (this.ctx.debug) console.log("point : " + lines[i]); if (this.ctx.debug) {
console.log("point : " + lines[i]);
}
switch (key) { switch (key) {
case Flow.eSave_Point: case Flow.eSave_Point:
...@@ -491,9 +502,10 @@ function FlowPoint(ctx) { ...@@ -491,9 +502,10 @@ function FlowPoint(ctx) {
System.out.println("Syntax error in FlowPoint"); System.out.println("Syntax error in FlowPoint");
break; break;
} }
if (end) if (end) {
break; break;
} }
}
return i; return i;
} }
} }
...@@ -511,9 +523,11 @@ function FlowLine(ctx) { ...@@ -511,9 +523,11 @@ function FlowLine(ctx) {
var x2 = (this.p2.x + p.x) * this.ctx.zoom_factor; var x2 = (this.p2.x + p.x) * this.ctx.zoom_factor;
var y2 = (this.p2.y + p.y) * this.ctx.zoom_factor; var y2 = (this.p2.y + p.y) * this.ctx.zoom_factor;
g.lineWidth = this.ctx.zoom_factor / this.ctx.base_zoom_factor * this.line_width; g.lineWidth =
if (g.lineWidth < 1) this.ctx.zoom_factor / this.ctx.base_zoom_factor * this.line_width;
if (g.lineWidth < 1) {
g.lineWidth = 1; g.lineWidth = 1;
}
switch (this.draw_type) { switch (this.draw_type) {
case Flow.eDrawType_LineDashed: case Flow.eDrawType_LineDashed:
...@@ -535,8 +549,9 @@ function FlowLine(ctx) { ...@@ -535,8 +549,9 @@ function FlowLine(ctx) {
default: default:
g.strokeStyle = "black"; g.strokeStyle = "black";
} }
if (highlight) if (highlight) {
g.strokeStyle = "red"; g.strokeStyle = "red";
}
g.beginPath(); g.beginPath();
g.moveTo(x1, y1); g.moveTo(x1, y1);
g.lineTo(x2, y2); g.lineTo(x2, y2);
...@@ -555,7 +570,9 @@ function FlowLine(ctx) { ...@@ -555,7 +570,9 @@ function FlowLine(ctx) {
var tokens = lines[i].split(' '); var tokens = lines[i].split(' ');
var key = parseInt(tokens[0]); var key = parseInt(tokens[0]);
if (this.ctx.debug) console.log("line : " + lines[i]); if (this.ctx.debug) {
console.log("line : " + lines[i]);
}
switch (key) { switch (key) {
case Flow.eSave_Line: case Flow.eSave_Line:
...@@ -579,9 +596,10 @@ function FlowLine(ctx) { ...@@ -579,9 +596,10 @@ function FlowLine(ctx) {
console.log("Syntax error in FlowLine"); console.log("Syntax error in FlowLine");
break; break;
} }
if (end) if (end) {
break; break;
} }
}
return i; return i;
} }
} }
...@@ -601,7 +619,9 @@ function FlowRect(ctx) { ...@@ -601,7 +619,9 @@ function FlowRect(ctx) {
var tokens = lines[i].split(' '); var tokens = lines[i].split(' ');
var key = parseInt(tokens[0]); var key = parseInt(tokens[0]);
if (this.ctx.debug) console.log("rect : " + lines[i]); if (this.ctx.debug) {
console.log("rect : " + lines[i]);
}
switch (key) { switch (key) {
case Flow.eSave_Rect: case Flow.eSave_Rect:
...@@ -631,23 +651,27 @@ function FlowRect(ctx) { ...@@ -631,23 +651,27 @@ function FlowRect(ctx) {
console.log("Syntax error in FlowRect"); console.log("Syntax error in FlowRect");
break; break;
} }
if (end) if (end) {
break; break;
} }
}
return i; return i;
} }
this.draw = function (g, p, node, highlight) { this.draw = function (g, p, node, highlight) {
if ((this.display_level & this.ctx.display_level) == 0) if ((this.display_level & this.ctx.display_level) == 0) {
return; return;
}
var x = (this.ll.x + p.x) * this.ctx.zoom_factor; var x = (this.ll.x + p.x) * this.ctx.zoom_factor;
var y = (this.ll.y + p.y) * this.ctx.zoom_factor; var y = (this.ll.y + p.y) * this.ctx.zoom_factor;
var width = (this.ur.x - this.ll.x) * this.ctx.zoom_factor; var width = (this.ur.x - this.ll.x) * this.ctx.zoom_factor;
var height = (this.ur.y - this.ll.y) * this.ctx.zoom_factor; var height = (this.ur.y - this.ll.y) * this.ctx.zoom_factor;
g.lineWidth = this.ctx.zoom_factor / this.ctx.base_zoom_factor * this.line_width; g.lineWidth =
if (g.lineWidth < 1) this.ctx.zoom_factor / this.ctx.base_zoom_factor * this.line_width;
if (g.lineWidth < 1) {
g.lineWidth = 1; g.lineWidth = 1;
}
switch (this.draw_type) { switch (this.draw_type) {
case Flow.eDrawType_LineGray: case Flow.eDrawType_LineGray:
g.strokeStyle = "grey"; g.strokeStyle = "grey";
...@@ -661,8 +685,9 @@ function FlowRect(ctx) { ...@@ -661,8 +685,9 @@ function FlowRect(ctx) {
default: default:
g.strokeStyle = "black"; g.strokeStyle = "black";
} }
if (highlight) if (highlight) {
g.strokeStyle = "red"; g.strokeStyle = "red";
}
g.strokeRect(x, y, width, height); g.strokeRect(x, y, width, height);
} }
} }
...@@ -680,18 +705,22 @@ function FlowArc(ctx) { ...@@ -680,18 +705,22 @@ function FlowArc(ctx) {
var r = (this.ur.x - this.ll.x) / 2 * this.ctx.zoom_factor; var r = (this.ur.x - this.ll.x) / 2 * this.ctx.zoom_factor;
var x = (this.ll.x + p.x) * this.ctx.zoom_factor + r; var x = (this.ll.x + p.x) * this.ctx.zoom_factor + r;
var y = (this.ll.y + p.y) * this.ctx.zoom_factor + r; var y = (this.ll.y + p.y) * this.ctx.zoom_factor + r;
if (this.angel1 == 90 || this.angel1 == 270) if (this.angel1 == 90 || this.angel1 == 270) {
var a1 = (this.angel1 + 90) / 180 * Math.PI; var a1 = (this.angel1 + 90) / 180 * Math.PI;
else } else {
var a1 = (this.angel1 - 90) / 180 * Math.PI; var a1 = (this.angel1 - 90) / 180 * Math.PI;
}
var a2 = a1 + this.angel2 / 180 * Math.PI; var a2 = a1 + this.angel2 / 180 * Math.PI;
g.lineWidth = this.ctx.zoom_factor / this.ctx.base_zoom_factor * this.line_width; g.lineWidth =
if (g.lineWidth < 1) this.ctx.zoom_factor / this.ctx.base_zoom_factor * this.line_width;
if (g.lineWidth < 1) {
g.lineWidth = 1; g.lineWidth = 1;
}
g.strokeStyle = "black"; g.strokeStyle = "black";
if (highlight) if (highlight) {
g.strokeStyle = "red"; g.strokeStyle = "red";
}
g.beginPath() g.beginPath()
g.arc(x, y, r, a1, a2, false); g.arc(x, y, r, a1, a2, false);
...@@ -703,7 +732,9 @@ function FlowArc(ctx) { ...@@ -703,7 +732,9 @@ function FlowArc(ctx) {
var tokens = lines[i].split(' '); var tokens = lines[i].split(' ');
var key = parseInt(tokens[0]); var key = parseInt(tokens[0]);
if (this.ctx.debug) console.log("arc : " + lines[i]); if (this.ctx.debug) {
console.log("arc : " + lines[i]);
}
switch (key) { switch (key) {
case Flow.eSave_Arc: case Flow.eSave_Arc:
...@@ -733,9 +764,10 @@ function FlowArc(ctx) { ...@@ -733,9 +764,10 @@ function FlowArc(ctx) {
console.log("Syntax error in FlowArc"); console.log("Syntax error in FlowArc");
break; break;
} }
if (end) if (end) {
break; break;
} }
}
return i; return i;
} }
} }
...@@ -749,8 +781,11 @@ function FlowText(ctx) { ...@@ -749,8 +781,11 @@ function FlowText(ctx) {
this.draw = function (g, p0, node, highlight) { this.draw = function (g, p0, node, highlight) {
var tsize = 0; var tsize = 0;
var idx = this.ctx.zoom_factor / this.ctx.base_zoom_factor * (this.text_size + 4) - 4; var idx = this.ctx.zoom_factor / this.ctx.base_zoom_factor *
if (idx < 0) return; (this.text_size + 4) - 4;
if (idx < 0) {
return;
}
var x = (this.p.x + p0.x) * this.ctx.zoom_factor; var x = (this.p.x + p0.x) * this.ctx.zoom_factor;
var y = (this.p.y + p0.y) * this.ctx.zoom_factor; var y = (this.p.y + p0.y) * this.ctx.zoom_factor;
...@@ -787,8 +822,9 @@ function FlowText(ctx) { ...@@ -787,8 +822,9 @@ function FlowText(ctx) {
g.lineWidth = 0.5; g.lineWidth = 0.5;
g.fillStyle = "black"; g.fillStyle = "black";
if (highlight) if (highlight) {
g.fillStyle = "red"; g.fillStyle = "red";
}
g.fillText(this.text, x, y); g.fillText(this.text, x, y);
} }
this.open = function (lines, row) { this.open = function (lines, row) {
...@@ -797,7 +833,9 @@ function FlowText(ctx) { ...@@ -797,7 +833,9 @@ function FlowText(ctx) {
var tokens = lines[i].split(' '); var tokens = lines[i].split(' ');
var key = parseInt(tokens[0]); var key = parseInt(tokens[0]);
if (this.ctx.debug) console.log("text : " + lines[i]); if (this.ctx.debug) {
console.log("text : " + lines[i]);
}
switch (key) { switch (key) {
case Flow.eSave_Text: case Flow.eSave_Text:
...@@ -821,9 +859,10 @@ function FlowText(ctx) { ...@@ -821,9 +859,10 @@ function FlowText(ctx) {
console.log("Syntax error in FlowText"); console.log("Syntax error in FlowText");
break; break;
} }
if (end) if (end) {
break; break;
} }
}
return i; return i;
} }
} }
...@@ -859,8 +898,9 @@ function FlowArrow(ctx) { ...@@ -859,8 +898,9 @@ function FlowArrow(ctx) {
default: default:
g.fillStyle = "black"; g.fillStyle = "black";
} }
if (highlight) if (highlight) {
g.fillStyle = "red"; g.fillStyle = "red";
}
g.beginPath() g.beginPath()
g.moveTo(x1, y1); g.moveTo(x1, y1);
g.lineTo(x2, y2); g.lineTo(x2, y2);
...@@ -875,7 +915,9 @@ function FlowArrow(ctx) { ...@@ -875,7 +915,9 @@ function FlowArrow(ctx) {
var tokens = lines[i].split(' '); var tokens = lines[i].split(' ');
var key = parseInt(tokens[0]); var key = parseInt(tokens[0]);
if (this.ctx.debug) console.log("arrow : " + lines[i]); if (this.ctx.debug) {
console.log("arrow : " + lines[i]);
}
switch (key) { switch (key) {
case Flow.eSave_Arrow: case Flow.eSave_Arrow:
...@@ -908,10 +950,11 @@ function FlowArrow(ctx) { ...@@ -908,10 +950,11 @@ function FlowArrow(ctx) {
console.log("Syntax error in FlowArrow"); console.log("Syntax error in FlowArrow");
break; break;
} }
if (end) if (end) {
break; break;
} }
} }
}
} }
function FlowTriangle(ctx) { function FlowTriangle(ctx) {
...@@ -923,14 +966,17 @@ function FlowTriangle(ctx) { ...@@ -923,14 +966,17 @@ function FlowTriangle(ctx) {
var x2 = (this.prototype.ur.x + p.x) * this.prototype.ctx.zoom_factor; var x2 = (this.prototype.ur.x + p.x) * this.prototype.ctx.zoom_factor;
var y2 = (this.prototype.ur.y + p.y) * this.prototype.ctx.zoom_factor; var y2 = (this.prototype.ur.y + p.y) * this.prototype.ctx.zoom_factor;
g.lineWidth = this.prototype.ctx.zoom_factor / this.prototype.ctx.base_zoom_factor * g.lineWidth =
this.prototype.ctx.zoom_factor / this.prototype.ctx.base_zoom_factor *
this.prototype.line_width; this.prototype.line_width;
if (g.lineWidth < 1) if (g.lineWidth < 1) {
g.lineWidth = 1; g.lineWidth = 1;
}
var dtype = this.prototype.draw_type; var dtype = this.prototype.draw_type;
if (dtype == Flow.eDrawType_Inherit && node != null) if (dtype == Flow.eDrawType_Inherit && node != null) {
dtype = node.fill_color; dtype = node.fill_color;
}
if (this.prototype.fill == 1) { if (this.prototype.fill == 1) {
switch (dtype) { switch (dtype) {
...@@ -953,8 +999,7 @@ function FlowTriangle(ctx) { ...@@ -953,8 +999,7 @@ function FlowTriangle(ctx) {
g.lineTo(x2, y2); g.lineTo(x2, y2);
g.lineTo(x1, y2); g.lineTo(x1, y2);
g.fill(); g.fill();
} } else {
else {
g.strokeStyle = "black"; g.strokeStyle = "black";
g.beginPath(); g.beginPath();
g.moveTo(x1, y2); g.moveTo(x1, y2);
...@@ -970,7 +1015,9 @@ function FlowTriangle(ctx) { ...@@ -970,7 +1015,9 @@ function FlowTriangle(ctx) {
var tokens = lines[i].split(' '); var tokens = lines[i].split(' ');
var key = parseInt(tokens[0]); var key = parseInt(tokens[0]);
if (this.prototype.ctx.debug) console.log("triangle : " + lines[i]); if (this.prototype.ctx.debug) {
console.log("triangle : " + lines[i]);
}
switch (key) { switch (key) {
case Flow.eSave_Triangle_rect_part: case Flow.eSave_Triangle_rect_part:
...@@ -983,9 +1030,10 @@ function FlowTriangle(ctx) { ...@@ -983,9 +1030,10 @@ function FlowTriangle(ctx) {
console.log("Syntax error in FlowTriangle"); console.log("Syntax error in FlowTriangle");
break; break;
} }
if (end) if (end) {
break; break;
} }
}
return i; return i;
} }
} }
...@@ -1006,7 +1054,9 @@ function FlowConPoint(ctx) { ...@@ -1006,7 +1054,9 @@ function FlowConPoint(ctx) {
var tokens = lines[i].split(' '); var tokens = lines[i].split(' ');
var key = parseInt(tokens[0]); var key = parseInt(tokens[0]);
if (ctx.debug) console.log("conpoint : " + lines[i]); if (ctx.debug) {
console.log("conpoint : " + lines[i]);
}
switch (key) { switch (key) {
case Flow.eSave_ConPoint: case Flow.eSave_ConPoint:
...@@ -1033,9 +1083,10 @@ function FlowConPoint(ctx) { ...@@ -1033,9 +1083,10 @@ function FlowConPoint(ctx) {
console.log("Syntax error in FlowConPoint"); console.log("Syntax error in FlowConPoint");
break; break;
} }
if (end) if (end) {
break; break;
} }
}
return i; return i;
} }
} }
...@@ -1050,16 +1101,22 @@ function FlowAnnot(ctx) { ...@@ -1050,16 +1101,22 @@ function FlowAnnot(ctx) {
this.ctx = ctx; this.ctx = ctx;
this.draw = function (g, p0, node, highlight) { this.draw = function (g, p0, node, highlight) {
if (node == null) if (node == null) {
return; return;
if (node.annotv[this.number] == null) }
if (node.annotv[this.number] == null) {
return; return;
if ((this.display_level & this.ctx.display_level) == 0) }
if ((this.display_level & this.ctx.display_level) == 0) {
return; return;
}
var tsize = 0; var tsize = 0;
var idx = this.ctx.zoom_factor / this.ctx.base_zoom_factor * (this.text_size + 4) - 4; var idx = this.ctx.zoom_factor / this.ctx.base_zoom_factor *
if (idx < 0) return; (this.text_size + 4) - 4;
if (idx < 0) {
return;
}
switch (idx) { switch (idx) {
case 0: case 0:
...@@ -1099,8 +1156,9 @@ function FlowAnnot(ctx) { ...@@ -1099,8 +1156,9 @@ function FlowAnnot(ctx) {
g.font = tsize + "px Arial"; g.font = tsize + "px Arial";
} }
g.fillStyle = "black"; g.fillStyle = "black";
if (highlight) if (highlight) {
g.fillStyle = "red"; g.fillStyle = "red";
}
g.lineWidth = 0.5; g.lineWidth = 0.5;
var x = (this.p.x + p0.x) * this.ctx.zoom_factor; var x = (this.p.x + p0.x) * this.ctx.zoom_factor;
...@@ -1118,7 +1176,9 @@ function FlowAnnot(ctx) { ...@@ -1118,7 +1176,9 @@ function FlowAnnot(ctx) {
var tokens = lines[i].split(' '); var tokens = lines[i].split(' ');
var key = parseInt(tokens[0]); var key = parseInt(tokens[0]);
if (this.ctx.debug) console.log("annot : " + lines[i]); if (this.ctx.debug) {
console.log("annot : " + lines[i]);
}
switch (key) { switch (key) {
case Flow.eSave_Annot: case Flow.eSave_Annot:
...@@ -1148,9 +1208,10 @@ function FlowAnnot(ctx) { ...@@ -1148,9 +1208,10 @@ function FlowAnnot(ctx) {
console.log("Syntax error in FlowAnnot"); console.log("Syntax error in FlowAnnot");
break; break;
} }
if (end) if (end) {
break; break;
} }
}
return i; return i;
} }
} }
...@@ -1182,14 +1243,16 @@ function FlowCon(ctx) { ...@@ -1182,14 +1243,16 @@ function FlowCon(ctx) {
this.redraw = true; this.redraw = true;
this.draw = function (g, p0, node, highlight) { this.draw = function (g, p0, node, highlight) {
if (!this.redraw) if (!this.redraw) {
return; return;
}
var p = new FlowPoint(ctx); var p = new FlowPoint(ctx);
p.x = 0; p.x = 0;
p.y = 0; p.y = 0;
if (this.temporary_ref != 0 || this.cc.con_type == Flow.eConType_Reference) if (this.temporary_ref != 0 ||
this.cc.con_type == Flow.eConType_Reference) {
this.ref_a.draw(g, p, null, highlight); this.ref_a.draw(g, p, null, highlight);
else { } else {
this.line_a.draw(g, p, null, highlight); this.line_a.draw(g, p, null, highlight);
this.arc_a.draw(g, p, null, highlight); this.arc_a.draw(g, p, null, highlight);
this.arrow_a.draw(g, p, null, highlight); this.arrow_a.draw(g, p, null, highlight);
...@@ -1202,7 +1265,9 @@ function FlowCon(ctx) { ...@@ -1202,7 +1265,9 @@ function FlowCon(ctx) {
var tokens = lines[i].split(' '); var tokens = lines[i].split(' ');
var key = parseInt(tokens[0]); var key = parseInt(tokens[0]);
if (this.ctx.debug) console.log("con : " + lines[i]); if (this.ctx.debug) {
console.log("con : " + lines[i]);
}
switch (key) { switch (key) {
case Flow.eSave_Con: case Flow.eSave_Con:
...@@ -1217,12 +1282,14 @@ function FlowCon(ctx) { ...@@ -1217,12 +1282,14 @@ function FlowCon(ctx) {
break; break;
} }
} }
if (!found) if (!found) {
console.log("FlowCon: ConClass not found: " + cc_name); console.log("FlowCon: ConClass not found: " + cc_name);
}
break; break;
case Flow.eSave_Con_c_name: case Flow.eSave_Con_c_name:
if (tokens[1] != null) if (tokens[1] != null) {
this.c_name = tokens[1]; this.c_name = tokens[1];
}
break; break;
case Flow.eSave_Con_x_right: case Flow.eSave_Con_x_right:
this.x_right = parseFloat(tokens[1]); this.x_right = parseFloat(tokens[1]);
...@@ -1291,12 +1358,14 @@ function FlowCon(ctx) { ...@@ -1291,12 +1358,14 @@ function FlowCon(ctx) {
case Flow.eSave_Con_dest_ref_cnt: case Flow.eSave_Con_dest_ref_cnt:
break; break;
case Flow.eSave_Con_trace_object: case Flow.eSave_Con_trace_object:
if (tokens[1] != null) if (tokens[1] != null) {
this.trace_object = tokens[1]; this.trace_object = tokens[1];
}
break; break;
case Flow.eSave_Con_trace_attribute: case Flow.eSave_Con_trace_attribute:
if (tokens[1] != null) if (tokens[1] != null) {
this.trace_attribute = tokens[1]; this.trace_attribute = tokens[1];
}
break; break;
case Flow.eSave_Con_trace_attr_type: case Flow.eSave_Con_trace_attr_type:
this.trace_attr_type = parseInt(tokens[1]); this.trace_attr_type = parseInt(tokens[1]);
...@@ -1311,9 +1380,10 @@ function FlowCon(ctx) { ...@@ -1311,9 +1380,10 @@ function FlowCon(ctx) {
console.log("Syntax error in FlowCon"); console.log("Syntax error in FlowCon");
break; break;
} }
if (end) if (end) {
break; break;
} }
}
return i; return i;
} }
this.connect = function () { this.connect = function () {
...@@ -1346,8 +1416,9 @@ function FlowNode(ctx) { ...@@ -1346,8 +1416,9 @@ function FlowNode(ctx) {
this.redraw = true; this.redraw = true;
this.draw = function (g, p, node, highlight) { this.draw = function (g, p, node, highlight) {
if (!this.redraw) if (!this.redraw) {
return; return;
}
if (this.nc.group != Flow.eNodeGroup_Document) { if (this.nc.group != Flow.eNodeGroup_Document) {
var x = this.x_left * this.ctx.zoom_factor; var x = this.x_left * this.ctx.zoom_factor;
...@@ -1355,8 +1426,9 @@ function FlowNode(ctx) { ...@@ -1355,8 +1426,9 @@ function FlowNode(ctx) {
var width = (this.x_right - this.x_left) * this.ctx.zoom_factor; var width = (this.x_right - this.x_left) * this.ctx.zoom_factor;
var height = (this.y_high - this.y_low) * this.ctx.zoom_factor + 2; var height = (this.y_high - this.y_low) * this.ctx.zoom_factor + 2;
g.fillStyle = "white"; g.fillStyle = "white";
if (this.select) if (this.select) {
g.fillStyle = "lightblue"; g.fillStyle = "lightblue";
}
g.fillRect(x, y, width, height); g.fillRect(x, y, width, height);
} }
...@@ -1370,7 +1442,9 @@ function FlowNode(ctx) { ...@@ -1370,7 +1442,9 @@ function FlowNode(ctx) {
var tokens = lines[i].split(' '); var tokens = lines[i].split(' ');
var key = parseInt(tokens[0]); var key = parseInt(tokens[0]);
if (this.ctx.debug) console.log("node : " + lines[i]); if (this.ctx.debug) {
console.log("node : " + lines[i]);
}
switch (key) { switch (key) {
case Flow.eSave_Node_nc: case Flow.eSave_Node_nc:
...@@ -1383,12 +1457,14 @@ function FlowNode(ctx) { ...@@ -1383,12 +1457,14 @@ function FlowNode(ctx) {
break; break;
} }
} }
if (!found) if (!found) {
console.log("FlowNode: NodeClass not found: " + nc_name); console.log("FlowNode: NodeClass not found: " + nc_name);
}
break; break;
case Flow.eSave_Node_n_name: case Flow.eSave_Node_n_name:
if (tokens[1] != null) if (tokens[1] != null) {
this.n_name = tokens[1]; this.n_name = tokens[1];
}
break; break;
case Flow.eSave_Node_refcon_cnt: case Flow.eSave_Node_refcon_cnt:
i += 32; i += 32;
...@@ -1446,12 +1522,14 @@ function FlowNode(ctx) { ...@@ -1446,12 +1522,14 @@ function FlowNode(ctx) {
break; break;
} }
sb.push(c); sb.push(c);
if (k == lines[i].length - 1) if (k == lines[i].length - 1) {
sb.push('\n'); sb.push('\n');
} }
if (end_found) }
if (end_found) {
break; break;
} }
}
this.annotv[j] = sb.join(""); this.annotv[j] = sb.join("");
} }
} }
...@@ -1460,12 +1538,14 @@ function FlowNode(ctx) { ...@@ -1460,12 +1538,14 @@ function FlowNode(ctx) {
i = this.pos.open(lines, i + 1); i = this.pos.open(lines, i + 1);
break; break;
case Flow.eSave_Node_trace_object: case Flow.eSave_Node_trace_object:
if (tokens[1] != null) if (tokens[1] != null) {
this.trace_object = tokens[1]; this.trace_object = tokens[1];
}
break; break;
case Flow.eSave_Node_trace_attribute: case Flow.eSave_Node_trace_attribute:
if (tokens[1] != null) if (tokens[1] != null) {
this.trace_attribute = tokens[1]; this.trace_attribute = tokens[1];
}
break; break;
case Flow.eSave_Node_trace_attr_type: case Flow.eSave_Node_trace_attr_type:
this.trace_attr_type = parseInt(tokens[1]); this.trace_attr_type = parseInt(tokens[1]);
...@@ -1483,22 +1563,26 @@ function FlowNode(ctx) { ...@@ -1483,22 +1563,26 @@ function FlowNode(ctx) {
console.log("Syntax error in FlowNode"); console.log("Syntax error in FlowNode");
break; break;
} }
if (end) if (end) {
break; break;
} }
}
console.log("Node", this.trace_attr_type, this.n_name); console.log("Node", this.trace_attr_type, this.n_name);
return i; return i;
} }
this.connect = function () { this.connect = function () {
if (this.trace_object == "" || this.trace_attribute == "") if (this.trace_object == "" || this.trace_attribute == "") {
return; return;
if (this.trace_attr_type == Flow.eTraceType_User) }
if (this.trace_attr_type == Flow.eTraceType_User) {
return; return;
}
var n = this.trace_attribute.indexOf('#'); var n = this.trace_attribute.indexOf('#');
if (n != -1) if (n != -1) {
this.trace_attribute = this.trace_attribute.substring(0, n); this.trace_attribute = this.trace_attribute.substring(0, n);
}
var o = this.trace_object + "." + this.trace_attribute; var o = this.trace_object + "." + this.trace_attribute;
var pwr_type; var pwr_type;
...@@ -1520,20 +1604,23 @@ function FlowNode(ctx) { ...@@ -1520,20 +1604,23 @@ function FlowNode(ctx) {
console.log("connecting", o, this.p); console.log("connecting", o, this.p);
} }
this.scan = function () { this.scan = function () {
if (this.p == 0) if (this.p == 0) {
return; return;
}
var v1 = this.ctx.gdh.getObjectRefInfo(this.p); var v1 = this.ctx.gdh.getObjectRefInfo(this.p);
var evaluate = true; var evaluate = true;
if (this.first_scan) if (this.first_scan) {
this.first_scan = false; this.first_scan = false;
else if (v1 == this.old_value) } else if (v1 == this.old_value) {
return; return;
}
if (v1) if (v1) {
this.highlight = true; this.highlight = true;
else } else {
this.highlight = false; this.highlight = false;
}
this.old_value = v1; this.old_value = v1;
this.redraw = true; this.redraw = true;
...@@ -1542,14 +1629,13 @@ function FlowNode(ctx) { ...@@ -1542,14 +1629,13 @@ function FlowNode(ctx) {
this.event_handler = function (x, y) { this.event_handler = function (x, y) {
var zx = x / this.ctx.zoom_factor + ctx.x_left; var zx = x / this.ctx.zoom_factor + ctx.x_left;
var zy = y / this.ctx.zoom_factor + ctx.y_low; var zy = y / this.ctx.zoom_factor + ctx.y_low;
if (zx >= this.x_left && zx <= this.x_right && if (zx >= this.x_left && zx <= this.x_right && zy >= this.y_low &&
zy >= this.y_low && zy <= this.y_high) { zy <= this.y_high) {
console.log("Hit in node"); console.log("Hit in node");
if (this.select) { if (this.select) {
this.select = false; this.select = false;
this.redraw = true; this.redraw = true;
} } else {
else {
this.ctx.set_select(false); this.ctx.set_select(false);
this.set_select(true); this.set_select(true);
} }
...@@ -1563,12 +1649,13 @@ function FlowNode(ctx) { ...@@ -1563,12 +1649,13 @@ function FlowNode(ctx) {
if (select != this.select) { if (select != this.select) {
this.select = select; this.select = select;
this.redraw = true; this.redraw = true;
if (this.select) if (this.select) {
this.ctx.select_object = this; this.ctx.select_object = this;
else } else {
this.ctx.select_object = null; this.ctx.select_object = null;
} }
} }
}
} }
function FlowCtx() { function FlowCtx() {
...@@ -1599,7 +1686,9 @@ function FlowCtx() { ...@@ -1599,7 +1686,9 @@ function FlowCtx() {
var tokens = lines[i].split(' '); var tokens = lines[i].split(' ');
var key = parseInt(tokens[0]); var key = parseInt(tokens[0]);
if (this.debug) console.log("ctx : " + lines[i]); if (this.debug) {
console.log("ctx : " + lines[i]);
}
switch (key) { switch (key) {
case Flow.eSave_Ctx: case Flow.eSave_Ctx:
...@@ -1668,55 +1757,67 @@ function FlowCtx() { ...@@ -1668,55 +1757,67 @@ function FlowCtx() {
default: default:
console.log("Syntax error in FlowCtx", key); console.log("Syntax error in FlowCtx", key);
} }
if (end) if (end) {
break; break;
} }
}
return i; return i;
}; };
this.connect = function () { this.connect = function () {
console.log("ctx connect", this.a.size()); console.log("ctx connect", this.a.size());
for (var i = 0; i < this.a.size(); i++) for (var i = 0; i < this.a.size(); i++) {
this.a.get(i).connect(); this.a.get(i).connect();
} }
}
this.scan = function () { this.scan = function () {
for (var i = 0; i < this.a.size(); i++) for (var i = 0; i < this.a.size(); i++) {
this.a.get(i).scan(); this.a.get(i).scan();
} }
}
this.event_handler = function (x, y) { this.event_handler = function (x, y) {
var sts = 0; var sts = 0;
for (var i = 0; i < this.a.size(); i++) { for (var i = 0; i < this.a.size(); i++) {
if (this.a.get(i) instanceof FlowNode) { if (this.a.get(i) instanceof FlowNode) {
sts = this.a.get(i).event_handler(x, y); sts = this.a.get(i).event_handler(x, y);
if (sts == 1) if (sts == 1) {
break; break;
} }
} }
if (sts == 1) }
if (sts == 1) {
this.draw(); this.draw();
} }
}
this.set_select = function (select) { this.set_select = function (select) {
for (var i = 0; i < this.a.size(); i++) { for (var i = 0; i < this.a.size(); i++) {
if (this.a.get(i) instanceof FlowNode) if (this.a.get(i) instanceof FlowNode) {
this.a.get(i).set_select(select); this.a.get(i).set_select(select);
} }
} }
}
this.search_object = function (name) { this.search_object = function (name) {
console.log("Searching for ", name); console.log("Searching for ", name);
var node = this.a.search_by_name(name); var node = this.a.search_by_name(name);
if (node != null) if (node != null) {
console.log("Found", name); console.log("Found", name);
}
return node; return node;
} }
this.center_object = function (o) { this.center_object = function (o) {
console.log("center_object", o.pos.x * this.zoom_factor + this.offset_x, window.innerWidth, o.pos.x * this.zoom_factor + this.offset_x - window.innerWidth / 2); console.log("center_object", o.pos.x * this.zoom_factor + this.offset_x,
console.log("center_object", o.pos.y * this.zoom_factor + this.offset_y, window.innerHeight, o.pos.y * this.zoom_factor + this.offset_y - window.innerHeight / 2); window.innerWidth, o.pos.x * this.zoom_factor + this.offset_x -
window.scrollTo(o.pos.x * this.zoom_factor + this.offset_x - window.innerWidth / 2, window.innerWidth / 2);
o.pos.y * this.zoom_factor + this.offset_y - window.innerHeight / 2 + this.gdraw.offset_top); console.log("center_object", o.pos.y * this.zoom_factor + this.offset_y,
window.innerHeight, o.pos.y * this.zoom_factor + this.offset_y -
window.innerHeight / 2);
window.scrollTo(o.pos.x * this.zoom_factor + this.offset_x -
window.innerWidth / 2, o.pos.y * this.zoom_factor + this.offset_y -
window.innerHeight / 2 + this.gdraw.offset_top);
} }
} }
...@@ -1757,27 +1858,35 @@ function FlowFrame() { ...@@ -1757,27 +1858,35 @@ function FlowFrame() {
console.log("Click", x, y); console.log("Click", x, y);
self.ctx.event_handler(x, y); self.ctx.event_handler(x, y);
}); });
document.getElementById("toolitem1").addEventListener("click", function (event) { document.getElementById("toolitem1")
.addEventListener("click", function (event) {
console.log("toolitem3 event"); console.log("toolitem3 event");
}); });
document.getElementById("toolitem2").addEventListener("click", function (event) { document.getElementById("toolitem2")
.addEventListener("click", function (event) {
console.log("toolitem1 event, storage"); console.log("toolitem1 event, storage");
console.log("storage", localStorage.getItem("XttMethodNavigator")); console.log("storage", localStorage.getItem("XttMethodNavigator"));
if (self.ctx.select_object != null) { if (self.ctx.select_object != null) {
localStorage.setItem("XttMethodNavigator", self.ctx.select_object.trace_object); localStorage.setItem("XttMethodNavigator",
self.ctx.select_object.trace_object);
} }
console.log("storage", localStorage.getItem("XttMethodNavigator")); console.log("storage", localStorage.getItem("XttMethodNavigator"));
console.log("toolitem2 event window", window.opener); console.log("toolitem2 event window", window.opener);
window.opener.focus(); window.opener.focus();
}); });
document.getElementById("toolitem3").addEventListener("click", function (event) { document.getElementById("toolitem3")
.addEventListener("click", function (event) {
}); });
document.getElementById("toolitem4").addEventListener("click", function (event) { document.getElementById("toolitem4")
.addEventListener("click", function (event) {
}); });
self.ctx.gdraw.canvas.width = (self.ctx.x_right - self.ctx.x_left) * self.ctx.zoom_factor; self.ctx.gdraw.canvas.width =
self.ctx.gdraw.canvas.height = (self.ctx.y_high - self.ctx.y_low) * self.ctx.zoom_factor; (self.ctx.x_right - self.ctx.x_left) * self.ctx.zoom_factor;
self.ctx.gdraw.gctx.translate(-self.ctx.x_left * self.ctx.zoom_factor, -self.ctx.y_low * self.ctx.zoom_factor); self.ctx.gdraw.canvas.height =
(self.ctx.y_high - self.ctx.y_low) * self.ctx.zoom_factor;
self.ctx.gdraw.gctx.translate(-self.ctx.x_left *
self.ctx.zoom_factor, -self.ctx.y_low * self.ctx.zoom_factor);
self.ctx.offset_x -= self.ctx.x_left * self.ctx.zoom_factor; self.ctx.offset_x -= self.ctx.x_left * self.ctx.zoom_factor;
self.ctx.offset_y -= self.ctx.y_low * self.ctx.zoom_factor; self.ctx.offset_y -= self.ctx.y_low * self.ctx.zoom_factor;
...@@ -1820,16 +1929,18 @@ function FlowFrame() { ...@@ -1820,16 +1929,18 @@ function FlowFrame() {
this.flow_close = function () { this.flow_close = function () {
console.log("Close function", self.timer); console.log("Close function", self.timer);
clearTimeout(self.timer); clearTimeout(self.timer);
for (var i in self.ctx.gdh.pending) for (var i in self.ctx.gdh.pending) {
delete self.ctx.gdh.pending[i]; delete self.ctx.gdh.pending[i];
} }
}
this.get_filename = function () { this.get_filename = function () {
var query = window.location.search.substring(1); var query = window.location.search.substring(1);
console.log("query", query); console.log("query", query);
var vars = query.split('&'); var vars = query.split('&');
console.log("vars", vars.length, vars[0].substring(4), vars[1].substring(4)); console.log("vars", vars.length, vars[0].substring(4),
vars[1].substring(4));
var vid = parseInt(vars[0].substring(4)); var vid = parseInt(vars[0].substring(4));
var oix = parseInt(vars[1].substring(4)); var oix = parseInt(vars[1].substring(4));
var avid = []; var avid = [];
...@@ -1841,17 +1952,20 @@ function FlowFrame() { ...@@ -1841,17 +1952,20 @@ function FlowFrame() {
for (var i = 0; i < 4; i++) { for (var i = 0; i < 4; i++) {
svid[i] = avid[i].toString(); svid[i] = avid[i].toString();
for (var j = 0; j < 3; j++) { for (var j = 0; j < 3; j++) {
if (svid[i].length < 3) if (svid[i].length < 3) {
svid[i] = "0" + svid[i]; svid[i] = "0" + svid[i];
} }
} }
}
var soix = oix.toString(16); var soix = oix.toString(16);
for (var j = 0; j < 8; j++) { for (var j = 0; j < 8; j++) {
if (soix.length < 8) if (soix.length < 8) {
soix = "0" + soix; soix = "0" + soix;
} }
}
var fname = "pwr_" + svid[3] + "_" + svid[2] + "_" + svid[1] + "_" + svid[0] + "_" + soix + ".flw"; var fname = "pwr_" + svid[3] + "_" + svid[2] + "_" + svid[1] + "_" +
svid[0] + "_" + soix + ".flw";
console.log(fname); console.log(fname);
if (vars.length > 2) { if (vars.length > 2) {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -9,354 +9,216 @@ function JopCrypt() { ...@@ -9,354 +9,216 @@ function JopCrypt() {
this.ITERATIONS = 16; this.ITERATIONS = 16;
this.con_salt = this.con_salt =
[ [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x05, 0x06,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E,
0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x20, 0x21, 0x22, 0x23, 0x24,
0x0A, 0x0B, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x30,
0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C,
0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x3D, 0x3E, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00,];
0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22,
0x23, 0x24, 0x25, 0x20, 0x21, 0x22, 0x23, 0x24,
0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C,
0x2D, 0x2E, 0x2F, 0x30, 0x31, 0x32, 0x33, 0x34,
0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C,
0x3D, 0x3E, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00,
];
this.shifts2 = this.shifts2 =
[ [false, false, true, true, true, true, true, true, false, true, true, true,
false, false, true, true, true, true, true, true, true, true, true, false];
false, true, true, true, true, true, true, false
]; this.skb = [[/* for C bits (numbered as per FIPS 46) 1 2 3 4 5 6 */
0x00000000, 0x00000010, 0x20000000, 0x20000010, 0x00010000, 0x00010010,
this.skb = 0x20010000, 0x20010010, 0x00000800, 0x00000810, 0x20000800, 0x20000810,
[ 0x00010800, 0x00010810, 0x20010800, 0x20010810, 0x00000020, 0x00000030,
[ 0x20000020, 0x20000030, 0x00010020, 0x00010030, 0x20010020, 0x20010030,
/* for C bits (numbered as per FIPS 46) 1 2 3 4 5 6 */ 0x00000820, 0x00000830, 0x20000820, 0x20000830, 0x00010820, 0x00010830,
0x00000000, 0x00000010, 0x20000000, 0x20000010, 0x20010820, 0x20010830, 0x00080000, 0x00080010, 0x20080000, 0x20080010,
0x00010000, 0x00010010, 0x20010000, 0x20010010, 0x00090000, 0x00090010, 0x20090000, 0x20090010, 0x00080800, 0x00080810,
0x00000800, 0x00000810, 0x20000800, 0x20000810, 0x20080800, 0x20080810, 0x00090800, 0x00090810, 0x20090800, 0x20090810,
0x00010800, 0x00010810, 0x20010800, 0x20010810, 0x00080020, 0x00080030, 0x20080020, 0x20080030, 0x00090020, 0x00090030,
0x00000020, 0x00000030, 0x20000020, 0x20000030, 0x20090020, 0x20090030, 0x00080820, 0x00080830, 0x20080820, 0x20080830,
0x00010020, 0x00010030, 0x20010020, 0x20010030, 0x00090820, 0x00090830, 0x20090820, 0x20090830,],
0x00000820, 0x00000830, 0x20000820, 0x20000830, [/* for C bits (numbered as per FIPS 46) 7 8 10 11 12 13 */
0x00010820, 0x00010830, 0x20010820, 0x20010830, 0x00000000, 0x02000000, 0x00002000, 0x02002000, 0x00200000, 0x02200000,
0x00080000, 0x00080010, 0x20080000, 0x20080010, 0x00202000, 0x02202000, 0x00000004, 0x02000004, 0x00002004, 0x02002004,
0x00090000, 0x00090010, 0x20090000, 0x20090010, 0x00200004, 0x02200004, 0x00202004, 0x02202004, 0x00000400, 0x02000400,
0x00080800, 0x00080810, 0x20080800, 0x20080810, 0x00002400, 0x02002400, 0x00200400, 0x02200400, 0x00202400, 0x02202400,
0x00090800, 0x00090810, 0x20090800, 0x20090810, 0x00000404, 0x02000404, 0x00002404, 0x02002404, 0x00200404, 0x02200404,
0x00080020, 0x00080030, 0x20080020, 0x20080030, 0x00202404, 0x02202404, 0x10000000, 0x12000000, 0x10002000, 0x12002000,
0x00090020, 0x00090030, 0x20090020, 0x20090030, 0x10200000, 0x12200000, 0x10202000, 0x12202000, 0x10000004, 0x12000004,
0x00080820, 0x00080830, 0x20080820, 0x20080830, 0x10002004, 0x12002004, 0x10200004, 0x12200004, 0x10202004, 0x12202004,
0x00090820, 0x00090830, 0x20090820, 0x20090830, 0x10000400, 0x12000400, 0x10002400, 0x12002400, 0x10200400, 0x12200400,
], 0x10202400, 0x12202400, 0x10000404, 0x12000404, 0x10002404, 0x12002404,
[ 0x10200404, 0x12200404, 0x10202404, 0x12202404,],
/* for C bits (numbered as per FIPS 46) 7 8 10 11 12 13 */ [/* for C bits (numbered as per FIPS 46) 14 15 16 17 19 20 */
0x00000000, 0x02000000, 0x00002000, 0x02002000, 0x00000000, 0x00000001, 0x00040000, 0x00040001, 0x01000000, 0x01000001,
0x00200000, 0x02200000, 0x00202000, 0x02202000, 0x01040000, 0x01040001, 0x00000002, 0x00000003, 0x00040002, 0x00040003,
0x00000004, 0x02000004, 0x00002004, 0x02002004, 0x01000002, 0x01000003, 0x01040002, 0x01040003, 0x00000200, 0x00000201,
0x00200004, 0x02200004, 0x00202004, 0x02202004, 0x00040200, 0x00040201, 0x01000200, 0x01000201, 0x01040200, 0x01040201,
0x00000400, 0x02000400, 0x00002400, 0x02002400, 0x00000202, 0x00000203, 0x00040202, 0x00040203, 0x01000202, 0x01000203,
0x00200400, 0x02200400, 0x00202400, 0x02202400, 0x01040202, 0x01040203, 0x08000000, 0x08000001, 0x08040000, 0x08040001,
0x00000404, 0x02000404, 0x00002404, 0x02002404, 0x09000000, 0x09000001, 0x09040000, 0x09040001, 0x08000002, 0x08000003,
0x00200404, 0x02200404, 0x00202404, 0x02202404, 0x08040002, 0x08040003, 0x09000002, 0x09000003, 0x09040002, 0x09040003,
0x10000000, 0x12000000, 0x10002000, 0x12002000, 0x08000200, 0x08000201, 0x08040200, 0x08040201, 0x09000200, 0x09000201,
0x10200000, 0x12200000, 0x10202000, 0x12202000, 0x09040200, 0x09040201, 0x08000202, 0x08000203, 0x08040202, 0x08040203,
0x10000004, 0x12000004, 0x10002004, 0x12002004, 0x09000202, 0x09000203, 0x09040202, 0x09040203,],
0x10200004, 0x12200004, 0x10202004, 0x12202004, [/* for C bits (numbered as per FIPS 46) 21 23 24 26 27 28 */
0x10000400, 0x12000400, 0x10002400, 0x12002400, 0x00000000, 0x00100000, 0x00000100, 0x00100100, 0x00000008, 0x00100008,
0x10200400, 0x12200400, 0x10202400, 0x12202400, 0x00000108, 0x00100108, 0x00001000, 0x00101000, 0x00001100, 0x00101100,
0x10000404, 0x12000404, 0x10002404, 0x12002404, 0x00001008, 0x00101008, 0x00001108, 0x00101108, 0x04000000, 0x04100000,
0x10200404, 0x12200404, 0x10202404, 0x12202404, 0x04000100, 0x04100100, 0x04000008, 0x04100008, 0x04000108, 0x04100108,
], 0x04001000, 0x04101000, 0x04001100, 0x04101100, 0x04001008, 0x04101008,
[ 0x04001108, 0x04101108, 0x00020000, 0x00120000, 0x00020100, 0x00120100,
/* for C bits (numbered as per FIPS 46) 14 15 16 17 19 20 */ 0x00020008, 0x00120008, 0x00020108, 0x00120108, 0x00021000, 0x00121000,
0x00000000, 0x00000001, 0x00040000, 0x00040001, 0x00021100, 0x00121100, 0x00021008, 0x00121008, 0x00021108, 0x00121108,
0x01000000, 0x01000001, 0x01040000, 0x01040001, 0x04020000, 0x04120000, 0x04020100, 0x04120100, 0x04020008, 0x04120008,
0x00000002, 0x00000003, 0x00040002, 0x00040003, 0x04020108, 0x04120108, 0x04021000, 0x04121000, 0x04021100, 0x04121100,
0x01000002, 0x01000003, 0x01040002, 0x01040003, 0x04021008, 0x04121008, 0x04021108, 0x04121108,],
0x00000200, 0x00000201, 0x00040200, 0x00040201, [/* for D bits (numbered as per FIPS 46) 1 2 3 4 5 6 */
0x01000200, 0x01000201, 0x01040200, 0x01040201, 0x00000000, 0x10000000, 0x00010000, 0x10010000, 0x00000004, 0x10000004,
0x00000202, 0x00000203, 0x00040202, 0x00040203, 0x00010004, 0x10010004, 0x20000000, 0x30000000, 0x20010000, 0x30010000,
0x01000202, 0x01000203, 0x01040202, 0x01040203, 0x20000004, 0x30000004, 0x20010004, 0x30010004, 0x00100000, 0x10100000,
0x08000000, 0x08000001, 0x08040000, 0x08040001, 0x00110000, 0x10110000, 0x00100004, 0x10100004, 0x00110004, 0x10110004,
0x09000000, 0x09000001, 0x09040000, 0x09040001, 0x20100000, 0x30100000, 0x20110000, 0x30110000, 0x20100004, 0x30100004,
0x08000002, 0x08000003, 0x08040002, 0x08040003, 0x20110004, 0x30110004, 0x00001000, 0x10001000, 0x00011000, 0x10011000,
0x09000002, 0x09000003, 0x09040002, 0x09040003, 0x00001004, 0x10001004, 0x00011004, 0x10011004, 0x20001000, 0x30001000,
0x08000200, 0x08000201, 0x08040200, 0x08040201, 0x20011000, 0x30011000, 0x20001004, 0x30001004, 0x20011004, 0x30011004,
0x09000200, 0x09000201, 0x09040200, 0x09040201, 0x00101000, 0x10101000, 0x00111000, 0x10111000, 0x00101004, 0x10101004,
0x08000202, 0x08000203, 0x08040202, 0x08040203, 0x00111004, 0x10111004, 0x20101000, 0x30101000, 0x20111000, 0x30111000,
0x09000202, 0x09000203, 0x09040202, 0x09040203, 0x20101004, 0x30101004, 0x20111004, 0x30111004,],
], [/* for D bits (numbered as per FIPS 46) 8 9 11 12 13 14 */
[ 0x00000000, 0x08000000, 0x00000008, 0x08000008, 0x00000400, 0x08000400,
/* for C bits (numbered as per FIPS 46) 21 23 24 26 27 28 */ 0x00000408, 0x08000408, 0x00020000, 0x08020000, 0x00020008, 0x08020008,
0x00000000, 0x00100000, 0x00000100, 0x00100100, 0x00020400, 0x08020400, 0x00020408, 0x08020408, 0x00000001, 0x08000001,
0x00000008, 0x00100008, 0x00000108, 0x00100108, 0x00000009, 0x08000009, 0x00000401, 0x08000401, 0x00000409, 0x08000409,
0x00001000, 0x00101000, 0x00001100, 0x00101100, 0x00020001, 0x08020001, 0x00020009, 0x08020009, 0x00020401, 0x08020401,
0x00001008, 0x00101008, 0x00001108, 0x00101108, 0x00020409, 0x08020409, 0x02000000, 0x0A000000, 0x02000008, 0x0A000008,
0x04000000, 0x04100000, 0x04000100, 0x04100100, 0x02000400, 0x0A000400, 0x02000408, 0x0A000408, 0x02020000, 0x0A020000,
0x04000008, 0x04100008, 0x04000108, 0x04100108, 0x02020008, 0x0A020008, 0x02020400, 0x0A020400, 0x02020408, 0x0A020408,
0x04001000, 0x04101000, 0x04001100, 0x04101100, 0x02000001, 0x0A000001, 0x02000009, 0x0A000009, 0x02000401, 0x0A000401,
0x04001008, 0x04101008, 0x04001108, 0x04101108, 0x02000409, 0x0A000409, 0x02020001, 0x0A020001, 0x02020009, 0x0A020009,
0x00020000, 0x00120000, 0x00020100, 0x00120100, 0x02020401, 0x0A020401, 0x02020409, 0x0A020409,],
0x00020008, 0x00120008, 0x00020108, 0x00120108, [/* for D bits (numbered as per FIPS 46) 16 17 18 19 20 21 */
0x00021000, 0x00121000, 0x00021100, 0x00121100, 0x00000000, 0x00000100, 0x00080000, 0x00080100, 0x01000000, 0x01000100,
0x00021008, 0x00121008, 0x00021108, 0x00121108, 0x01080000, 0x01080100, 0x00000010, 0x00000110, 0x00080010, 0x00080110,
0x04020000, 0x04120000, 0x04020100, 0x04120100, 0x01000010, 0x01000110, 0x01080010, 0x01080110, 0x00200000, 0x00200100,
0x04020008, 0x04120008, 0x04020108, 0x04120108, 0x00280000, 0x00280100, 0x01200000, 0x01200100, 0x01280000, 0x01280100,
0x04021000, 0x04121000, 0x04021100, 0x04121100, 0x00200010, 0x00200110, 0x00280010, 0x00280110, 0x01200010, 0x01200110,
0x04021008, 0x04121008, 0x04021108, 0x04121108, 0x01280010, 0x01280110, 0x00000200, 0x00000300, 0x00080200, 0x00080300,
], 0x01000200, 0x01000300, 0x01080200, 0x01080300, 0x00000210, 0x00000310,
[ 0x00080210, 0x00080310, 0x01000210, 0x01000310, 0x01080210, 0x01080310,
/* for D bits (numbered as per FIPS 46) 1 2 3 4 5 6 */ 0x00200200, 0x00200300, 0x00280200, 0x00280300, 0x01200200, 0x01200300,
0x00000000, 0x10000000, 0x00010000, 0x10010000, 0x01280200, 0x01280300, 0x00200210, 0x00200310, 0x00280210, 0x00280310,
0x00000004, 0x10000004, 0x00010004, 0x10010004, 0x01200210, 0x01200310, 0x01280210, 0x01280310,],
0x20000000, 0x30000000, 0x20010000, 0x30010000, [/* for D bits (numbered as per FIPS 46) 22 23 24 25 27 28 */
0x20000004, 0x30000004, 0x20010004, 0x30010004, 0x00000000, 0x04000000, 0x00040000, 0x04040000, 0x00000002, 0x04000002,
0x00100000, 0x10100000, 0x00110000, 0x10110000, 0x00040002, 0x04040002, 0x00002000, 0x04002000, 0x00042000, 0x04042000,
0x00100004, 0x10100004, 0x00110004, 0x10110004, 0x00002002, 0x04002002, 0x00042002, 0x04042002, 0x00000020, 0x04000020,
0x20100000, 0x30100000, 0x20110000, 0x30110000, 0x00040020, 0x04040020, 0x00000022, 0x04000022, 0x00040022, 0x04040022,
0x20100004, 0x30100004, 0x20110004, 0x30110004, 0x00002020, 0x04002020, 0x00042020, 0x04042020, 0x00002022, 0x04002022,
0x00001000, 0x10001000, 0x00011000, 0x10011000, 0x00042022, 0x04042022, 0x00000800, 0x04000800, 0x00040800, 0x04040800,
0x00001004, 0x10001004, 0x00011004, 0x10011004, 0x00000802, 0x04000802, 0x00040802, 0x04040802, 0x00002800, 0x04002800,
0x20001000, 0x30001000, 0x20011000, 0x30011000, 0x00042800, 0x04042800, 0x00002802, 0x04002802, 0x00042802, 0x04042802,
0x20001004, 0x30001004, 0x20011004, 0x30011004, 0x00000820, 0x04000820, 0x00040820, 0x04040820, 0x00000822, 0x04000822,
0x00101000, 0x10101000, 0x00111000, 0x10111000, 0x00040822, 0x04040822, 0x00002820, 0x04002820, 0x00042820, 0x04042820,
0x00101004, 0x10101004, 0x00111004, 0x10111004, 0x00002822, 0x04002822, 0x00042822, 0x04042822,],];
0x20101000, 0x30101000, 0x20111000, 0x30111000,
0x20101004, 0x30101004, 0x20111004, 0x30111004, this.SPtrans = [[/* nibble 0 */
], 0x00820200, 0x00020000, 0x80800000, 0x80820200, 0x00800000, 0x80020200,
[ 0x80020000, 0x80800000, 0x80020200, 0x00820200, 0x00820000, 0x80000200,
/* for D bits (numbered as per FIPS 46) 8 9 11 12 13 14 */ 0x80800200, 0x00800000, 0x00000000, 0x80020000, 0x00020000, 0x80000000,
0x00000000, 0x08000000, 0x00000008, 0x08000008, 0x00800200, 0x00020200, 0x80820200, 0x00820000, 0x80000200, 0x00800200,
0x00000400, 0x08000400, 0x00000408, 0x08000408, 0x80000000, 0x00000200, 0x00020200, 0x80820000, 0x00000200, 0x80800200,
0x00020000, 0x08020000, 0x00020008, 0x08020008, 0x80820000, 0x00000000, 0x00000000, 0x80820200, 0x00800200, 0x80020000,
0x00020400, 0x08020400, 0x00020408, 0x08020408, 0x00820200, 0x00020000, 0x80000200, 0x00800200, 0x80820000, 0x00000200,
0x00000001, 0x08000001, 0x00000009, 0x08000009, 0x00020200, 0x80800000, 0x80020200, 0x80000000, 0x80800000, 0x00820000,
0x00000401, 0x08000401, 0x00000409, 0x08000409, 0x80820200, 0x00020200, 0x00820000, 0x80800200, 0x00800000, 0x80000200,
0x00020001, 0x08020001, 0x00020009, 0x08020009, 0x80020000, 0x00000000, 0x00020000, 0x00800000, 0x80800200, 0x00820200,
0x00020401, 0x08020401, 0x00020409, 0x08020409, 0x80000000, 0x80820000, 0x00000200, 0x80020200,], [/* nibble 1 */
0x02000000, 0x0A000000, 0x02000008, 0x0A000008, 0x10042004, 0x00000000, 0x00042000, 0x10040000, 0x10000004, 0x00002004,
0x02000400, 0x0A000400, 0x02000408, 0x0A000408, 0x10002000, 0x00042000, 0x00002000, 0x10040004, 0x00000004, 0x10002000,
0x02020000, 0x0A020000, 0x02020008, 0x0A020008, 0x00040004, 0x10042000, 0x10040000, 0x00000004, 0x00040000, 0x10002004,
0x02020400, 0x0A020400, 0x02020408, 0x0A020408, 0x10040004, 0x00002000, 0x00042004, 0x10000000, 0x00000000, 0x00040004,
0x02000001, 0x0A000001, 0x02000009, 0x0A000009, 0x10002004, 0x00042004, 0x10042000, 0x10000004, 0x10000000, 0x00040000,
0x02000401, 0x0A000401, 0x02000409, 0x0A000409, 0x00002004, 0x10042004, 0x00040004, 0x10042000, 0x10002000, 0x00042004,
0x02020001, 0x0A020001, 0x02020009, 0x0A020009, 0x10042004, 0x00040004, 0x10000004, 0x00000000, 0x10000000, 0x00002004,
0x02020401, 0x0A020401, 0x02020409, 0x0A020409, 0x00040000, 0x10040004, 0x00002000, 0x10000000, 0x00042004, 0x10002004,
], 0x10042000, 0x00002000, 0x00000000, 0x10000004, 0x00000004, 0x10042004,
[ 0x00042000, 0x10040000, 0x10040004, 0x00040000, 0x00002004, 0x10002000,
/* for D bits (numbered as per FIPS 46) 16 17 18 19 20 21 */ 0x10002004, 0x00000004, 0x10040000, 0x00042000,], [/* nibble 2 */
0x00000000, 0x00000100, 0x00080000, 0x00080100, 0x41000000, 0x01010040, 0x00000040, 0x41000040, 0x40010000, 0x01000000,
0x01000000, 0x01000100, 0x01080000, 0x01080100, 0x41000040, 0x00010040, 0x01000040, 0x00010000, 0x01010000, 0x40000000,
0x00000010, 0x00000110, 0x00080010, 0x00080110, 0x41010040, 0x40000040, 0x40000000, 0x41010000, 0x00000000, 0x40010000,
0x01000010, 0x01000110, 0x01080010, 0x01080110, 0x01010040, 0x00000040, 0x40000040, 0x41010040, 0x00010000, 0x41000000,
0x00200000, 0x00200100, 0x00280000, 0x00280100, 0x41010000, 0x01000040, 0x40010040, 0x01010000, 0x00010040, 0x00000000,
0x01200000, 0x01200100, 0x01280000, 0x01280100, 0x01000000, 0x40010040, 0x01010040, 0x00000040, 0x40000000, 0x00010000,
0x00200010, 0x00200110, 0x00280010, 0x00280110, 0x40000040, 0x40010000, 0x01010000, 0x41000040, 0x00000000, 0x01010040,
0x01200010, 0x01200110, 0x01280010, 0x01280110, 0x00010040, 0x41010000, 0x40010000, 0x01000000, 0x41010040, 0x40000000,
0x00000200, 0x00000300, 0x00080200, 0x00080300, 0x40010040, 0x41000000, 0x01000000, 0x41010040, 0x00010000, 0x01000040,
0x01000200, 0x01000300, 0x01080200, 0x01080300, 0x41000040, 0x00010040, 0x01000040, 0x00000000, 0x41010000, 0x40000040,
0x00000210, 0x00000310, 0x00080210, 0x00080310, 0x41000000, 0x40010040, 0x00000040, 0x01010000,], [/* nibble 3 */
0x01000210, 0x01000310, 0x01080210, 0x01080310, 0x00100402, 0x04000400, 0x00000002, 0x04100402, 0x00000000, 0x04100000,
0x00200200, 0x00200300, 0x00280200, 0x00280300, 0x04000402, 0x00100002, 0x04100400, 0x04000002, 0x04000000, 0x00000402,
0x01200200, 0x01200300, 0x01280200, 0x01280300, 0x04000002, 0x00100402, 0x00100000, 0x04000000, 0x04100002, 0x00100400,
0x00200210, 0x00200310, 0x00280210, 0x00280310, 0x00000400, 0x00000002, 0x00100400, 0x04000402, 0x04100000, 0x00000400,
0x01200210, 0x01200310, 0x01280210, 0x01280310, 0x00000402, 0x00000000, 0x00100002, 0x04100400, 0x04000400, 0x04100002,
], 0x04100402, 0x00100000, 0x04100002, 0x00000402, 0x00100000, 0x04000002,
[ 0x00100400, 0x04000400, 0x00000002, 0x04100000, 0x04000402, 0x00000000,
/* for D bits (numbered as per FIPS 46) 22 23 24 25 27 28 */ 0x00000400, 0x00100002, 0x00000000, 0x04100002, 0x04100400, 0x00000400,
0x00000000, 0x04000000, 0x00040000, 0x04040000, 0x04000000, 0x04100402, 0x00100402, 0x00100000, 0x04100402, 0x00000002,
0x00000002, 0x04000002, 0x00040002, 0x04040002, 0x04000400, 0x00100402, 0x00100002, 0x00100400, 0x04100000, 0x04000402,
0x00002000, 0x04002000, 0x00042000, 0x04042000, 0x00000402, 0x04000000, 0x04000002, 0x04100400,], [/* nibble 4 */
0x00002002, 0x04002002, 0x00042002, 0x04042002, 0x02000000, 0x00004000, 0x00000100, 0x02004108, 0x02004008, 0x02000100,
0x00000020, 0x04000020, 0x00040020, 0x04040020, 0x00004108, 0x02004000, 0x00004000, 0x00000008, 0x02000008, 0x00004100,
0x00000022, 0x04000022, 0x00040022, 0x04040022, 0x02000108, 0x02004008, 0x02004100, 0x00000000, 0x00004100, 0x02000000,
0x00002020, 0x04002020, 0x00042020, 0x04042020, 0x00004008, 0x00000108, 0x02000100, 0x00004108, 0x00000000, 0x02000008,
0x00002022, 0x04002022, 0x00042022, 0x04042022, 0x00000008, 0x02000108, 0x02004108, 0x00004008, 0x02004000, 0x00000100,
0x00000800, 0x04000800, 0x00040800, 0x04040800, 0x00000108, 0x02004100, 0x02004100, 0x02000108, 0x00004008, 0x02004000,
0x00000802, 0x04000802, 0x00040802, 0x04040802, 0x00004000, 0x00000008, 0x02000008, 0x02000100, 0x02000000, 0x00004100,
0x00002800, 0x04002800, 0x00042800, 0x04042800, 0x02004108, 0x00000000, 0x00004108, 0x02000000, 0x00000100, 0x00004008,
0x00002802, 0x04002802, 0x00042802, 0x04042802, 0x02000108, 0x00000100, 0x00000000, 0x02004108, 0x02004008, 0x02004100,
0x00000820, 0x04000820, 0x00040820, 0x04040820, 0x00000108, 0x00004000, 0x00004100, 0x02004008, 0x02000100, 0x00000108,
0x00000822, 0x04000822, 0x00040822, 0x04040822, 0x00000008, 0x00004108, 0x02004000, 0x02000008,], [/* nibble 5 */
0x00002820, 0x04002820, 0x00042820, 0x04042820, 0x20000010, 0x00080010, 0x00000000, 0x20080800, 0x00080010, 0x00000800,
0x00002822, 0x04002822, 0x00042822, 0x04042822, 0x20000810, 0x00080000, 0x00000810, 0x20080810, 0x00080800, 0x20000000,
], 0x20000800, 0x20000010, 0x20080000, 0x00080810, 0x00080000, 0x20000810,
]; 0x20080010, 0x00000000, 0x00000800, 0x00000010, 0x20080800, 0x20080010,
0x20080810, 0x20080000, 0x20000000, 0x00000810, 0x00000010, 0x00080800,
this.SPtrans = 0x00080810, 0x20000800, 0x00000810, 0x20000000, 0x20000800, 0x00080810,
[ 0x20080800, 0x00080010, 0x00000000, 0x20000800, 0x20000000, 0x00000800,
[ 0x20080010, 0x00080000, 0x00080010, 0x20080810, 0x00080800, 0x00000010,
/* nibble 0 */ 0x20080810, 0x00080800, 0x00080000, 0x20000810, 0x20000010, 0x20080000,
0x00820200, 0x00020000, 0x80800000, 0x80820200, 0x00080810, 0x00000000, 0x00000800, 0x20000010, 0x20000810, 0x20080800,
0x00800000, 0x80020200, 0x80020000, 0x80800000, 0x20080000, 0x00000810, 0x00000010, 0x20080010,], [/* nibble 6 */
0x80020200, 0x00820200, 0x00820000, 0x80000200, 0x00001000, 0x00000080, 0x00400080, 0x00400001, 0x00401081, 0x00001001,
0x80800200, 0x00800000, 0x00000000, 0x80020000, 0x00001080, 0x00000000, 0x00400000, 0x00400081, 0x00000081, 0x00401000,
0x00020000, 0x80000000, 0x00800200, 0x00020200, 0x00000001, 0x00401080, 0x00401000, 0x00000081, 0x00400081, 0x00001000,
0x80820200, 0x00820000, 0x80000200, 0x00800200, 0x00001001, 0x00401081, 0x00000000, 0x00400080, 0x00400001, 0x00001080,
0x80000000, 0x00000200, 0x00020200, 0x80820000, 0x00401001, 0x00001081, 0x00401080, 0x00000001, 0x00001081, 0x00401001,
0x00000200, 0x80800200, 0x80820000, 0x00000000, 0x00000080, 0x00400000, 0x00001081, 0x00401000, 0x00401001, 0x00000081,
0x00000000, 0x80820200, 0x00800200, 0x80020000, 0x00001000, 0x00000080, 0x00400000, 0x00401001, 0x00400081, 0x00001081,
0x00820200, 0x00020000, 0x80000200, 0x00800200, 0x00001080, 0x00000000, 0x00000080, 0x00400001, 0x00000001, 0x00400080,
0x80820000, 0x00000200, 0x00020200, 0x80800000, 0x00000000, 0x00400081, 0x00400080, 0x00001080, 0x00000081, 0x00001000,
0x80020200, 0x80000000, 0x80800000, 0x00820000, 0x00401081, 0x00400000, 0x00401080, 0x00000001, 0x00001001, 0x00401081,
0x80820200, 0x00020200, 0x00820000, 0x80800200, 0x00400001, 0x00401080, 0x00401000, 0x00001001,], [/* nibble 7 */
0x00800000, 0x80000200, 0x80020000, 0x00000000, 0x08200020, 0x08208000, 0x00008020, 0x00000000, 0x08008000, 0x00200020,
0x00020000, 0x00800000, 0x80800200, 0x00820200, 0x08200000, 0x08208020, 0x00000020, 0x08000000, 0x00208000, 0x00008020,
0x80000000, 0x80820000, 0x00000200, 0x80020200, 0x00208020, 0x08008020, 0x08000020, 0x08200000, 0x00008000, 0x00208020,
], 0x00200020, 0x08008000, 0x08208020, 0x08000020, 0x00000000, 0x00208000,
[ 0x08000000, 0x00200000, 0x08008020, 0x08200020, 0x00200000, 0x00008000,
/* nibble 1 */ 0x08208000, 0x00000020, 0x00200000, 0x00008000, 0x08000020, 0x08208020,
0x10042004, 0x00000000, 0x00042000, 0x10040000, 0x00008020, 0x08000000, 0x00000000, 0x00208000, 0x08200020, 0x08008020,
0x10000004, 0x00002004, 0x10002000, 0x00042000, 0x08008000, 0x00200020, 0x08208000, 0x00000020, 0x00200020, 0x08008000,
0x00002000, 0x10040004, 0x00000004, 0x10002000, 0x08208020, 0x00200000, 0x08200000, 0x08000020, 0x00208000, 0x00008020,
0x00040004, 0x10042000, 0x10040000, 0x00000004, 0x08008020, 0x08200000, 0x00000020, 0x08208000, 0x00208020, 0x00000000,
0x00040000, 0x10002004, 0x10040004, 0x00002000, 0x08000000, 0x08200020, 0x00008000, 0x00208020]];
0x00042004, 0x10000000, 0x00000000, 0x00040004,
0x10002004, 0x00042004, 0x10042000, 0x10000004,
0x10000000, 0x00040000, 0x00002004, 0x10042004,
0x00040004, 0x10042000, 0x10002000, 0x00042004,
0x10042004, 0x00040004, 0x10000004, 0x00000000,
0x10000000, 0x00002004, 0x00040000, 0x10040004,
0x00002000, 0x10000000, 0x00042004, 0x10002004,
0x10042000, 0x00002000, 0x00000000, 0x10000004,
0x00000004, 0x10042004, 0x00042000, 0x10040000,
0x10040004, 0x00040000, 0x00002004, 0x10002000,
0x10002004, 0x00000004, 0x10040000, 0x00042000,
],
[
/* nibble 2 */
0x41000000, 0x01010040, 0x00000040, 0x41000040,
0x40010000, 0x01000000, 0x41000040, 0x00010040,
0x01000040, 0x00010000, 0x01010000, 0x40000000,
0x41010040, 0x40000040, 0x40000000, 0x41010000,
0x00000000, 0x40010000, 0x01010040, 0x00000040,
0x40000040, 0x41010040, 0x00010000, 0x41000000,
0x41010000, 0x01000040, 0x40010040, 0x01010000,
0x00010040, 0x00000000, 0x01000000, 0x40010040,
0x01010040, 0x00000040, 0x40000000, 0x00010000,
0x40000040, 0x40010000, 0x01010000, 0x41000040,
0x00000000, 0x01010040, 0x00010040, 0x41010000,
0x40010000, 0x01000000, 0x41010040, 0x40000000,
0x40010040, 0x41000000, 0x01000000, 0x41010040,
0x00010000, 0x01000040, 0x41000040, 0x00010040,
0x01000040, 0x00000000, 0x41010000, 0x40000040,
0x41000000, 0x40010040, 0x00000040, 0x01010000,
],
[
/* nibble 3 */
0x00100402, 0x04000400, 0x00000002, 0x04100402,
0x00000000, 0x04100000, 0x04000402, 0x00100002,
0x04100400, 0x04000002, 0x04000000, 0x00000402,
0x04000002, 0x00100402, 0x00100000, 0x04000000,
0x04100002, 0x00100400, 0x00000400, 0x00000002,
0x00100400, 0x04000402, 0x04100000, 0x00000400,
0x00000402, 0x00000000, 0x00100002, 0x04100400,
0x04000400, 0x04100002, 0x04100402, 0x00100000,
0x04100002, 0x00000402, 0x00100000, 0x04000002,
0x00100400, 0x04000400, 0x00000002, 0x04100000,
0x04000402, 0x00000000, 0x00000400, 0x00100002,
0x00000000, 0x04100002, 0x04100400, 0x00000400,
0x04000000, 0x04100402, 0x00100402, 0x00100000,
0x04100402, 0x00000002, 0x04000400, 0x00100402,
0x00100002, 0x00100400, 0x04100000, 0x04000402,
0x00000402, 0x04000000, 0x04000002, 0x04100400,
],
[
/* nibble 4 */
0x02000000, 0x00004000, 0x00000100, 0x02004108,
0x02004008, 0x02000100, 0x00004108, 0x02004000,
0x00004000, 0x00000008, 0x02000008, 0x00004100,
0x02000108, 0x02004008, 0x02004100, 0x00000000,
0x00004100, 0x02000000, 0x00004008, 0x00000108,
0x02000100, 0x00004108, 0x00000000, 0x02000008,
0x00000008, 0x02000108, 0x02004108, 0x00004008,
0x02004000, 0x00000100, 0x00000108, 0x02004100,
0x02004100, 0x02000108, 0x00004008, 0x02004000,
0x00004000, 0x00000008, 0x02000008, 0x02000100,
0x02000000, 0x00004100, 0x02004108, 0x00000000,
0x00004108, 0x02000000, 0x00000100, 0x00004008,
0x02000108, 0x00000100, 0x00000000, 0x02004108,
0x02004008, 0x02004100, 0x00000108, 0x00004000,
0x00004100, 0x02004008, 0x02000100, 0x00000108,
0x00000008, 0x00004108, 0x02004000, 0x02000008,
],
[
/* nibble 5 */
0x20000010, 0x00080010, 0x00000000, 0x20080800,
0x00080010, 0x00000800, 0x20000810, 0x00080000,
0x00000810, 0x20080810, 0x00080800, 0x20000000,
0x20000800, 0x20000010, 0x20080000, 0x00080810,
0x00080000, 0x20000810, 0x20080010, 0x00000000,
0x00000800, 0x00000010, 0x20080800, 0x20080010,
0x20080810, 0x20080000, 0x20000000, 0x00000810,
0x00000010, 0x00080800, 0x00080810, 0x20000800,
0x00000810, 0x20000000, 0x20000800, 0x00080810,
0x20080800, 0x00080010, 0x00000000, 0x20000800,
0x20000000, 0x00000800, 0x20080010, 0x00080000,
0x00080010, 0x20080810, 0x00080800, 0x00000010,
0x20080810, 0x00080800, 0x00080000, 0x20000810,
0x20000010, 0x20080000, 0x00080810, 0x00000000,
0x00000800, 0x20000010, 0x20000810, 0x20080800,
0x20080000, 0x00000810, 0x00000010, 0x20080010,
],
[
/* nibble 6 */
0x00001000, 0x00000080, 0x00400080, 0x00400001,
0x00401081, 0x00001001, 0x00001080, 0x00000000,
0x00400000, 0x00400081, 0x00000081, 0x00401000,
0x00000001, 0x00401080, 0x00401000, 0x00000081,
0x00400081, 0x00001000, 0x00001001, 0x00401081,
0x00000000, 0x00400080, 0x00400001, 0x00001080,
0x00401001, 0x00001081, 0x00401080, 0x00000001,
0x00001081, 0x00401001, 0x00000080, 0x00400000,
0x00001081, 0x00401000, 0x00401001, 0x00000081,
0x00001000, 0x00000080, 0x00400000, 0x00401001,
0x00400081, 0x00001081, 0x00001080, 0x00000000,
0x00000080, 0x00400001, 0x00000001, 0x00400080,
0x00000000, 0x00400081, 0x00400080, 0x00001080,
0x00000081, 0x00001000, 0x00401081, 0x00400000,
0x00401080, 0x00000001, 0x00001001, 0x00401081,
0x00400001, 0x00401080, 0x00401000, 0x00001001,
],
[
/* nibble 7 */
0x08200020, 0x08208000, 0x00008020, 0x00000000,
0x08008000, 0x00200020, 0x08200000, 0x08208020,
0x00000020, 0x08000000, 0x00208000, 0x00008020,
0x00208020, 0x08008020, 0x08000020, 0x08200000,
0x00008000, 0x00208020, 0x00200020, 0x08008000,
0x08208020, 0x08000020, 0x00000000, 0x00208000,
0x08000000, 0x00200000, 0x08008020, 0x08200020,
0x00200000, 0x00008000, 0x08208000, 0x00000020,
0x00200000, 0x00008000, 0x08000020, 0x08208020,
0x00008020, 0x08000000, 0x00000000, 0x00208000,
0x08200020, 0x08008020, 0x08008000, 0x00200020,
0x08208000, 0x00000020, 0x00200020, 0x08008000,
0x08208020, 0x00200000, 0x08200000, 0x08000020,
0x00208000, 0x00008020, 0x08008020, 0x08200000,
0x00000020, 0x08208000, 0x00208020, 0x00000000,
0x08000000, 0x08200020, 0x00008000, 0x00208020
]
];
this.cov_2char = this.cov_2char =
[ [0x2E, 0x2F, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39,
0x2E, 0x2F, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C,
0x36, 0x37, 0x38, 0x39, 0x41, 0x42, 0x43, 0x44, 0x4D, 0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x59, 0x5A, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A,
0x4D, 0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53, 0x54, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76,
0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x61, 0x62, 0x77, 0x78, 0x79, 0x7A];
0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A,
0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70, 0x71, 0x72,
0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A
];
this.byteToUnsigned = function (b) { this.byteToUnsigned = function (b) {
var value = Math.floor(b); var value = Math.floor(b);
...@@ -429,8 +291,9 @@ function JopCrypt() { ...@@ -429,8 +291,9 @@ function JopCrypt() {
d = results[0]; d = results[0];
c = results[1]; c = results[1];
d = (((d & 0x000000ff) << 16) | (d & 0x0000ff00) | d =
((d & 0x00ff0000) >>> 16) | ((c & 0xf0000000) >>> 4)); (((d & 0x000000ff) << 16) | (d & 0x0000ff00) | ((d & 0x00ff0000) >>> 16) |
((c & 0xf0000000) >>> 4));
c &= 0x0fffffff; c &= 0x0fffffff;
var s, t; var s, t;
...@@ -440,8 +303,7 @@ function JopCrypt() { ...@@ -440,8 +303,7 @@ function JopCrypt() {
if (this.shifts2[i]) { if (this.shifts2[i]) {
c = (c >>> 2) | (c << 26); c = (c >>> 2) | (c << 26);
d = (d >>> 2) | (d << 26); d = (d >>> 2) | (d << 26);
} } else {
else {
c = (c >>> 1) | (c << 27); c = (c >>> 1) | (c << 27);
d = (d >>> 1) | (d << 27); d = (d >>> 1) | (d << 27);
} }
...@@ -479,14 +341,10 @@ function JopCrypt() { ...@@ -479,14 +341,10 @@ function JopCrypt() {
t = (v ^ (v << 16)) ^ R ^ s[S + 1]; t = (v ^ (v << 16)) ^ R ^ s[S + 1];
t = (t >>> 4) | (t << 28); t = (t >>> 4) | (t << 28);
L ^= this.SPtrans[1][(t) & 0x3f] | L ^= this.SPtrans[1][(t) & 0x3f] | this.SPtrans[3][(t >>> 8) & 0x3f] |
this.SPtrans[3][(t >>> 8) & 0x3f] | this.SPtrans[5][(t >>> 16) & 0x3f] | this.SPtrans[7][(t >>> 24) & 0x3f] |
this.SPtrans[5][(t >>> 16) & 0x3f] | this.SPtrans[0][(u) & 0x3f] | this.SPtrans[2][(u >>> 8) & 0x3f] |
this.SPtrans[7][(t >>> 24) & 0x3f] | this.SPtrans[4][(u >>> 16) & 0x3f] | this.SPtrans[6][(u >>> 24) & 0x3f];
this.SPtrans[0][(u) & 0x3f] |
this.SPtrans[2][(u >>> 8) & 0x3f] |
this.SPtrans[4][(u >>> 16) & 0x3f] |
this.SPtrans[6][(u >>> 24) & 0x3f];
return L; return L;
} }
...@@ -545,8 +403,9 @@ function JopCrypt() { ...@@ -545,8 +403,9 @@ function JopCrypt() {
} }
this.crypt = function (salt, original) { this.crypt = function (salt, original) {
while (salt.length < 2) while (salt.length < 2) {
salt += "A"; salt += "A";
}
var buffer; var buffer;
var charZero = salt.charAt(0) + ''; var charZero = salt.charAt(0) + '';
...@@ -582,8 +441,9 @@ function JopCrypt() { ...@@ -582,8 +441,9 @@ function JopCrypt() {
for (var j = 0, c = 0; j < 6; j++) { for (var j = 0, c = 0; j < 6; j++) {
c <<= 1; c <<= 1;
if ((b[y] & u) != 0) if ((b[y] & u) != 0) {
c |= 1; c |= 1;
}
u >>>= 1; u >>>= 1;
...@@ -591,7 +451,8 @@ function JopCrypt() { ...@@ -591,7 +451,8 @@ function JopCrypt() {
y++; y++;
u = 0x80; u = 0x80;
} }
buffer = buffer.substring(0, i) + String.fromCharCode(this.cov_2char[c]) + buffer =
buffer.substring(0, i) + String.fromCharCode(this.cov_2char[c]) +
buffer.substring(i + 1, buffer.length); buffer.substring(i + 1, buffer.length);
} }
} }
......
"use strict"; "use strict";
/** Start OpWind **/
function OpWindMenu() { function OpWindMenu() {
this.gdh = 0; this.gdh = 0;
this.buttons = null; this.buttons = null;
...@@ -14,8 +12,9 @@ function OpWindMenu() { ...@@ -14,8 +12,9 @@ function OpWindMenu() {
this.init = function () { this.init = function () {
this.host = window.location.hostname; this.host = window.location.hostname;
if (this.host == "") if (this.host == "") {
this.host = "localhost"; this.host = "localhost";
}
this.gdh = new Gdh(); this.gdh = new Gdh();
this.gdh.open_cb = this.gdh_init_cb; this.gdh.open_cb = this.gdh_init_cb;
...@@ -48,7 +47,8 @@ function OpWindMenu() { ...@@ -48,7 +47,8 @@ function OpWindMenu() {
button.type = "button"; button.type = "button";
button.className = "leftmenu-button"; button.className = "leftmenu-button";
button.value = text; button.value = text;
button.addEventListener('click', new Function("menu.button_cb(\"" + button.value + "\")")); button.addEventListener('click',
new Function("menu.button_cb(\"" + button.value + "\")"));
context.appendChild(button); context.appendChild(button);
context.appendChild(document.createElement("br")); context.appendChild(document.createElement("br"));
return button; return button;
...@@ -67,24 +67,27 @@ function OpWindMenu() { ...@@ -67,24 +67,27 @@ function OpWindMenu() {
context.appendChild(self.user_text); context.appendChild(self.user_text);
context.appendChild(document.createElement("hr")); context.appendChild(document.createElement("hr"));
document.getElementById("login_button").addEventListener("click", function (event) { document.getElementById("login_button")
if (document.getElementById("login_frame").style.visibility == 'hidden') { .addEventListener("click", function (event) {
if (document.getElementById("login_frame").style.visibility ==
'hidden') {
document.getElementById("login_user").value = ""; document.getElementById("login_user").value = "";
document.getElementById("login_passw").value = ""; document.getElementById("login_passw").value = "";
document.getElementById("login_frame").style.visibility = 'visible'; document.getElementById("login_frame").style.visibility = 'visible';
document.getElementById("login_frame").style.height = '120px'; document.getElementById("login_frame").style.height = '120px';
document.getElementById("login_user").focus(); document.getElementById("login_user").focus();
} } else {
else {
document.getElementById("login_frame").style.visibility = 'hidden'; document.getElementById("login_frame").style.visibility = 'hidden';
document.getElementById("login_frame").style.height = '0px'; document.getElementById("login_frame").style.height = '0px';
} }
}); });
document.getElementById("apply_button").addEventListener("click", function (event) { document.getElementById("apply_button")
.addEventListener("click", function (event) {
var user = document.getElementById("login_user").value; var user = document.getElementById("login_user").value;
var passwd = document.getElementById("login_passw").value; var passwd = document.getElementById("login_passw").value;
if (user.trim() == "") if (user.trim() == "") {
return; return;
}
document.getElementById("login_frame").style.visibility = 'hidden'; document.getElementById("login_frame").style.visibility = 'hidden';
document.getElementById("login_frame").style.height = '0px'; document.getElementById("login_frame").style.height = '0px';
var c = new JopCrypt(); var c = new JopCrypt();
...@@ -93,11 +96,13 @@ function OpWindMenu() { ...@@ -93,11 +96,13 @@ function OpWindMenu() {
self.user = user; self.user = user;
self.gdh.login(user, passwd, self.login_cb, self); self.gdh.login(user, passwd, self.login_cb, self);
}); });
document.getElementById("cancel_button").addEventListener("click", function (event) { document.getElementById("cancel_button")
.addEventListener("click", function (event) {
document.getElementById("login_frame").style.visibility = 'hidden'; document.getElementById("login_frame").style.visibility = 'hidden';
document.getElementById("login_frame").style.height = '0px'; document.getElementById("login_frame").style.height = '0px';
}); });
document.getElementById("logout_button").addEventListener("click", function (event) { document.getElementById("logout_button")
.addEventListener("click", function (event) {
document.getElementById("login_frame").style.visibility = 'hidden'; document.getElementById("login_frame").style.visibility = 'hidden';
document.getElementById("login_frame").style.height = '0px'; document.getElementById("login_frame").style.height = '0px';
self.priv = 0; self.priv = 0;
...@@ -110,25 +115,29 @@ function OpWindMenu() { ...@@ -110,25 +115,29 @@ function OpWindMenu() {
//document.getElementById("login_frame").setAttribute("style", "visibility:hidden;height:10px"; //document.getElementById("login_frame").setAttribute("style", "visibility:hidden;height:10px";
document.getElementById("login_frame").style.visibility = 'hidden'; document.getElementById("login_frame").style.visibility = 'hidden';
document.getElementById("login_frame").style.height = '0px'; document.getElementById("login_frame").style.height = '0px';
} } else {
else {
document.getElementById("login_button").remove(); document.getElementById("login_button").remove();
document.getElementById("login_frame").remove(); document.getElementById("login_frame").remove();
} }
if (result.enable_language) if (result.enable_language) {
self.add_menu_button(context, "Language"); self.add_menu_button(context, "Language");
}
if (result.enable_alarmlist) { if (result.enable_alarmlist) {
self.add_menu_button(context, "AlarmList"); self.add_menu_button(context, "AlarmList");
self.add_menu_button(context, "EventList"); self.add_menu_button(context, "EventList");
} }
if (result.enable_eventlog) if (result.enable_eventlog) {
self.add_menu_button(context, "EventLog"); self.add_menu_button(context, "EventLog");
if (result.enable_navigator) }
if (result.enable_navigator) {
self.add_menu_button(context, "Navigator"); self.add_menu_button(context, "Navigator");
if (!result.disable_help) }
if (!result.disable_help) {
self.add_menu_button(context, "Help"); self.add_menu_button(context, "Help");
if (!result.disable_proview) }
if (!result.disable_proview) {
self.add_menu_button(context, "ProviewR"); self.add_menu_button(context, "ProviewR");
}
context.appendChild(document.createElement("hr")); context.appendChild(document.createElement("hr"));
...@@ -143,69 +152,66 @@ function OpWindMenu() { ...@@ -143,69 +152,66 @@ function OpWindMenu() {
if (self.info.enable_language && text == "Language") { if (self.info.enable_language && text == "Language") {
console.log("Language activated"); console.log("Language activated");
} } else if (self.info.enable_alarmlist && text == "AlarmList") {
else if (self.info.enable_alarmlist && text == "AlarmList") {
console.log("AlarmList activated"); console.log("AlarmList activated");
if (!(self.is_authorized(Pwr.mAccess_RtRead | Pwr.mAccess_RtWrite | if (!(self.is_authorized(Pwr.mAccess_RtRead | Pwr.mAccess_RtWrite |
Pwr.mAccess_AllOperators | Pwr.mAccess_AllOperators | Pwr.mAccess_System |
Pwr.mAccess_System | Pwr.mAccess_Maintenance | Pwr.mAccess_Maintenance | Pwr.mAccess_Process |
Pwr.mAccess_Process | Pwr.mAccess_Instrument))) Pwr.mAccess_Instrument))) {
window.alert("Not authorized for this operation"); window.alert("Not authorized for this operation");
else } else {
window.open("ev.html?list=alarm", "_blank"); window.open("ev.html?list=alarm", "_blank");
} }
else if (self.info.enable_alarmlist && text == "EventList") { } else if (self.info.enable_alarmlist && text == "EventList") {
console.log("EventList activated"); console.log("EventList activated");
if (!(self.is_authorized(Pwr.mAccess_RtRead | Pwr.mAccess_RtWrite | if (!(self.is_authorized(Pwr.mAccess_RtRead | Pwr.mAccess_RtWrite |
Pwr.mAccess_AllOperators | Pwr.mAccess_AllOperators | Pwr.mAccess_System |
Pwr.mAccess_System | Pwr.mAccess_Maintenance | Pwr.mAccess_Maintenance | Pwr.mAccess_Process |
Pwr.mAccess_Process | Pwr.mAccess_Instrument))) Pwr.mAccess_Instrument))) {
window.alert("Not authorized for this operation"); window.alert("Not authorized for this operation");
else } else {
window.open("ev.html?list=event", "_blank"); window.open("ev.html?list=event", "_blank");
} }
else if (self.info.enable_eventlog && text == "EventLog") { } else if (self.info.enable_eventlog && text == "EventLog") {
console.log("EventLog activated"); console.log("EventLog activated");
if (!(self.is_authorized(Pwr.mAccess_RtRead | Pwr.mAccess_RtWrite | if (!(self.is_authorized(Pwr.mAccess_RtRead | Pwr.mAccess_RtWrite |
Pwr.mAccess_AllOperators | Pwr.mAccess_AllOperators | Pwr.mAccess_System |
Pwr.mAccess_System | Pwr.mAccess_Maintenance | Pwr.mAccess_Maintenance | Pwr.mAccess_Process |
Pwr.mAccess_Process | Pwr.mAccess_Instrument))) Pwr.mAccess_Instrument))) {
window.alert("Not authorized for this operation"); window.alert("Not authorized for this operation");
else } else {
window.alert("Not yet implemented"); window.alert("Not yet implemented");
} }
else if (self.info.enable_navigator && text == "Navigator") { } else if (self.info.enable_navigator && text == "Navigator") {
console.log("Navigator activated"); console.log("Navigator activated");
if (!(self.is_authorized(Pwr.mAccess_RtNavigator | if (!(self.is_authorized(Pwr.mAccess_RtNavigator | Pwr.mAccess_System |
Pwr.mAccess_System | Pwr.mAccess_Maintenance | Pwr.mAccess_Maintenance | Pwr.mAccess_Process |
Pwr.mAccess_Process | Pwr.mAccess_Instrument))) Pwr.mAccess_Instrument))) {
window.alert("Not authorized for this operation"); window.alert("Not authorized for this operation");
else } else {
window.open("xtt.html", "_blank"); window.open("xtt.html", "_blank");
} }
else if (!self.info.disable_help && text == "Help") { } else if (!self.info.disable_help && text == "Help") {
console.log("Help activated"); console.log("Help activated");
window.open("xtt_help_index.html", "_blank"); window.open("xtt_help_index.html", "_blank");
} } else if (!self.info.disable_proview && text == "ProviewR") {
else if (!self.info.disable_proview && text == "ProviewR") {
console.log("ProviewR activated"); console.log("ProviewR activated");
window.open("http://www.proview.se", "_blank"); window.open("http://www.proview.se", "_blank");
} } else {
else {
if (!(self.is_authorized(Pwr.mAccess_RtRead | Pwr.mAccess_RtWrite | if (!(self.is_authorized(Pwr.mAccess_RtRead | Pwr.mAccess_RtWrite |
Pwr.mAccess_AllOperators | Pwr.mAccess_AllOperators | Pwr.mAccess_System |
Pwr.mAccess_System | Pwr.mAccess_Maintenance | Pwr.mAccess_Maintenance | Pwr.mAccess_Process |
Pwr.mAccess_Process | Pwr.mAccess_Instrument))) Pwr.mAccess_Instrument))) {
window.alert("Not authorized for this operation"); window.alert("Not authorized for this operation");
else { } else {
for (var i = 0; i < self.info.buttons.length; i++) { for (var i = 0; i < self.info.buttons.length; i++) {
if (self.info.buttons[i].text == text) { if (self.info.buttons[i].text == text) {
console.log("Found", self.info.buttons[i].text); console.log("Found", self.info.buttons[i].text);
var name = self.info.buttons[i].name; var name = self.info.buttons[i].name;
var n = name.indexOf(".pwg"); var n = name.indexOf(".pwg");
if (n != -1) if (n != -1) {
name = name.substring(0, n); name = name.substring(0, n);
}
var url = "ge.html?graph=" + name; var url = "ge.html?graph=" + name;
console.log("url", url); console.log("url", url);
window.open(url, "_blank"); window.open(url, "_blank");
...@@ -221,25 +227,22 @@ function OpWindMenu() { ...@@ -221,25 +227,22 @@ function OpWindMenu() {
if (sts & 1) { if (sts & 1) {
self.priv = result; self.priv = result;
sessionStorage.setItem("pwr_privilege", self.priv); sessionStorage.setItem("pwr_privilege", self.priv);
if (self.user_text != null) if (self.user_text != null) {
self.user_text.textContent = self.user + " on " + self.host; self.user_text.textContent = self.user + " on " + self.host;
}
console.log("Login", self.user, "Priv", self.priv); console.log("Login", self.user, "Priv", self.priv);
} } else {
else {
self.priv = 0; self.priv = 0;
self.user = "none"; self.user = "none";
sessionStorage.setItem("pwr_privilege", self.priv); sessionStorage.setItem("pwr_privilege", self.priv);
if (self.user_text != null) if (self.user_text != null) {
self.user_text.textContent = "None on " + self.host; self.user_text.textContent = "None on " + self.host;
}
console.log("Login failure", "Priv", self.priv); console.log("Login failure", "Priv", self.priv);
} }
}; };
} }
var menu = new OpWindMenu(); var menu = new OpWindMenu();
menu.init(); menu.init();
/** End OpWind **/
...@@ -4,7 +4,6 @@ var GraphIfc = { ...@@ -4,7 +4,6 @@ var GraphIfc = {
eType_Bit: (1 << 15) + 1 eType_Bit: (1 << 15) + 1
}; };
/** Start Xtt **/
function XttOpenChildrenData(node, open_next) { function XttOpenChildrenData(node, open_next) {
this.node = node; this.node = node;
this.open_next = open_next; this.open_next = open_next;
...@@ -34,114 +33,130 @@ function Xtt() { ...@@ -34,114 +33,130 @@ function Xtt() {
this.ctx.gdraw.canvas.addEventListener("click", function (event) { this.ctx.gdraw.canvas.addEventListener("click", function (event) {
var y = event.pageY - self.ctx.gdraw.offset_top; var y = event.pageY - self.ctx.gdraw.offset_top;
var x = event.pageX; var x = event.pageX;
if (event.shiftKey) if (event.shiftKey) {
xtt.ctx.event_handler(Plow.eEvent_MB1ClickShift, x, y); xtt.ctx.event_handler(Plow.eEvent_MB1ClickShift, x, y);
else } else {
xtt.ctx.event_handler(Plow.eEvent_MB1Click, x, y); xtt.ctx.event_handler(Plow.eEvent_MB1Click, x, y);
}
}); });
document.addEventListener("keydown", function (event) { document.addEventListener("keydown", function (event) {
if (event.keyCode == 40) { if (event.keyCode == 40) {
self.ctx.event_handler(Plow.eEvent_Key_Down); self.ctx.event_handler(Plow.eEvent_Key_Down);
event.preventDefault(); event.preventDefault();
} } else if (event.keyCode == 39) {
else if (event.keyCode == 39) { if (event.shiftKey) {
if (event.shiftKey)
self.ctx.event_handler(Plow.eEvent_Key_ShiftRight); self.ctx.event_handler(Plow.eEvent_Key_ShiftRight);
else } else {
self.ctx.event_handler(Plow.eEvent_Key_Right); self.ctx.event_handler(Plow.eEvent_Key_Right);
event.preventDefault();
} }
else if (event.keyCode == 37) { event.preventDefault();
} else if (event.keyCode == 37) {
self.ctx.event_handler(Plow.eEvent_Key_Left); self.ctx.event_handler(Plow.eEvent_Key_Left);
event.preventDefault(); event.preventDefault();
} } else if (event.keyCode == 38) {
else if (event.keyCode == 38) {
self.ctx.event_handler(Plow.eEvent_Key_Up); self.ctx.event_handler(Plow.eEvent_Key_Up);
event.preventDefault(); event.preventDefault();
} } else if (event.keyCode == 82) {
else if (event.keyCode == 82) { if (event.ctrlKey) {
if (event.ctrlKey)
self.ctx.event_handler(Plow.eEvent_Key_CtrlR); self.ctx.event_handler(Plow.eEvent_Key_CtrlR);
event.preventDefault();
} }
else if (event.keyCode == 76) {
if (event.ctrlKey)
self.ctx.event_handler(Plow.eEvent_Key_CtrlL);
event.preventDefault(); event.preventDefault();
} else if (event.keyCode == 76) {
if (event.ctrlKey) {
self.ctx.event_handler(Plow.eEvent_Key_CtrlL);
} }
else if (event.keyCode == 71) { event.preventDefault();
if (event.ctrlKey) } else if (event.keyCode == 71) {
if (event.ctrlKey) {
self.ctx.event_handler(Plow.eEvent_Key_CtrlG); self.ctx.event_handler(Plow.eEvent_Key_CtrlG);
}
event.preventDefault(); event.preventDefault();
} }
}); });
document.getElementById("toolitem1").addEventListener("click", function (event) { document.getElementById("toolitem1")
.addEventListener("click", function (event) {
var o = self.ctx.get_select(); var o = self.ctx.get_select();
if (o.userdata instanceof XttItemObject) { if (o.userdata instanceof XttItemObject) {
var newwindow = window.open("", "_blank"); var newwindow = window.open("", "_blank");
self.ctx.gdh.getObject(o.userdata.objid, GdhOp.GET_OP_METHOD_GRAPH, self.open_graph_cb, newwindow); self.ctx.gdh.getObject(o.userdata.objid, GdhOp.GET_OP_METHOD_GRAPH,
self.open_graph_cb, newwindow);
} }
console.log("toolitem1 event"); console.log("toolitem1 event");
}); });
document.getElementById("toolitem2").addEventListener("click", function (event) { document.getElementById("toolitem2")
.addEventListener("click", function (event) {
var o = self.ctx.get_select(); var o = self.ctx.get_select();
if (o.userdata instanceof XttItemObject) { if (o.userdata instanceof XttItemObject) {
var newwindow = window.open("", "_blank"); var newwindow = window.open("", "_blank");
self.ctx.gdh.getObject(o.userdata.objid, GdhOp.GET_OP_METHOD_OBJECTGRAPH, self.open_objectgraph_cb, newwindow); self.ctx.gdh.getObject(o.userdata.objid,
GdhOp.GET_OP_METHOD_OBJECTGRAPH, self.open_objectgraph_cb,
newwindow);
} }
console.log("toolitem2 event"); console.log("toolitem2 event");
}); });
document.getElementById("toolitem3").addEventListener("click", function (event) { document.getElementById("toolitem3")
.addEventListener("click", function (event) {
console.log("toolitem1 event"); console.log("toolitem1 event");
var o = self.ctx.get_select(); var o = self.ctx.get_select();
if (o.userdata instanceof XttItemObject) { if (o.userdata instanceof XttItemObject) {
var newwindow = window.open("", "_blank"); var newwindow = window.open("", "_blank");
self.ctx.gdh.getObject(o.userdata.objid, GdhOp.GET_OP_METHOD_PLC, self.open_plc_cb, newwindow); self.ctx.gdh.getObject(o.userdata.objid, GdhOp.GET_OP_METHOD_PLC,
} self.open_plc_cb, newwindow);
else if (o.userdata instanceof XttItemCrr) { } else if (o.userdata instanceof XttItemCrr) {
var idx = o.userdata.name.lastIndexOf('-'); var idx = o.userdata.name.lastIndexOf('-');
var ostring = ""; var ostring = "";
if (idx != -1) { if (idx != -1) {
ostring = "&obj=" + o.userdata.name.substring(idx + 1); ostring = "&obj=" + o.userdata.name.substring(idx + 1);
} }
console.log("flow.html?vid=" + o.userdata.objid.vid + "&oix=" + o.userdata.objid.oix + ostring); console.log("flow.html?vid=" + o.userdata.objid.vid + "&oix=" +
window.open("flow.html?vid=" + o.userdata.objid.vid + "&oix=" + o.userdata.objid.oix + ostring); o.userdata.objid.oix + ostring);
window.open("flow.html?vid=" + o.userdata.objid.vid + "&oix=" +
o.userdata.objid.oix + ostring);
} }
console.log("toolitem3 event"); console.log("toolitem3 event");
}); });
document.getElementById("toolitem4").addEventListener("click", function (event) { document.getElementById("toolitem4")
.addEventListener("click", function (event) {
console.log("toolitem4 event"); console.log("toolitem4 event");
}); });
document.getElementById("toolitem5").addEventListener("click", function (event) { document.getElementById("toolitem5")
.addEventListener("click", function (event) {
console.log("toolitem5 event"); console.log("toolitem5 event");
var o = self.ctx.get_select(); var o = self.ctx.get_select();
if (o == null) if (o == null) {
return; return;
}
var item = o.userdata; var item = o.userdata;
item.open_attributes(self); item.open_attributes(self);
}); });
document.getElementById("toolitem6").addEventListener("click", function (event) { document.getElementById("toolitem6")
.addEventListener("click", function (event) {
var o = self.ctx.get_select(); var o = self.ctx.get_select();
self.ctx.gdh.crrSignal(o.userdata.objid, self.open_crr_cb, o); self.ctx.gdh.crrSignal(o.userdata.objid, self.open_crr_cb, o);
console.log("toolitem6 event"); console.log("toolitem6 event");
}); });
document.getElementById("toolitem7").addEventListener("click", function (event) { document.getElementById("toolitem7")
.addEventListener("click", function (event) {
console.log("toolitem7 event"); console.log("toolitem7 event");
}); });
document.getElementById("toolitem8").addEventListener("click", function (event) { document.getElementById("toolitem8")
.addEventListener("click", function (event) {
console.log("toolitem8 event"); console.log("toolitem8 event");
var o = self.ctx.get_select(); var o = self.ctx.get_select();
if (o == null) if (o == null) {
return; return;
}
if (o.userdata instanceof XttItemObject) { if (o.userdata instanceof XttItemObject) {
var newwindow = window.open("", "_blank"); var newwindow = window.open("", "_blank");
self.ctx.gdh.getObject(o.userdata.objid, GdhOp.GET_OP_METHOD_HELPCLASS, self.open_helpclass_cb, newwindow); self.ctx.gdh.getObject(o.userdata.objid,
GdhOp.GET_OP_METHOD_HELPCLASS, self.open_helpclass_cb, newwindow);
} }
}); });
window.addEventListener("storage", function (event) { window.addEventListener("storage", function (event) {
if (event.newValue == "") if (event.newValue == "") {
return; return;
}
localStorage.setItem("XttMethodNavigator", ""); localStorage.setItem("XttMethodNavigator", "");
self.display_object(event.newValue); self.display_object(event.newValue);
}); });
...@@ -153,11 +168,13 @@ function Xtt() { ...@@ -153,11 +168,13 @@ function Xtt() {
} }
this.gdh_init_cb = function () { this.gdh_init_cb = function () {
if (self.priv == null) if (self.priv == null) {
self.ctx.gdh.login("", "", self.login_cb, self); self.ctx.gdh.login("", "", self.login_cb, self);
}
var oid = new PwrtObjid(0, 0); var oid = new PwrtObjid(0, 0);
self.ctx.gdh.getAllXttChildren(oid, self.open_children_cb, new XttOpenChildrenData(null, null)); self.ctx.gdh.getAllXttChildren(oid, self.open_children_cb,
new XttOpenChildrenData(null, null));
self.ctx.gdh.listSent = true; self.ctx.gdh.listSent = true;
self.trace_cyclic(); self.trace_cyclic();
...@@ -165,10 +182,11 @@ function Xtt() { ...@@ -165,10 +182,11 @@ function Xtt() {
this.login_cb = function (id, data, sts, result) { this.login_cb = function (id, data, sts, result) {
console.log("Login:", sts, result); console.log("Login:", sts, result);
if (sts & 1) if (sts & 1) {
self.priv = result; self.priv = result;
else } else {
self.priv = 0; self.priv = 0;
}
}; };
this.open_children_cb = function (id, data, sts, result) { this.open_children_cb = function (id, data, sts, result) {
...@@ -177,9 +195,9 @@ function Xtt() { ...@@ -177,9 +195,9 @@ function Xtt() {
if (data.node == null) { if (data.node == null) {
result[i].full_name = result[i].name; result[i].full_name = result[i].name;
new XttItemObject(self, result[i], null, Plow.DEST_AFTER); new XttItemObject(self, result[i], null, Plow.DEST_AFTER);
} } else {
else { result[i].full_name =
result[i].full_name = data.node.userdata.full_name + "-" + result[i].name; data.node.userdata.full_name + "-" + result[i].name;
new XttItemObject(self, result[i], data.node, Plow.DEST_INTOLAST); new XttItemObject(self, result[i], data.node, Plow.DEST_INTOLAST);
} }
} }
...@@ -196,19 +214,19 @@ function Xtt() { ...@@ -196,19 +214,19 @@ function Xtt() {
if (data.open_next.length == 1) { if (data.open_next.length == 1) {
child.set_select(true); child.set_select(true);
child.set_invert(true); child.set_invert(true);
if (!self.ctx.is_visible(child)) if (!self.ctx.is_visible(child)) {
self.ctx.scroll(child.y_low, 0.50); self.ctx.scroll(child.y_low, 0.50);
window.focus(); // Doesn't work
} }
else { window.focus(); // Doesn't work
} else {
data.open_next.splice(0, 1); data.open_next.splice(0, 1);
if (data.open_next[0] == '.') { if (data.open_next[0] == '.') {
data.open_next.splice(0, 1); data.open_next.splice(0, 1);
child.userdata.open_attributes(self, data.open_next); child.userdata.open_attributes(self, data.open_next);
} } else {
else
child.userdata.open_children(self, data.open_next); child.userdata.open_children(self, data.open_next);
} }
}
break; break;
} }
child = self.ctx.a.get_next_sibling(child); child = self.ctx.a.get_next_sibling(child);
...@@ -224,13 +242,14 @@ function Xtt() { ...@@ -224,13 +242,14 @@ function Xtt() {
for (var i = 0; i < result.length; i++) { for (var i = 0; i < result.length; i++) {
result[i].objid = data.node.userdata.objid; result[i].objid = data.node.userdata.objid;
result[i].full_name = data.node.userdata.full_name + "." + result[i].name; result[i].full_name = data.node.userdata.full_name + "." + result[i].name;
if ((result[i].flags & Pwr.mAdef_array) != 0) if ((result[i].flags & Pwr.mAdef_array) != 0) {
new XttItemAttrArray(self, result[i], data.node, Plow.DEST_INTOLAST); new XttItemAttrArray(self, result[i], data.node, Plow.DEST_INTOLAST);
else if ((result[i].flags & Pwr.mAdef_class) != 0) } else if ((result[i].flags & Pwr.mAdef_class) != 0) {
new XttItemAttrObject(self, result[i], data.node, Plow.DEST_INTOLAST); new XttItemAttrObject(self, result[i], data.node, Plow.DEST_INTOLAST);
else } else {
new XttItemAttr(self, result[i], data.node, Plow.DEST_INTOLAST); new XttItemAttr(self, result[i], data.node, Plow.DEST_INTOLAST);
} }
}
self.ctx.configure(); self.ctx.configure();
...@@ -245,11 +264,11 @@ function Xtt() { ...@@ -245,11 +264,11 @@ function Xtt() {
if (data.open_next.length == 1) { if (data.open_next.length == 1) {
child.set_select(true); child.set_select(true);
child.set_invert(true); child.set_invert(true);
if (!self.ctx.is_visible(child)) if (!self.ctx.is_visible(child)) {
self.ctx.scroll(child.y_low, 0.50); self.ctx.scroll(child.y_low, 0.50);
window.focus(); // Doesn't work
} }
else { window.focus(); // Doesn't work
} else {
data.open_next.splice(0, 1); data.open_next.splice(0, 1);
child.userdata.open_attributes(self, data.open_next); child.userdata.open_attributes(self, data.open_next);
} }
...@@ -266,43 +285,50 @@ function Xtt() { ...@@ -266,43 +285,50 @@ function Xtt() {
this.open_plc_cb = function (id, data, sts, result) { this.open_plc_cb = function (id, data, sts, result) {
if ((sts & 1) != 0) { if ((sts & 1) != 0) {
var param1; var param1;
if (result.param1 !== "") if (result.param1 !== "") {
param1 = "&obj=" + result.param1; param1 = "&obj=" + result.param1;
else } else {
param1 = ""; param1 = "";
console.log("flow.html?vid=" + result.objid.vid + "&oix=" + result.objid.oix + param1);
data.location.href = "flow.html?vid=" + result.objid.vid + "&oix=" + result.objid.oix + param1;
data.document.title = "Trace " + result.fullname;
} }
else console.log("flow.html?vid=" + result.objid.vid + "&oix=" +
result.objid.oix + param1);
data.location.href =
"flow.html?vid=" + result.objid.vid + "&oix=" + result.objid.oix +
param1;
data.document.title = "Trace " + result.fullname;
} else {
data.document.write("Error status " + sts); data.document.write("Error status " + sts);
} }
}
this.open_objectgraph_cb = function (id, data, sts, result) { this.open_objectgraph_cb = function (id, data, sts, result) {
if ((sts & 1) != 0) { if ((sts & 1) != 0) {
data.location.href = "ge.html?graph=" + result.param1 + "&instance=" + result.fullname; data.location.href =
"ge.html?graph=" + result.param1 + "&instance=" + result.fullname;
data.document.title = result.fullname; data.document.title = result.fullname;
} } else {
else
data.document.write("Error status " + sts); data.document.write("Error status " + sts);
} }
}
this.open_graph_cb = function (id, data, sts, result) { this.open_graph_cb = function (id, data, sts, result) {
if ((sts & 1) != 0) { if ((sts & 1) != 0) {
var idx = result.param1.indexOf('.'); var idx = result.param1.indexOf('.');
if (idx != -1) if (idx != -1) {
result.param1 = result.param1.substring(0, idx); result.param1 = result.param1.substring(0, idx);
}
var instancestr = ""; var instancestr = "";
if (result.fullname !== "") if (result.fullname !== "") {
instancestr = "&instance=" + result.fullname; instancestr = "&instance=" + result.fullname;
}
data.location.href = "ge.html?graph=" + result.param1 + instancestr; data.location.href = "ge.html?graph=" + result.param1 + instancestr;
data.document.title = result.param1; data.document.title = result.param1;
} } else {
else
data.document.write("Error status " + sts); data.document.write("Error status " + sts);
} }
}
this.open_crr_cb = function (id, node, sts, crrdata) { this.open_crr_cb = function (id, node, sts, crrdata) {
if ((sts & 1) == 0) { if ((sts & 1) == 0) {
...@@ -316,16 +342,17 @@ function Xtt() { ...@@ -316,16 +342,17 @@ function Xtt() {
console.log("open_helpclass", result.param1); console.log("open_helpclass", result.param1);
var url = location.protocol + "//" + location.host + result.param1; var url = location.protocol + "//" + location.host + result.param1;
data.location.href = url; data.location.href = url;
} } else {
else
data.document.write("Error status " + sts); data.document.write("Error status " + sts);
} }
}
this.plow_event = function (event, object, x, y) { this.plow_event = function (event, object, x, y) {
var item = null; var item = null;
if (object != null) if (object != null) {
item = object.get_userdata(); item = object.get_userdata();
}
switch (event) { switch (event) {
case Plow.eEvent_ObjectDeleted: case Plow.eEvent_ObjectDeleted:
...@@ -336,13 +363,11 @@ function Xtt() { ...@@ -336,13 +363,11 @@ function Xtt() {
case Plow.eEvent_MB1Click: case Plow.eEvent_MB1Click:
if (object.in_icon(x, y)) { if (object.in_icon(x, y)) {
item.open_children(self, null); item.open_children(self, null);
} } else {
else {
if (object.select) { if (object.select) {
object.set_select(false); object.set_select(false);
object.set_invert(false); object.set_invert(false);
} } else {
else {
self.ctx.set_select(false); self.ctx.set_select(false);
object.set_select(true); object.set_select(true);
self.ctx.set_invert(false); self.ctx.set_invert(false);
...@@ -365,11 +390,11 @@ function Xtt() { ...@@ -365,11 +390,11 @@ function Xtt() {
o.set_invert(false); o.set_invert(false);
next.set_select(true); next.set_select(true);
next.set_invert(true); next.set_invert(true);
if (!self.ctx.is_visible(next)) if (!self.ctx.is_visible(next)) {
self.ctx.scroll(next.y_low, 0.10); self.ctx.scroll(next.y_low, 0.10);
} }
} }
else { } else {
o = self.ctx.a.a[0]; o = self.ctx.a.a[0];
o.set_select(true); o.set_select(true);
o.set_invert(true); o.set_invert(true);
...@@ -388,10 +413,11 @@ function Xtt() { ...@@ -388,10 +413,11 @@ function Xtt() {
next.set_invert(true); next.set_invert(true);
o.draw(self.ctx.gdraw.gctx, null, null, 0); o.draw(self.ctx.gdraw.gctx, null, null, 0);
next.draw(self.ctx.gdraw.gctx, null, null, 0); next.draw(self.ctx.gdraw.gctx, null, null, 0);
if (!self.ctx.is_visible(next)) if (!self.ctx.is_visible(next)) {
self.ctx.scroll(next.y_low, 0.90); self.ctx.scroll(next.y_low, 0.90);
} }
} }
}
break; break;
} }
...@@ -421,23 +447,25 @@ function Xtt() { ...@@ -421,23 +447,25 @@ function Xtt() {
} }
case Plow.eEvent_Key_CtrlR: { case Plow.eEvent_Key_CtrlR: {
var o = self.ctx.get_select(); var o = self.ctx.get_select();
if (o != null) if (o != null) {
self.ctx.gdh.crrSignal(o.userdata.objid, self.open_crr_cb, o); self.ctx.gdh.crrSignal(o.userdata.objid, self.open_crr_cb, o);
}
break; break;
} }
case Plow.eEvent_Key_CtrlL: { case Plow.eEvent_Key_CtrlL: {
var o = self.ctx.get_select(); var o = self.ctx.get_select();
if (o.userdata instanceof XttItemObject) { if (o.userdata instanceof XttItemObject) {
var newwindow = window.open("", "_blank"); var newwindow = window.open("", "_blank");
self.ctx.gdh.getObject(o.userdata.objid, GdhOp.GET_OP_METHOD_PLC, self.open_plc_cb, newwindow); self.ctx.gdh.getObject(o.userdata.objid, GdhOp.GET_OP_METHOD_PLC,
} self.open_plc_cb, newwindow);
else if (o.userdata instanceof XttItemCrr) { } else if (o.userdata instanceof XttItemCrr) {
var idx = o.userdata.name.lastIndexOf('-'); var idx = o.userdata.name.lastIndexOf('-');
var ostring = ""; var ostring = "";
if (idx != -1) { if (idx != -1) {
ostring = "&obj=" + o.userdata.name.substring(idx + 1); ostring = "&obj=" + o.userdata.name.substring(idx + 1);
} }
window.open("flow.html?vid=" + o.userdata.objid.vid + "&oix=" + o.userdata.objid.oix + ostring); window.open("flow.html?vid=" + o.userdata.objid.vid + "&oix=" +
o.userdata.objid.oix + ostring);
} }
break; break;
} }
...@@ -446,7 +474,9 @@ function Xtt() { ...@@ -446,7 +474,9 @@ function Xtt() {
if (o.userdata instanceof XttItemObject) { if (o.userdata instanceof XttItemObject) {
console.log("CtrlG", o.userdata.objid.vid, o.userdata.objid.oix); console.log("CtrlG", o.userdata.objid.vid, o.userdata.objid.oix);
var newwindow = window.open("", "_blank"); var newwindow = window.open("", "_blank");
self.ctx.gdh.getObject(o.userdata.objid, GdhOp.GET_OP_METHOD_OBJECTGRAPH, self.open_objectgraph_cb, newwindow); self.ctx.gdh.getObject(o.userdata.objid,
GdhOp.GET_OP_METHOD_OBJECTGRAPH, self.open_objectgraph_cb,
newwindow);
} }
break; break;
} }
...@@ -454,10 +484,14 @@ function Xtt() { ...@@ -454,10 +484,14 @@ function Xtt() {
} }
this.createNodeClasses = function () { this.createNodeClasses = function () {
var r1 = new PlowRect(this.ctx, 0, 0, 50, 1.0, Plow.COLOR_WHITE, Plow.COLOR_WHITE, true, false); var r1 = new PlowRect(this.ctx, 0, 0, 50, 1.0, Plow.COLOR_WHITE,
var a1 = new PlowAnnot(this.ctx, 3, 0.9, 4, Plow.COLOR_BLACK, Plow.NEXT_RELATIVE_POSITION, 0); Plow.COLOR_WHITE, true, false);
var a11 = new PlowAnnot(this.ctx, 7.5, 0.9, 4, Plow.COLOR_BLACK, Plow.RELATIVE_POSITION, 1); var a1 = new PlowAnnot(this.ctx, 3, 0.9, 4, Plow.COLOR_BLACK,
var a12 = new PlowAnnot(this.ctx, 12, 0.9, 4, Plow.COLOR_BLACK, Plow.RELATIVE_POSITION, 2); Plow.NEXT_RELATIVE_POSITION, 0);
var a11 = new PlowAnnot(this.ctx, 7.5, 0.9, 4, Plow.COLOR_BLACK,
Plow.RELATIVE_POSITION, 1);
var a12 = new PlowAnnot(this.ctx, 12, 0.9, 4, Plow.COLOR_BLACK,
Plow.RELATIVE_POSITION, 2);
var p1 = new PlowAnnotPixmap(this.ctx, 0.4, 0.2, 0); var p1 = new PlowAnnotPixmap(this.ctx, 0.4, 0.2, 0);
this.ncObject = new PlowNodeClass(this.ctx); this.ncObject = new PlowNodeClass(this.ctx);
...@@ -477,9 +511,10 @@ function Xtt() { ...@@ -477,9 +511,10 @@ function Xtt() {
this.ctx.set_nodraw(); this.ctx.set_nodraw();
for (var i = 0; i < this.ctx.a.size(); i++) { for (var i = 0; i < this.ctx.a.size(); i++) {
var node = this.ctx.a.get(i); var node = this.ctx.a.get(i);
if (node.level == 0) if (node.level == 0) {
node.userdata.close(this); node.userdata.close(this);
} }
}
this.ctx.reset_nodraw(); this.ctx.reset_nodraw();
this.ctx.draw(); this.ctx.draw();
} }
...@@ -495,14 +530,16 @@ function Xtt() { ...@@ -495,14 +530,16 @@ function Xtt() {
var p2 = attr.split('.'); var p2 = attr.split('.');
path = new Array(p1.length + p2.length + 1); path = new Array(p1.length + p2.length + 1);
var j; var j;
for (j = 0; j < p1.length; j++) for (j = 0; j < p1.length; j++) {
path[j] = p1[j]; path[j] = p1[j];
}
path[p1.length] = '.'; path[p1.length] = '.';
for (j = 0; j < p2.length; j++) for (j = 0; j < p2.length; j++) {
path[j + p1.length + 1] = p2[j]; path[j + p1.length + 1] = p2[j];
} }
else } else {
path = name.split('-'); path = name.split('-');
}
var idx = 0; var idx = 0;
...@@ -513,11 +550,11 @@ function Xtt() { ...@@ -513,11 +550,11 @@ function Xtt() {
var node = this.ctx.a.get(j); var node = this.ctx.a.get(j);
node.set_select(true); node.set_select(true);
node.set_invert(true); node.set_invert(true);
if (!this.ctx.is_visible(node)) if (!this.ctx.is_visible(node)) {
this.ctx.scroll(node.y_low, 0.50); this.ctx.scroll(node.y_low, 0.50);
window.focus(); // Doesn't work
} }
else { window.focus(); // Doesn't work
} else {
path.splice(0, 1); path.splice(0, 1);
this.ctx.a.get(j).userdata.open_children(this, path); this.ctx.a.get(j).userdata.open_children(this, path);
} }
...@@ -538,20 +575,23 @@ function Xtt() { ...@@ -538,20 +575,23 @@ function Xtt() {
item.scan(self); item.scan(self);
} }
} }
if (self.scan_update) if (self.scan_update) {
self.ctx.draw(); self.ctx.draw();
}
self.timer = setTimeout(self.trace_cyclic, 1000); self.timer = setTimeout(self.trace_cyclic, 1000);
}; };
this.openValueInputDialog = function (item, text) { this.openValueInputDialog = function (item, text) {
console.log("priv acc", this.priv, Pwr.mAccess_RtWrite | Pwr.mAccess_System); console.log("priv acc", this.priv, Pwr.mAccess_RtWrite |
Pwr.mAccess_System);
if (this.is_authorized(Pwr.mAccess_RtWrite | Pwr.mAccess_System)) { if (this.is_authorized(Pwr.mAccess_RtWrite | Pwr.mAccess_System)) {
var value = prompt(text, ""); var value = prompt(text, "");
if (value !== null) if (value !== null) {
item.set_value(this, value); item.set_value(this, value);
} }
else } else {
alert("Not authorized for this operation"); alert("Not authorized for this operation");
}
}; };
} }
...@@ -568,28 +608,31 @@ function XttItemObject(xtt, object_info, destination, destCode) { ...@@ -568,28 +608,31 @@ function XttItemObject(xtt, object_info, destination, destCode) {
this.node.set_annotation(2, object_info.description); this.node.set_annotation(2, object_info.description);
this.node.set_annotation_pixmap(0, Bitmaps.map); this.node.set_annotation_pixmap(0, Bitmaps.map);
xtt.ctx.insertNode(this.node, destination, destCode); xtt.ctx.insertNode(this.node, destination, destCode);
if (object_info.has_children) if (object_info.has_children) {
this.node.set_annotation_pixmap(0, Bitmaps.map); this.node.set_annotation_pixmap(0, Bitmaps.map);
else } else {
this.node.set_annotation_pixmap(0, Bitmaps.leaf); this.node.set_annotation_pixmap(0, Bitmaps.leaf);
}
this.open_children = function (xtt, open_next) { this.open_children = function (xtt, open_next) {
if (this.node.node_open != 0) if (this.node.node_open != 0) {
this.close(xtt); this.close(xtt);
else if (!this.has_children) } else if (!this.has_children) {
this.open_attributes(xtt, null); this.open_attributes(xtt, null);
else { } else {
xtt.ctx.gdh.getAllXttChildren(this.objid, xtt.open_children_cb, new XttOpenChildrenData(this.node, open_next)); xtt.ctx.gdh.getAllXttChildren(this.objid, xtt.open_children_cb,
new XttOpenChildrenData(this.node, open_next));
this.node.node_open |= Plow.OPEN_CHILDREN; this.node.node_open |= Plow.OPEN_CHILDREN;
this.node.set_annotation_pixmap(0, Bitmaps.openmap); this.node.set_annotation_pixmap(0, Bitmaps.openmap);
} }
} }
this.open_attributes = function (xtt, open_next) { this.open_attributes = function (xtt, open_next) {
if (this.node.node_open != 0) if (this.node.node_open != 0) {
this.close(xtt); this.close(xtt);
else { } else {
xtt.ctx.gdh.getAllClassAttributes(this.cid, this.objid, xtt.open_attributes_cb, new XttOpenChildrenData(this.node, open_next)); xtt.ctx.gdh.getAllClassAttributes(this.cid, this.objid,
xtt.open_attributes_cb, new XttOpenChildrenData(this.node, open_next));
this.node.node_open |= Plow.OPEN_ATTRIBUTES; this.node.node_open |= Plow.OPEN_ATTRIBUTES;
xtt.ctx.configure(); xtt.ctx.configure();
...@@ -598,9 +641,9 @@ function XttItemObject(xtt, object_info, destination, destCode) { ...@@ -598,9 +641,9 @@ function XttItemObject(xtt, object_info, destination, destCode) {
} }
this.open_crossreferences = function (xtt, crrdata) { this.open_crossreferences = function (xtt, crrdata) {
if (this.node.node_open != 0) if (this.node.node_open != 0) {
this.close(xtt); this.close(xtt);
else { } else {
for (var i = 0; i < crrdata.length; i++) { for (var i = 0; i < crrdata.length; i++) {
new XttItemCrr(xtt, crrdata[i], this.node, Plow.DEST_INTOLAST); new XttItemCrr(xtt, crrdata[i], this.node, Plow.DEST_INTOLAST);
} }
...@@ -618,20 +661,17 @@ function XttItemObject(xtt, object_info, destination, destCode) { ...@@ -618,20 +661,17 @@ function XttItemObject(xtt, object_info, destination, destCode) {
this.node.set_annotation_pixmap(0, Bitmaps.map); this.node.set_annotation_pixmap(0, Bitmaps.map);
xtt.ctx.configure(); xtt.ctx.configure();
xtt.ctx.draw(); xtt.ctx.draw();
} } else if (this.node.node_open & Plow.OPEN_ATTRIBUTES) {
else if (this.node.node_open & Plow.OPEN_ATTRIBUTES) {
xtt.ctx.close_node(this.node); xtt.ctx.close_node(this.node);
this.node.node_open &= ~Plow.OPEN_ATTRIBUTES; this.node.node_open &= ~Plow.OPEN_ATTRIBUTES;
xtt.ctx.configure(); xtt.ctx.configure();
xtt.ctx.draw(); xtt.ctx.draw();
} } else if (this.node.node_open & Plow.OPEN_CROSSREFERENCES) {
else if (this.node.node_open & Plow.OPEN_CROSSREFERENCES) {
xtt.ctx.close_node(this.node); xtt.ctx.close_node(this.node);
this.node.node_open &= ~Plow.OPEN_CROSSREFERENCES; this.node.node_open &= ~Plow.OPEN_CROSSREFERENCES;
xtt.ctx.configure(); xtt.ctx.configure();
xtt.ctx.draw(); xtt.ctx.draw();
} } else {
else {
var parent = xtt.ctx.get_parent_object(this.node); var parent = xtt.ctx.get_parent_object(this.node);
if (parent != null) { if (parent != null) {
parent.userdata.close(xtt); parent.userdata.close(xtt);
...@@ -711,8 +751,9 @@ function XttItemAttr(xtt, info, destination, destCode) { ...@@ -711,8 +751,9 @@ function XttItemAttr(xtt, info, destination, destCode) {
} }
this.scan = function (xtt) { this.scan = function (xtt) {
if (!this.refid) if (!this.refid) {
return; return;
}
var value = xtt.ctx.gdh.getObjectRefInfo(this.refid); var value = xtt.ctx.gdh.getObjectRefInfo(this.refid);
if (this.firstScan || value != this.old_value) { if (this.firstScan || value != this.old_value) {
var value_str; var value_str;
...@@ -786,13 +827,14 @@ function XttItemAttrArray(xtt, info, destination, destCode) { ...@@ -786,13 +827,14 @@ function XttItemAttrArray(xtt, info, destination, destCode) {
for (var i = 0; i < this.elements; i++) { for (var i = 0; i < this.elements; i++) {
info.name = this.name + "[" + i + "]"; info.name = this.name + "[" + i + "]";
info.full_name = this.full_name + "[" + i + "]"; info.full_name = this.full_name + "[" + i + "]";
if ((info.flags & Pwr.mAdef_array) != 0) if ((info.flags & Pwr.mAdef_array) != 0) {
new XttItemAttrArray(xtt, info, this.node, Plow.DEST_INTOLAST); new XttItemAttrArray(xtt, info, this.node, Plow.DEST_INTOLAST);
else if ((info.flags & Pwr.mAdef_class) != 0) } else if ((info.flags & Pwr.mAdef_class) != 0) {
new XttItemAttrObject(xtt, info, this.node, Plow.DEST_INTOLAST); new XttItemAttrObject(xtt, info, this.node, Plow.DEST_INTOLAST);
else } else {
new XttItemAttr(xtt, info, this.node, Plow.DEST_INTOLAST); new XttItemAttr(xtt, info, this.node, Plow.DEST_INTOLAST);
} }
}
this.node.node_open |= Plow.OPEN_ATTRIBUTES; this.node.node_open |= Plow.OPEN_ATTRIBUTES;
xtt.ctx.configure(); xtt.ctx.configure();
xtt.ctx.reset_nodraw(); xtt.ctx.reset_nodraw();
...@@ -805,8 +847,7 @@ function XttItemAttrArray(xtt, info, destination, destCode) { ...@@ -805,8 +847,7 @@ function XttItemAttrArray(xtt, info, destination, destCode) {
this.node.node_open &= ~Plow.OPEN_ATTRIBUTES; this.node.node_open &= ~Plow.OPEN_ATTRIBUTES;
xtt.ctx.configure(); xtt.ctx.configure();
xtt.ctx.draw(); xtt.ctx.draw();
} } else {
else {
var parent = xtt.ctx.get_parent_object(this.node); var parent = xtt.ctx.get_parent_object(this.node);
if (parent != null) { if (parent != null) {
parent.userdata.close(xtt); parent.userdata.close(xtt);
...@@ -838,10 +879,11 @@ function XttItemAttrObject(xtt, info, destination, destCode) { ...@@ -838,10 +879,11 @@ function XttItemAttrObject(xtt, info, destination, destCode) {
} }
this.open_attributes = function (xtt, open_next) { this.open_attributes = function (xtt, open_next) {
if (this.node.node_open != 0) if (this.node.node_open != 0) {
this.close(xtt); this.close(xtt);
else { } else {
xtt.ctx.gdh.getAllClassAttributes(this.cid, this.objid, xtt.open_attributes_cb, new XttOpenChildrenData(this.node, open_next)) xtt.ctx.gdh.getAllClassAttributes(this.cid, this.objid,
xtt.open_attributes_cb, new XttOpenChildrenData(this.node, open_next))
this.node.node_open |= Plow.OPEN_ATTRIBUTES; this.node.node_open |= Plow.OPEN_ATTRIBUTES;
} }
...@@ -853,14 +895,12 @@ function XttItemAttrObject(xtt, info, destination, destCode) { ...@@ -853,14 +895,12 @@ function XttItemAttrObject(xtt, info, destination, destCode) {
this.node.node_open &= ~Plow.OPEN_ATTRIBUTES; this.node.node_open &= ~Plow.OPEN_ATTRIBUTES;
xtt.ctx.configure(); xtt.ctx.configure();
xtt.ctx.draw(); xtt.ctx.draw();
} } else if (this.node.node_open & Plow.OPEN_CROSSREFERENCES) {
else if (this.node.node_open & Plow.OPEN_CROSSREFERENCES) {
xtt.ctx.close_node(this.node); xtt.ctx.close_node(this.node);
this.node.node_open &= ~Plow.OPEN_CROSSREFERENCES; this.node.node_open &= ~Plow.OPEN_CROSSREFERENCES;
xtt.ctx.configure(); xtt.ctx.configure();
xtt.ctx.draw(); xtt.ctx.draw();
} } else {
else {
var parent = xtt.ctx.get_parent_object(this.node); var parent = xtt.ctx.get_parent_object(this.node);
if (parent != null) { if (parent != null) {
parent.userdata.close(xtt); parent.userdata.close(xtt);
...@@ -905,8 +945,5 @@ function XttItemCrr(xtt, info, destination, destCode) { ...@@ -905,8 +945,5 @@ function XttItemCrr(xtt, info, destination, destCode) {
} }
} }
var xtt = new Xtt(); var xtt = new Xtt();
xtt.init(); xtt.init();
/** End Xtt **/
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment