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

JS: Autoformat files

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