Commit f201d1fb authored by Christoffer Ackelman's avatar Christoffer Ackelman

Web: More cleanup.

parent 2fce9529
...@@ -296,7 +296,6 @@ class DataViewHelper { ...@@ -296,7 +296,6 @@ class DataViewHelper {
} }
class Gdh { class Gdh {
debug = false;
pending: Array = []; pending: Array = [];
sub: Array<Sub> = []; sub: Array<Sub> = [];
static PORT = 4448; static PORT = 4448;
...@@ -321,9 +320,6 @@ class Gdh { ...@@ -321,9 +320,6 @@ class Gdh {
}; };
this.ws.onclose = function () { this.ws.onclose = function () {
if (this.debug) {
console.log("Socket closed");
}
if (close_cb !== null) { if (close_cb !== null) {
close_cb(); close_cb();
} }
...@@ -331,7 +327,6 @@ class Gdh { ...@@ -331,7 +327,6 @@ class Gdh {
this.ws.onmessage = function (e) { this.ws.onmessage = function (e) {
if (typeof e.data === "string") { if (typeof e.data === "string") {
console.log("String message received", e, e.data);
} else { } else {
if (e.data instanceof ArrayBuffer) { if (e.data instanceof ArrayBuffer) {
let dv = new DataViewHelper(e.data); let dv = new DataViewHelper(e.data);
...@@ -341,36 +336,24 @@ class Gdh { ...@@ -341,36 +336,24 @@ class Gdh {
switch (type) { switch (type) {
case Msg.GET_OBJECT_INFO_BOOLEAN: case Msg.GET_OBJECT_INFO_BOOLEAN:
if (this.gdh.debug) {
console.log("GetObjectInfoBoolean received");
}
let value = dv.getUint8(); let value = dv.getUint8();
let func_cb = this.gdh.pending[id].func_cb; let func_cb = this.gdh.pending[id].func_cb;
func_cb(id, sts, value); func_cb(id, sts, value);
delete this.gdh.pending[id]; delete this.gdh.pending[id];
break; break;
case Msg.GET_OBJECT_INFO_INT: case Msg.GET_OBJECT_INFO_INT:
if (this.gdh.debug) {
console.log("GetObjectInfoInt received");
}
let value = dv.getUint32(); let value = dv.getUint32();
let pending_data = this.gdh.pending[id]; let pending_data = this.gdh.pending[id];
pending_data.func_cb(id, pending_data.data, sts, value); pending_data.func_cb(id, pending_data.data, sts, value);
delete this.gdh.pending[id]; delete this.gdh.pending[id];
break; break;
case Msg.GET_OBJECT_INFO_FLOAT: case Msg.GET_OBJECT_INFO_FLOAT:
if (this.gdh.debug) {
console.log("GetObjectInfoFloat received");
}
let value = dv.getFloat32(); let value = dv.getFloat32();
let pending_data = this.gdh.pending[id]; let pending_data = this.gdh.pending[id];
pending_data.func_cb(id, pending_data.data, sts, value); pending_data.func_cb(id, pending_data.data, sts, value);
delete this.gdh.pending[id]; delete this.gdh.pending[id];
break; break;
case Msg.GET_OBJECT_INFO_FLOAT_ARRAY: case Msg.GET_OBJECT_INFO_FLOAT_ARRAY:
if (this.gdh.debug) {
console.log("GetObjectInfoFloatArray received");
}
let asize = dv.getInt32(); let asize = dv.getInt32();
let value = new Array(asize); let value = new Array(asize);
for (let i = 0; i < asize; i++) { for (let i = 0; i < asize; i++) {
...@@ -381,55 +364,28 @@ class Gdh { ...@@ -381,55 +364,28 @@ class Gdh {
delete this.gdh.pending[id]; delete this.gdh.pending[id];
break; break;
case Msg.SET_OBJECT_INFO_BOOLEAN: case Msg.SET_OBJECT_INFO_BOOLEAN:
if (this.gdh.debug) {
console.log("SetObjectInfoBoolean received", id, sts);
}
break; break;
case Msg.SET_OBJECT_INFO_INT: case Msg.SET_OBJECT_INFO_INT:
if (this.gdh.debug) {
console.log("SetObjectInfoInt received", id, sts);
}
break; break;
case Msg.SET_OBJECT_INFO_FLOAT: case Msg.SET_OBJECT_INFO_FLOAT:
if (this.gdh.debug) {
console.log("SetObjectInfoFloat received", id, sts);
}
break; break;
case Msg.SET_OBJECT_INFO_STRING: case Msg.SET_OBJECT_INFO_STRING:
if (this.gdh.debug) {
console.log("SetObjectInfoString received", id, sts);
}
break; break;
case Msg.TOGGLE_OBJECT_INFO: case Msg.TOGGLE_OBJECT_INFO:
if (this.gdh.debug) {
console.log("ToggleObjectInfo received", id, sts);
}
break; break;
case Msg.REF_OBJECT_INFO: case Msg.REF_OBJECT_INFO:
if (this.gdh.debug) {
console.log("RefObjectInfo received", id, sts);
}
delete this.gdh.pending[id]; delete this.gdh.pending[id];
break; break;
case Msg.UNREF_OBJECT_INFO: case Msg.UNREF_OBJECT_INFO:
if (this.gdh.debug) {
console.log("UnrefObjectInfo received", id, sts);
}
delete this.gdh.pending[id]; delete this.gdh.pending[id];
break; break;
case Msg.REF_OBJECT_INFO_LIST: case Msg.REF_OBJECT_INFO_LIST:
if (this.gdh.debug) {
console.log("RefObjectInfoList received", id, sts);
}
let func_cb = this.gdh.pending[id].func_cb; let func_cb = this.gdh.pending[id].func_cb;
func_cb(id, sts); func_cb(id, sts);
delete this.gdh.pending[id]; delete this.gdh.pending[id];
break; break;
case Msg.GET_OBJECT_REF_INFO_ALL: case Msg.GET_OBJECT_REF_INFO_ALL:
let size = dv.getUint32(); let size = dv.getUint32();
if (this.gdh.debug) {
console.log("GetObjectRefInfoAll received", id, size);
}
for (let i = 0; i < size; i++) { for (let i = 0; i < size; i++) {
let eid = dv.getUint32(); let eid = dv.getUint32();
let esize = dv.getUint32(); let esize = dv.getUint32();
...@@ -528,10 +484,6 @@ class Gdh { ...@@ -528,10 +484,6 @@ class Gdh {
case Msg.GET_ALL_XTT_CHILDREN: case Msg.GET_ALL_XTT_CHILDREN:
let result = []; let result = [];
let size = dv.getUint32(); let size = dv.getUint32();
if (this.gdh.debug) {
console.log("GetAllXttChildren received", id, size);
}
console.log("GetAllXttChildren received", sts, id, size);
for (let i = 0; i < size; i++) { for (let i = 0; i < size; i++) {
let info = new ObjectInfo(); let info = new ObjectInfo();
let vid = dv.getUint32(); let vid = dv.getUint32();
...@@ -551,9 +503,6 @@ class Gdh { ...@@ -551,9 +503,6 @@ class Gdh {
case Msg.GET_ALL_CLASS_ATTRIBUTES: case Msg.GET_ALL_CLASS_ATTRIBUTES:
let result = []; let result = [];
let size = dv.getUint32(); let size = dv.getUint32();
if (this.gdh.debug) {
console.log("GetAllClassAttributes received", id, size);
}
for (let i = 0; i < size; i++) { for (let i = 0; i < size; i++) {
let info = new AttributeInfo(); let info = new AttributeInfo();
info.type = dv.getUint32(); info.type = dv.getUint32();
...@@ -571,9 +520,6 @@ class Gdh { ...@@ -571,9 +520,6 @@ class Gdh {
case Msg.GET_OBJECT: case Msg.GET_OBJECT:
case Msg.GET_OBJECT_FROM_AREF: case Msg.GET_OBJECT_FROM_AREF:
case Msg.GET_OBJECT_FROM_NAME: case Msg.GET_OBJECT_FROM_NAME:
if (this.gdh.debug) {
console.log("GetObject received", id, sts);
}
let info = null; let info = null;
if (odd(sts)) { if (odd(sts)) {
info = new ObjectInfo(); info = new ObjectInfo();
...@@ -597,9 +543,6 @@ class Gdh { ...@@ -597,9 +543,6 @@ class Gdh {
let result = []; let result = [];
if (odd(sts)) { if (odd(sts)) {
let size = dv.getUint16(); let size = dv.getUint16();
if (this.gdh.debug) {
console.log("CrrSignal received", id, size);
}
for (let i = 0; i < size; i++) { for (let i = 0; i < size; i++) {
let info = new CrrInfo(); let info = new CrrInfo();
info.type = dv.getUint16(); info.type = dv.getUint16();
...@@ -617,10 +560,6 @@ class Gdh { ...@@ -617,10 +560,6 @@ class Gdh {
break; break;
case Msg.GET_OPWIND_MENU: case Msg.GET_OPWIND_MENU:
let result = new OpwindMenuInfo(); let result = new OpwindMenuInfo();
if (this.gdh.debug) {
console.log("GetOpwindMenu received", id);
}
console.log("GetOpwindMenu received", sts, id);
if (odd(sts)) { if (odd(sts)) {
result.title = dv.getString(); result.title = dv.getString();
...@@ -651,11 +590,6 @@ class Gdh { ...@@ -651,11 +590,6 @@ class Gdh {
delete this.gdh.pending[id]; delete this.gdh.pending[id];
break; break;
case Msg.CHECK_USER: case Msg.CHECK_USER:
if (this.gdh.debug) {
console.log("Check user received", id);
}
console.log("Check user received", sts, id);
let priv = 0; let priv = 0;
if (odd(sts)) { if (odd(sts)) {
priv = dv.getUint32(); priv = dv.getUint32();
...@@ -676,9 +610,6 @@ class Gdh { ...@@ -676,9 +610,6 @@ class Gdh {
case Msg.MH_SYNC: case Msg.MH_SYNC:
let result = []; let result = [];
let size = dv.getUint32(); let size = dv.getUint32();
if (this.gdh.debug) {
console.log("MhSync received", id, size);
}
for (let i = 0; i < size; i++) { for (let i = 0; i < size; i++) {
let e = new MhEvent(); let e = new MhEvent();
e.eventTime = dv.getString(); e.eventTime = dv.getString();
...@@ -762,6 +693,18 @@ class Gdh { ...@@ -762,6 +693,18 @@ class Gdh {
this.next_id++; this.next_id++;
} }
getObjectInfoIntArray(name, asize, return_cb, data) {
this.return_cb = return_cb;
let helper = new Uint8ArrayHelper(name.length + 10, Msg.GET_OBJECT_INFO_INT_ARRAY);
helper.pack32Bit(this.next_id);
helper.pack32Bit(asize);
helper.packString(name);
this.pending[this.next_id] = new PendingData(return_cb, data);
this.ws.send(helper.buf);
this.next_id++;
}
getObjectInfoFloat(name, return_cb, data) { getObjectInfoFloat(name, return_cb, data) {
this.return_cb = return_cb; this.return_cb = return_cb;
...@@ -798,18 +741,12 @@ class Gdh { ...@@ -798,18 +741,12 @@ class Gdh {
let helper = new Uint8ArrayHelper(size + 10, Msg.REF_OBJECT_INFO); let helper = new Uint8ArrayHelper(size + 10, Msg.REF_OBJECT_INFO);
helper.pack32Bit(this.next_id); helper.pack32Bit(this.next_id);
if (this.debug) {
console.log("RefObjectInfo: ", sub.refid);
}
helper.pack32Bit(sub.refid); helper.pack32Bit(sub.refid);
helper.pack32Bit(sub.elements); helper.pack32Bit(sub.elements);
helper.packString(sub.name); helper.packString(sub.name);
this.pending[this.next_id] = this.pending[this.next_id] =
new PendingData(this.refObjectInfoReply, null); new PendingData(this.refObjectInfoReply, null);
if (this.debug) {
console.log("Sending RefObjectInfo", this.next_id, size);
}
this.ws.send(helper.buf); this.ws.send(helper.buf);
this.next_id++; this.next_id++;
...@@ -818,9 +755,6 @@ class Gdh { ...@@ -818,9 +755,6 @@ class Gdh {
} }
refObjectInfoReply(id, sts) { refObjectInfoReply(id, sts) {
if (this.debug) {
console.log("refObjectInfoReply", id, sts);
}
} }
unrefObjectInfo(refid) { unrefObjectInfo(refid) {
...@@ -828,16 +762,10 @@ class Gdh { ...@@ -828,16 +762,10 @@ class Gdh {
let helper = new Uint8ArrayHelper(size + 10, Msg.UNREF_OBJECT_INFO); let helper = new Uint8ArrayHelper(size + 10, Msg.UNREF_OBJECT_INFO);
helper.pack32Bit(this.next_id); helper.pack32Bit(this.next_id);
if (this.debug) {
console.log("UnrefObjectInfo: ", refid);
}
helper.pack32Bit(refid); helper.pack32Bit(refid);
this.pending[this.next_id] = this.pending[this.next_id] =
new PendingData(this.unrefObjectInfoReply, null); new PendingData(this.unrefObjectInfoReply, null);
if (this.debug) {
console.log("Sending UnrefObjectInfo", this.next_id, size, refid);
}
this.ws.send(helper.buf); this.ws.send(helper.buf);
this.next_id++; this.next_id++;
...@@ -845,9 +773,6 @@ class Gdh { ...@@ -845,9 +773,6 @@ class Gdh {
} }
unrefObjectInfoReply(id, sts) { unrefObjectInfoReply(id, sts) {
if (this.debug) {
console.log("unrefObjectInfoReply", id, sts);
}
} }
refObjectInfoList(return_cb) { refObjectInfoList(return_cb) {
...@@ -864,17 +789,11 @@ class Gdh { ...@@ -864,17 +789,11 @@ class Gdh {
helper.pack32Bit(this.next_id); helper.pack32Bit(this.next_id);
helper.pack32Bit(len); helper.pack32Bit(len);
this.sub.slice(1).forEach(function (s) { this.sub.slice(1).forEach(function (s) {
if (this.debug) {
console.log("RefObjectInfoList: ", s.refid);
}
helper.pack32Bit(s.refid); helper.pack32Bit(s.refid);
helper.pack32Bit(s.elements); helper.pack32Bit(s.elements);
helper.packString(s.name); helper.packString(s.name);
}); });
this.pending[this.next_id] = new PendingData(return_cb, null); this.pending[this.next_id] = new PendingData(return_cb, null);
if (this.debug) {
console.log("Sending RefObjectInfoList", this.next_id, size, this.next_id);
}
this.ws.send(helper.buf); this.ws.send(helper.buf);
this.next_id++; this.next_id++;
...@@ -882,32 +801,20 @@ class Gdh { ...@@ -882,32 +801,20 @@ class Gdh {
} }
refObjectInfoListReply(id, sts) { refObjectInfoListReply(id, sts) {
if (this.debug) {
console.log("refObjectInfoListReply", id, sts);
}
} }
getRefObjectInfoAll(return_cb) { getRefObjectInfoAll(return_cb) {
let helper = new Uint8ArrayHelper(6, Msg.GET_OBJECT_REF_INFO_ALL); let helper = new Uint8ArrayHelper(6, Msg.GET_OBJECT_REF_INFO_ALL);
helper.pack32Bit(this.next_id); helper.pack32Bit(this.next_id);
this.pending[this.next_id] = new PendingData(return_cb, null); this.pending[this.next_id] = new PendingData(return_cb, null);
if (this.debug) {
console.log("Sending getRefObjectInfoAll", this.next_id);
}
this.ws.send(helper.buf); this.ws.send(helper.buf);
this.next_id++; this.next_id++;
} }
getRefObjectInfoAllReply(id, sts) { getRefObjectInfoAllReply(id, sts) {
if (this.debug) {
console.log("getRefObjectInfoAllReply", id, sts);
}
} }
getObjectRefInfo(id) { getObjectRefInfo(id) {
if (this.debug) {
console.log("getObjectRefInfo", id, this.sub[id].value);
}
return this.sub[id].value; return this.sub[id].value;
} }
...@@ -917,9 +824,6 @@ class Gdh { ...@@ -917,9 +824,6 @@ class Gdh {
helper.pack32Bit(value); helper.pack32Bit(value);
helper.packString(name); helper.packString(name);
this.ws.send(helper.buf); this.ws.send(helper.buf);
if (this.debug) {
console.log("Sending setObjectInfoBoolean", this.next_id, name, value);
}
this.next_id++; this.next_id++;
return 1; return 1;
...@@ -932,9 +836,6 @@ class Gdh { ...@@ -932,9 +836,6 @@ class Gdh {
helper.packString(name); helper.packString(name);
// this.pending[this.next_id] = new PendingData( return_cb, null); // this.pending[this.next_id] = new PendingData( return_cb, null);
this.ws.send(helper.buf); this.ws.send(helper.buf);
if (this.debug) {
console.log("Sending setObjectInfoInt", this.next_id, name, value);
}
this.next_id++; this.next_id++;
return 1; return 1;
...@@ -954,9 +855,6 @@ class Gdh { ...@@ -954,9 +855,6 @@ class Gdh {
helper.packString(name); helper.packString(name);
// this.pending[this.next_id] = new PendingData( return_cb, null); // this.pending[this.next_id] = new PendingData( return_cb, null);
this.ws.send(helper.buf); this.ws.send(helper.buf);
if (this.debug) {
console.log("Sending setObjectInfoFloat", this.next_id, name, value);
}
this.next_id++; this.next_id++;
return 1; return 1;
...@@ -969,23 +867,29 @@ class Gdh { ...@@ -969,23 +867,29 @@ class Gdh {
helper.packString(name); helper.packString(name);
// this.pending[this.next_id] = new PendingData( return_cb, null); // this.pending[this.next_id] = new PendingData( return_cb, null);
this.ws.send(helper.buf); this.ws.send(helper.buf);
if (this.debug) {
console.log("Sending setObjectInfoString", this.next_id, name, value);
}
this.next_id++; this.next_id++;
return 1; return 1;
} }
setObjectInfo(name, value, type) {
if (type === Type.Boolean) {
this.setObjectInfoBoolean(name, value);
} else if (type === Type.Float32 || type === Type.Float64) {
this.setObjectInfoFloat(name, value);
} else if (type === Type.String) {
this.setObjectInfoString(name, value);
} else {
this.setObjectInfoInt(name, value);
}
}
toggleObjectInfo(name) { toggleObjectInfo(name) {
let helper = new Uint8ArrayHelper(8 + name.length, Msg.TOGGLE_OBJECT_INFO); let helper = new Uint8ArrayHelper(8 + name.length, Msg.TOGGLE_OBJECT_INFO);
helper.pack32Bit(this.next_id); helper.pack32Bit(this.next_id);
helper.packString(name); helper.packString(name);
// this.pending[this.next_id] = new PendingData( return_cb, null); // this.pending[this.next_id] = new PendingData( return_cb, null);
this.ws.send(helper.buf); this.ws.send(helper.buf);
if (this.debug) {
console.log("Sending toggleObjectInfo", this.next_id, name);
}
this.next_id++; this.next_id++;
return 1; return 1;
...@@ -997,9 +901,6 @@ class Gdh { ...@@ -997,9 +901,6 @@ class Gdh {
helper.pack32Bit(oid.vid); helper.pack32Bit(oid.vid);
helper.pack32Bit(oid.oix); helper.pack32Bit(oid.oix);
this.pending[this.next_id] = new PendingData(return_cb, data); this.pending[this.next_id] = new PendingData(return_cb, data);
if (this.debug) {
console.log("Sending getAllXttChildren", this.next_id);
}
this.ws.send(helper.buf); this.ws.send(helper.buf);
this.next_id++; this.next_id++;
} }
...@@ -1011,10 +912,6 @@ class Gdh { ...@@ -1011,10 +912,6 @@ class Gdh {
helper.pack32Bit(oid.vid); helper.pack32Bit(oid.vid);
helper.pack32Bit(oid.oix); helper.pack32Bit(oid.oix);
this.pending[this.next_id] = new PendingData(return_cb, data); this.pending[this.next_id] = new PendingData(return_cb, data);
if (this.debug) {
console.log("Sending getAllClassAttributes", this.next_id, cid, oid.vid,
oid.oix);
}
this.ws.send(helper.buf); this.ws.send(helper.buf);
this.next_id++; this.next_id++;
} }
...@@ -1026,9 +923,6 @@ class Gdh { ...@@ -1026,9 +923,6 @@ class Gdh {
helper.pack32Bit(oid.vid); helper.pack32Bit(oid.vid);
helper.pack32Bit(oid.oix); helper.pack32Bit(oid.oix);
this.pending[this.next_id] = new PendingData(return_cb, data); this.pending[this.next_id] = new PendingData(return_cb, data);
if (this.debug) {
console.log("Sending getObject", this.next_id, oid.vid, oid.oix);
}
this.ws.send(helper.buf); this.ws.send(helper.buf);
this.next_id++; this.next_id++;
} }
...@@ -1044,9 +938,6 @@ class Gdh { ...@@ -1044,9 +938,6 @@ class Gdh {
helper.pack32Bit(aref.size); helper.pack32Bit(aref.size);
helper.pack32Bit(aref.flags); helper.pack32Bit(aref.flags);
this.pending[this.next_id] = new PendingData(return_cb, data); this.pending[this.next_id] = new PendingData(return_cb, data);
if (this.debug) {
console.log("Sending getObject", this.next_id, aref.objid.vid, aref.objid.oix);
}
this.ws.send(helper.buf); this.ws.send(helper.buf);
this.next_id++; this.next_id++;
} }
...@@ -1057,9 +948,6 @@ class Gdh { ...@@ -1057,9 +948,6 @@ class Gdh {
helper.pack16Bit(op); helper.pack16Bit(op);
helper.packString(name); helper.packString(name);
this.pending[this.next_id] = new PendingData(return_cb, data); this.pending[this.next_id] = new PendingData(return_cb, data);
if (this.debug) {
console.log("Sending getObjectFromName", this.next_id, name);
}
this.ws.send(helper.buf); this.ws.send(helper.buf);
this.next_id++; this.next_id++;
} }
...@@ -1070,9 +958,6 @@ class Gdh { ...@@ -1070,9 +958,6 @@ class Gdh {
helper.pack32Bit(oid.vid); helper.pack32Bit(oid.vid);
helper.pack32Bit(oid.oix); helper.pack32Bit(oid.oix);
this.pending[this.next_id] = new PendingData(return_cb, data); this.pending[this.next_id] = new PendingData(return_cb, data);
if (this.debug) {
console.log("Sending crrObject", this.next_id, oid.vid, oid.oix);
}
this.ws.send(helper.buf); this.ws.send(helper.buf);
this.next_id++; this.next_id++;
} }
...@@ -1082,9 +967,6 @@ class Gdh { ...@@ -1082,9 +967,6 @@ class Gdh {
helper.pack32Bit(this.next_id); helper.pack32Bit(this.next_id);
helper.packString(name); helper.packString(name);
this.pending[this.next_id] = new PendingData(return_cb, data); this.pending[this.next_id] = new PendingData(return_cb, data);
if (this.debug) {
console.log("Sending getOpwindMenu", this.next_id);
}
this.ws.send(helper.buf); this.ws.send(helper.buf);
this.next_id++; this.next_id++;
} }
...@@ -1095,9 +977,6 @@ class Gdh { ...@@ -1095,9 +977,6 @@ class Gdh {
helper.packString(user); helper.packString(user);
helper.packString(passwd); helper.packString(passwd);
this.pending[this.next_id] = new PendingData(return_cb, data); this.pending[this.next_id] = new PendingData(return_cb, data);
if (this.debug) {
console.log("Sending login", this.next_id);
}
this.ws.send(helper.buf); this.ws.send(helper.buf);
this.next_id++; this.next_id++;
} }
...@@ -1108,9 +987,6 @@ class Gdh { ...@@ -1108,9 +987,6 @@ class Gdh {
helper.pack32Bit(value); helper.pack32Bit(value);
this.pending[this.next_id] = new PendingData(return_cb, data); this.pending[this.next_id] = new PendingData(return_cb, data);
this.ws.send(helper.buf); this.ws.send(helper.buf);
if (this.debug) {
console.log("Sending getMsg", this.next_id, value);
}
this.next_id++; this.next_id++;
} }
...@@ -1119,9 +995,6 @@ class Gdh { ...@@ -1119,9 +995,6 @@ class Gdh {
helper.pack32Bit(this.next_id); helper.pack32Bit(this.next_id);
helper.pack32Bit(sync); helper.pack32Bit(sync);
this.pending[this.next_id] = new PendingData(return_cb, data); this.pending[this.next_id] = new PendingData(return_cb, data);
if (this.debug) {
console.log("Sending mhSync", this.next_id);
}
this.ws.send(helper.buf); this.ws.send(helper.buf);
this.next_id++; this.next_id++;
} }
...@@ -1133,10 +1006,6 @@ class Gdh { ...@@ -1133,10 +1006,6 @@ class Gdh {
helper.pack32Bit(event_id.idx); helper.pack32Bit(event_id.idx);
helper.packString(event_id.birthTime); helper.packString(event_id.birthTime);
this.pending[this.next_id] = new PendingData(return_cb, data); this.pending[this.next_id] = new PendingData(return_cb, data);
if (this.debug) {
console.log("Sending mhAcknowledge", this.next_id);
}
console.log("Sending mhAcknowledge", this.next_id);
this.ws.send(helper.buf); this.ws.send(helper.buf);
this.next_id++; this.next_id++;
} }
......
...@@ -707,7 +707,6 @@ class GDraw { ...@@ -707,7 +707,6 @@ class GDraw {
class PlowCtx { class PlowCtx {
gdh: Gdh = null; gdh: Gdh = null;
debug = false;
nodraw = 0; nodraw = 0;
zoom_factor = 20.0; zoom_factor = 20.0;
base_zoom_factor = 20.0; base_zoom_factor = 20.0;
......
...@@ -1551,7 +1551,6 @@ class FlowCtx extends Rect { ...@@ -1551,7 +1551,6 @@ class FlowCtx extends Rect {
gdraw: GDraw; gdraw: GDraw;
display_level = DisplayLevel.One; display_level = DisplayLevel.One;
gdh: Gdh = null; gdh: Gdh = null;
debug = false;
zoom_factor = 20.0; zoom_factor = 20.0;
base_zoom_factor = 20.0; base_zoom_factor = 20.0;
offset_x = 0; offset_x = 0;
......
...@@ -86,7 +86,7 @@ class Appl { ...@@ -86,7 +86,7 @@ class Appl {
} }
graphName = graphName.toLowerCase(); graphName = graphName.toLowerCase();
if (graphName.charAt(".pwg") === -1) { if (!graphName.endsWith(".pwg")) {
graphName += ".pwg"; graphName += ".pwg";
} }
......
...@@ -10,8 +10,7 @@ class DynParsedAttrName { ...@@ -10,8 +10,7 @@ class DynParsedAttrName {
} }
class Dyn { class Dyn {
debug = false; elements: Array<DynElem> = [];
elements = [];
graph: Graph; graph: Graph;
object = null; object = null;
dyn_type1: DynType1 = 0; dyn_type1: DynType1 = 0;
...@@ -57,7 +56,7 @@ class Dyn { ...@@ -57,7 +56,7 @@ class Dyn {
(elem.instance !== undefined && elem.instance !== xelem.instance)); (elem.instance !== undefined && elem.instance !== xelem.instance));
}); });
// Insert copy of x element // Insert copy of x element
let e = Object.assign({}, xelem); let e = <DynElem>Object.assign({}, xelem);
if (e) { if (e) {
e.dyn = this; e.dyn = this;
this.elements.push(e); this.elements.push(e);
...@@ -71,10 +70,6 @@ class Dyn { ...@@ -71,10 +70,6 @@ class Dyn {
let tokens = lines[i].split(' '); let tokens = lines[i].split(' ');
let key = parseInt(tokens[0], 10); let key = parseInt(tokens[0], 10);
if (this.debug) {
console.log("Dyn : " + lines[i]);
}
let elem = null; let elem = null;
switch (key) { switch (key) {
...@@ -417,7 +412,7 @@ class Dyn { ...@@ -417,7 +412,7 @@ class Dyn {
} }
getHostObject() { getHostObject() {
let elem = this.elements.find(e => (e.dyn_type1 & DynType1.HostObject) !== 0); let elem = <DynHostObject>this.elements.find(e => (e.dyn_type1 & DynType1.HostObject) !== 0);
return elem ? elem.hostobject : ""; return elem ? elem.hostobject : "";
} }
...@@ -531,10 +526,10 @@ class Dyn { ...@@ -531,10 +526,10 @@ class Dyn {
} }
} }
let setObjectInfo = function(func, pname, inputValue) { let setObjectInfo = function(pname, inputValue, type: Type) {
let sts = 0; let sts = 0;
if (pname.database === Database.Gdh) { if (pname.database === Database.Gdh) {
sts = e.dyn.graph.getGdh()["setObjectInfo" + func](pname.name, inputValue); sts = e.dyn.graph.getGdh().setObjectInfo(pname.name, inputValue, type);
} else if (pname.database === Database.Local) { } else if (pname.database === Database.Local) {
sts = e.dyn.graph.getLdb().setObjectInfo(this.graph, pname.name, inputValue); sts = e.dyn.graph.getLdb().setObjectInfo(this.graph, pname.name, inputValue);
} }
...@@ -569,7 +564,7 @@ class Dyn { ...@@ -569,7 +564,7 @@ class Dyn {
break; break;
} }
sts = setObjectInfo("Float", pname, inputValue); sts = setObjectInfo(pname, inputValue, e.a_typeid);
break; break;
case Type.Int32: case Type.Int32:
case Type.UInt32: case Type.UInt32:
...@@ -596,14 +591,13 @@ class Dyn { ...@@ -596,14 +591,13 @@ class Dyn {
break; break;
} }
sts = setObjectInfo("Int", pname, inputValue); sts = setObjectInfo(pname, inputValue, e.a_typeid);
break; break;
case Type.Boolean: case Type.Boolean:
let inputValueInt = parseInt(str.trim(), 10); let inputValueInt = parseInt(str.trim(), 10);
if (inputValueInt !== 0 && inputValueInt !== 1) { if (inputValueInt !== 0 && inputValueInt !== 1) {
break; break;
} }
let inputValue = Boolean(inputValueInt);
// valueElement.oldValueB = inputValue; // valueElement.oldValueB = inputValue;
...@@ -612,7 +606,7 @@ class Dyn { ...@@ -612,7 +606,7 @@ class Dyn {
break; break;
} }
sts = setObjectInfo("Boolean", pname, inputValue); sts = setObjectInfo(pname, Boolean(inputValueInt), e.a_typeid);
break; break;
case Type.String: case Type.String:
// valueElement.oldValueS = str; // valueElement.oldValueS = str;
...@@ -622,7 +616,7 @@ class Dyn { ...@@ -622,7 +616,7 @@ class Dyn {
break; break;
} }
sts = setObjectInfo("String", pname, inputValue); sts = setObjectInfo(pname, inputValue, e.a_typeid);
break; break;
} }
if (ctx_popped) { if (ctx_popped) {
...@@ -746,6 +740,7 @@ class DynElem { ...@@ -746,6 +740,7 @@ class DynElem {
dyn_type2: DynType2 = 0; dyn_type2: DynType2 = 0;
action_type1: ActionType1 = 0; action_type1: ActionType1 = 0;
action_type2: ActionType2 = 0; action_type2: ActionType2 = 0;
attribute;
prio: DynPrio; prio: DynPrio;
instance_mask = 0; instance_mask = 0;
instance: Instance = 0; instance: Instance = 0;
...@@ -772,7 +767,6 @@ class DynElem { ...@@ -772,7 +767,6 @@ class DynElem {
class DynDigLowColor extends DynElem { class DynDigLowColor extends DynElem {
a = null; a = null;
attribute;
color; color;
firstScan = true; firstScan = true;
...@@ -852,10 +846,6 @@ class DynDigLowColor extends DynElem { ...@@ -852,10 +846,6 @@ class DynDigLowColor extends DynElem {
let tokens = lines[i].split(' '); let tokens = lines[i].split(' ');
let key = parseInt(tokens[0], 10); let key = parseInt(tokens[0], 10);
if (this.dyn.debug) {
console.log("DynDigLowColor : " + lines[i]);
}
switch (key) { switch (key) {
case DynSave.DigLowColor: case DynSave.DigLowColor:
break; break;
...@@ -881,7 +871,6 @@ class DynDigLowColor extends DynElem { ...@@ -881,7 +871,6 @@ class DynDigLowColor extends DynElem {
class DynDigColor extends DynElem { class DynDigColor extends DynElem {
a = null; a = null;
attribute;
color; color;
firstScan = true; firstScan = true;
...@@ -971,10 +960,6 @@ class DynDigColor extends DynElem { ...@@ -971,10 +960,6 @@ class DynDigColor extends DynElem {
let tokens = lines[i].split(' '); let tokens = lines[i].split(' ');
let key = parseInt(tokens[0], 10); let key = parseInt(tokens[0], 10);
if (this.dyn.debug) {
console.log("DynDigColor : " + lines[i]);
}
switch (key) { switch (key) {
case DynSave.DigColor: case DynSave.DigColor:
break; break;
...@@ -1006,7 +991,6 @@ class DynDigColor extends DynElem { ...@@ -1006,7 +991,6 @@ class DynDigColor extends DynElem {
class DynDigWarning extends DynElem { class DynDigWarning extends DynElem {
a; a;
attribute;
use_colortheme; use_colortheme;
firstScan = true; firstScan = true;
...@@ -1082,10 +1066,6 @@ class DynDigWarning extends DynElem { ...@@ -1082,10 +1066,6 @@ class DynDigWarning extends DynElem {
let tokens = lines[i].split(' '); let tokens = lines[i].split(' ');
let key = parseInt(tokens[0], 10); let key = parseInt(tokens[0], 10);
if (this.dyn.debug) {
console.log("DynDigWarning : " + lines[i]);
}
switch (key) { switch (key) {
case DynSave.DigWarning: case DynSave.DigWarning:
break; break;
...@@ -1111,7 +1091,6 @@ class DynDigWarning extends DynElem { ...@@ -1111,7 +1091,6 @@ class DynDigWarning extends DynElem {
class DynDigError extends DynElem { class DynDigError extends DynElem {
a; a;
attribute;
use_colortheme; use_colortheme;
firstScan = true; firstScan = true;
...@@ -1187,10 +1166,6 @@ class DynDigError extends DynElem { ...@@ -1187,10 +1166,6 @@ class DynDigError extends DynElem {
let tokens = lines[i].split(' '); let tokens = lines[i].split(' ');
let key = parseInt(tokens[0], 10); let key = parseInt(tokens[0], 10);
if (this.dyn.debug) {
console.log("DynDigError : " + lines[i]);
}
switch (key) { switch (key) {
case DynSave.DigError: case DynSave.DigError:
break; break;
...@@ -1216,7 +1191,6 @@ class DynDigError extends DynElem { ...@@ -1216,7 +1191,6 @@ class DynDigError extends DynElem {
class DynDigFlash extends DynElem { class DynDigFlash extends DynElem {
a; a;
attribute;
color; color;
color2; color2;
firstScan = true; firstScan = true;
...@@ -1312,10 +1286,6 @@ class DynDigFlash extends DynElem { ...@@ -1312,10 +1286,6 @@ class DynDigFlash extends DynElem {
let tokens = lines[i].split(' '); let tokens = lines[i].split(' ');
let key = parseInt(tokens[0], 10); let key = parseInt(tokens[0], 10);
if (this.dyn.debug) {
console.log("DynDigError : " + lines[i]);
}
switch (key) { switch (key) {
case DynSave.DigFlash: case DynSave.DigFlash:
break; break;
...@@ -1344,7 +1314,6 @@ class DynDigFlash extends DynElem { ...@@ -1344,7 +1314,6 @@ class DynDigFlash extends DynElem {
class DynInvisible extends DynElem { class DynInvisible extends DynElem {
a; a;
attribute;
dimmed; dimmed;
firstScan = true; firstScan = true;
cmd; cmd;
...@@ -1441,10 +1410,6 @@ class DynInvisible extends DynElem { ...@@ -1441,10 +1410,6 @@ class DynInvisible extends DynElem {
let tokens = lines[i].split(' '); let tokens = lines[i].split(' ');
let key = parseInt(tokens[0], 10); let key = parseInt(tokens[0], 10);
if (this.dyn.debug) {
console.log("DynInvisible : " + lines[i]);
}
switch (key) { switch (key) {
case DynSave.Invisible: case DynSave.Invisible:
break; break;
...@@ -1476,7 +1441,6 @@ class DynInvisible extends DynElem { ...@@ -1476,7 +1441,6 @@ class DynInvisible extends DynElem {
class DynDigTextColor extends DynElem { class DynDigTextColor extends DynElem {
a = null; a = null;
attribute;
color; color;
firstScan = true; firstScan = true;
...@@ -1539,10 +1503,6 @@ class DynDigTextColor extends DynElem { ...@@ -1539,10 +1503,6 @@ class DynDigTextColor extends DynElem {
let tokens = lines[i].split(' '); let tokens = lines[i].split(' ');
let key = parseInt(tokens[0], 10); let key = parseInt(tokens[0], 10);
if (this.dyn.debug) {
console.log("DigTextColor : " + lines[i]);
}
switch (key) { switch (key) {
case DynSave.DigTextColor: case DynSave.DigTextColor:
break; break;
...@@ -1568,7 +1528,6 @@ class DynDigTextColor extends DynElem { ...@@ -1568,7 +1528,6 @@ class DynDigTextColor extends DynElem {
class DynDigText extends DynElem { class DynDigText extends DynElem {
a; a;
attribute;
low_text; low_text;
high_text; high_text;
firstScan = true; firstScan = true;
...@@ -1633,10 +1592,6 @@ class DynDigText extends DynElem { ...@@ -1633,10 +1592,6 @@ class DynDigText extends DynElem {
let tokens = lines[i].split(' '); let tokens = lines[i].split(' ');
let key = parseInt(tokens[0], 10); let key = parseInt(tokens[0], 10);
if (this.dyn.debug) {
console.log("DigText : " + lines[i]);
}
switch (key) { switch (key) {
case DynSave.DigText: case DynSave.DigText:
break; break;
...@@ -1670,7 +1625,6 @@ class DynDigText extends DynElem { ...@@ -1670,7 +1625,6 @@ class DynDigText extends DynElem {
class DynDigBorder extends DynElem { class DynDigBorder extends DynElem {
a; a;
attribute;
color; color;
firstScan = true; firstScan = true;
...@@ -1727,10 +1681,6 @@ class DynDigBorder extends DynElem { ...@@ -1727,10 +1681,6 @@ class DynDigBorder extends DynElem {
let tokens = lines[i].split(' '); let tokens = lines[i].split(' ');
let key = parseInt(tokens[0], 10); let key = parseInt(tokens[0], 10);
if (this.dyn.debug) {
console.log("DynBorder : " + lines[i]);
}
switch (key) { switch (key) {
case DynSave.DigBorder: case DynSave.DigBorder:
break; break;
...@@ -1756,7 +1706,6 @@ class DynDigBorder extends DynElem { ...@@ -1756,7 +1706,6 @@ class DynDigBorder extends DynElem {
class DynValue extends DynElem { class DynValue extends DynElem {
a; a;
attribute;
format = null; format = null;
zero_blank; zero_blank;
decimals_attr; decimals_attr;
...@@ -1798,10 +1747,7 @@ class DynValue extends DynElem { ...@@ -1798,10 +1747,7 @@ class DynValue extends DynElem {
return format; return format;
} }
decimals = ret.value - decr; decimals = Math.max(ret.value - decr, 0);
if (decimals < 0) {
decimals = 0;
}
if (decimals >= 10) { if (decimals >= 10) {
return format; return format;
} }
...@@ -1901,7 +1847,7 @@ class DynValue extends DynElem { ...@@ -1901,7 +1847,7 @@ class DynValue extends DynElem {
case Type.DeltaTime: case Type.DeltaTime:
if (this.firstScan || !(value0 === this.oldValueS)) { if (this.firstScan || !(value0 === this.oldValueS)) {
if (this.cFormat) { if (this.cFormat) {
if (this.a_typeid === Type.String) { if (this.a.typeid === Type.String) {
let sb = this.cFormat.format(value0); let sb = this.cFormat.format(value0);
object.setAnnotation(annot_num, sb); object.setAnnotation(annot_num, sb);
} else { // TODO time format } else { // TODO time format
...@@ -2019,7 +1965,6 @@ class DynValue extends DynElem { ...@@ -2019,7 +1965,6 @@ class DynValue extends DynElem {
} }
class DynValueInput extends DynElem { class DynValueInput extends DynElem {
attribute;
min_value; min_value;
max_value; max_value;
clear; clear;
...@@ -2071,10 +2016,6 @@ class DynValueInput extends DynElem { ...@@ -2071,10 +2016,6 @@ class DynValueInput extends DynElem {
let tokens = lines[i].split(' '); let tokens = lines[i].split(' ');
let key = parseInt(tokens[0], 10); let key = parseInt(tokens[0], 10);
if (this.dyn.debug) {
console.log("DynValueInput : " + lines[i]);
}
switch (key) { switch (key) {
case DynSave.ValueInput: case DynSave.ValueInput:
break; break;
...@@ -2133,7 +2074,6 @@ class DynValueInput extends DynElem { ...@@ -2133,7 +2074,6 @@ class DynValueInput extends DynElem {
class DynAnalogColor extends DynElem { class DynAnalogColor extends DynElem {
a = null; a = null;
attribute;
limit; limit;
limit_type; limit_type;
color; color;
...@@ -2332,10 +2272,6 @@ class DynAnalogColor extends DynElem { ...@@ -2332,10 +2272,6 @@ class DynAnalogColor extends DynElem {
let tokens = lines[i].split(' '); let tokens = lines[i].split(' ');
let key = parseInt(tokens[0], 10); let key = parseInt(tokens[0], 10);
if (this.dyn.debug) {
console.log("DynAnalogColor : " + lines[i]);
}
switch (key) { switch (key) {
case DynSave.AnalogColor: case DynSave.AnalogColor:
break; break;
...@@ -2379,7 +2315,6 @@ class DynAnalogColor extends DynElem { ...@@ -2379,7 +2315,6 @@ class DynAnalogColor extends DynElem {
class DynRotate extends DynElem { class DynRotate extends DynElem {
a; a;
attribute;
x0; x0;
y0; y0;
factor; factor;
...@@ -2436,10 +2371,6 @@ class DynRotate extends DynElem { ...@@ -2436,10 +2371,6 @@ class DynRotate extends DynElem {
let tokens = lines[i].split(' '); let tokens = lines[i].split(' ');
let key = parseInt(tokens[0], 10); let key = parseInt(tokens[0], 10);
if (this.dyn.debug) {
console.log("DynRotate : " + lines[i]);
}
switch (key) { switch (key) {
case DynSave.Rotate: case DynSave.Rotate:
break; break;
...@@ -2704,10 +2635,6 @@ class DynMove extends DynElem { ...@@ -2704,10 +2635,6 @@ class DynMove extends DynElem {
let tokens = lines[i].split(' '); let tokens = lines[i].split(' ');
let key = parseInt(tokens[0], 10); let key = parseInt(tokens[0], 10);
if (this.dyn.debug) {
console.log("DynMove : " + lines[i]);
}
switch (key) { switch (key) {
case DynSave.Move: case DynSave.Move:
break; break;
...@@ -2766,7 +2693,6 @@ class DynMove extends DynElem { ...@@ -2766,7 +2693,6 @@ class DynMove extends DynElem {
class DynAnalogShift extends DynElem { class DynAnalogShift extends DynElem {
a; a;
attribute;
firstScan = true; firstScan = true;
oldValueF; oldValueF;
oldValueI; oldValueI;
...@@ -2839,10 +2765,6 @@ class DynAnalogShift extends DynElem { ...@@ -2839,10 +2765,6 @@ class DynAnalogShift extends DynElem {
let tokens = lines[i].split(' '); let tokens = lines[i].split(' ');
let key = parseInt(tokens[0], 10); let key = parseInt(tokens[0], 10);
if (this.dyn.debug) {
console.log("DynAnalogShift : " + lines[i]);
}
switch (key) { switch (key) {
case DynSave.AnalogShift: case DynSave.AnalogShift:
break; break;
...@@ -2865,7 +2787,6 @@ class DynAnalogShift extends DynElem { ...@@ -2865,7 +2787,6 @@ class DynAnalogShift extends DynElem {
class DynDigShift extends DynElem { class DynDigShift extends DynElem {
a; a;
attribute;
firstScan = true; firstScan = true;
constructor(dyn) { constructor(dyn) {
...@@ -2919,10 +2840,6 @@ class DynDigShift extends DynElem { ...@@ -2919,10 +2840,6 @@ class DynDigShift extends DynElem {
let tokens = lines[i].split(' '); let tokens = lines[i].split(' ');
let key = parseInt(tokens[0], 10); let key = parseInt(tokens[0], 10);
if (this.dyn.debug) {
console.log("DynDigShift : " + lines[i]);
}
switch (key) { switch (key) {
case DynSave.DigShift: case DynSave.DigShift:
break; break;
...@@ -3032,10 +2949,6 @@ class DynDigFourShift extends DynElem { ...@@ -3032,10 +2949,6 @@ class DynDigFourShift extends DynElem {
let tokens = lines[i].split(' '); let tokens = lines[i].split(' ');
let key = parseInt(tokens[0], 10); let key = parseInt(tokens[0], 10);
if (this.dyn.debug) {
console.log("DynDigFourShift : " + lines[i]);
}
switch (key) { switch (key) {
case DynSave.DigFourShift: case DynSave.DigFourShift:
break; break;
...@@ -3068,7 +2981,6 @@ class DynDigFourShift extends DynElem { ...@@ -3068,7 +2981,6 @@ class DynDigFourShift extends DynElem {
class DynScrollingText extends DynElem { class DynScrollingText extends DynElem {
a; a;
attribute;
direction; direction;
speed; speed;
bounce; bounce;
...@@ -3207,10 +3119,6 @@ class DynScrollingText extends DynElem { ...@@ -3207,10 +3119,6 @@ class DynScrollingText extends DynElem {
let tokens = lines[i].split(' '); let tokens = lines[i].split(' ');
let key = parseInt(tokens[0], 10); let key = parseInt(tokens[0], 10);
if (this.dyn.debug) {
console.log("DynScrollingText : " + lines[i]);
}
switch (key) { switch (key) {
case DynSave.ScrollingText: case DynSave.ScrollingText:
break; break;
...@@ -3257,10 +3165,6 @@ class DynColorThemeLightness extends DynElem { ...@@ -3257,10 +3165,6 @@ class DynColorThemeLightness extends DynElem {
let tokens = lines[i].split(' '); let tokens = lines[i].split(' ');
let key = parseInt(tokens[0], 10); let key = parseInt(tokens[0], 10);
if (this.dyn.debug) {
console.log("DynColorThemeLightness : " + lines[i]);
}
switch (key) { switch (key) {
case DynSave.ColorThemeLightness: case DynSave.ColorThemeLightness:
break; break;
...@@ -3278,7 +3182,6 @@ class DynColorThemeLightness extends DynElem { ...@@ -3278,7 +3182,6 @@ class DynColorThemeLightness extends DynElem {
class DynDigBackgroundColor extends DynElem { class DynDigBackgroundColor extends DynElem {
a = null; a = null;
attribute;
color; color;
firstScan = true; firstScan = true;
...@@ -3346,10 +3249,6 @@ class DynDigBackgroundColor extends DynElem { ...@@ -3346,10 +3249,6 @@ class DynDigBackgroundColor extends DynElem {
let tokens = lines[i].split(' '); let tokens = lines[i].split(' ');
let key = parseInt(tokens[0], 10); let key = parseInt(tokens[0], 10);
if (this.dyn.debug) {
console.log("DynDigBackgroundColor : " + lines[i]);
}
switch (key) { switch (key) {
case DynSave.DigBackgroundColor: case DynSave.DigBackgroundColor:
break; break;
...@@ -3381,7 +3280,6 @@ class DynDigBackgroundColor extends DynElem { ...@@ -3381,7 +3280,6 @@ class DynDigBackgroundColor extends DynElem {
class DynDigSwap extends DynElem { class DynDigSwap extends DynElem {
a; a;
attribute;
reset_value; reset_value;
firstScan = true; firstScan = true;
...@@ -3439,10 +3337,6 @@ class DynDigSwap extends DynElem { ...@@ -3439,10 +3337,6 @@ class DynDigSwap extends DynElem {
let tokens = lines[i].split(' '); let tokens = lines[i].split(' ');
let key = parseInt(tokens[0], 10); let key = parseInt(tokens[0], 10);
if (this.dyn.debug) {
console.log("DynDigSwap : " + lines[i]);
}
switch (key) { switch (key) {
case DynSave.DigSwap: case DynSave.DigSwap:
break; break;
...@@ -3468,7 +3362,6 @@ class DynDigSwap extends DynElem { ...@@ -3468,7 +3362,6 @@ class DynDigSwap extends DynElem {
class DynAnimation extends DynElem { class DynAnimation extends DynElem {
a; a;
attribute;
sequence; sequence;
firstScan = true; firstScan = true;
animation_count; animation_count;
...@@ -3613,10 +3506,6 @@ class DynAnimation extends DynElem { ...@@ -3613,10 +3506,6 @@ class DynAnimation extends DynElem {
let tokens = lines[i].split(' '); let tokens = lines[i].split(' ');
let key = parseInt(tokens[0], 10); let key = parseInt(tokens[0], 10);
if (this.dyn.debug) {
console.log("Animation : " + lines[i]);
}
switch (key) { switch (key) {
case DynSave.Animation: case DynSave.Animation:
break; break;
...@@ -3652,10 +3541,6 @@ class DynVideo extends DynElem { ...@@ -3652,10 +3541,6 @@ class DynVideo extends DynElem {
let tokens = lines[i].split(' '); let tokens = lines[i].split(' ');
let key = parseInt(tokens[0], 10); let key = parseInt(tokens[0], 10);
if (this.dyn.debug) {
console.log("Video : " + lines[i]);
}
switch (key) { switch (key) {
case DynSave.Video: case DynSave.Video:
break; break;
...@@ -3770,10 +3655,6 @@ class DynBar extends DynElem { ...@@ -3770,10 +3655,6 @@ class DynBar extends DynElem {
let tokens = lines[i].split(' '); let tokens = lines[i].split(' ');
let key = parseInt(tokens[0], 10); let key = parseInt(tokens[0], 10);
if (this.dyn.debug) {
console.log("DynBar : " + lines[i]);
}
switch (key) { switch (key) {
case DynSave.Bar: case DynSave.Bar:
break; break;
...@@ -4057,7 +3938,7 @@ class DynTrend extends DynElem { ...@@ -4057,7 +3938,7 @@ class DynTrend extends DynElem {
this.acc_time += this.dyn.graph.getFastScanTime(); this.acc_time += this.dyn.graph.getFastScanTime();
} }
if (this.acc_time + Number.MIN_VALUE >= this.scan_time) { if (this.acc_time + Number.MIN_VALUE >= this.scan_time) {
if (this.p1 !== 0) { if (this.a1 !== 0) {
switch (this.a1.typeid) { switch (this.a1.typeid) {
case Type.Boolean: case Type.Boolean:
object.add_value(Boolean(this.a1.get_ref_value(this.dyn)), 0); object.add_value(Boolean(this.a1.get_ref_value(this.dyn)), 0);
...@@ -4095,10 +3976,6 @@ class DynTrend extends DynElem { ...@@ -4095,10 +3976,6 @@ class DynTrend extends DynElem {
let tokens = lines[i].split(' '); let tokens = lines[i].split(' ');
let key = parseInt(tokens[0], 10); let key = parseInt(tokens[0], 10);
if (this.dyn.debug) {
console.log("DynTrend : " + lines[i]);
}
switch (key) { switch (key) {
case DynSave.Trend: case DynSave.Trend:
break; break;
...@@ -4226,10 +4103,6 @@ class DynXY_Curve extends DynElem { ...@@ -4226,10 +4103,6 @@ class DynXY_Curve extends DynElem {
let tokens = lines[i].split(' '); let tokens = lines[i].split(' ');
let key = parseInt(tokens[0], 10); let key = parseInt(tokens[0], 10);
if (this.dyn.debug) {
console.log("DynXYCurve : " + lines[i]);
}
switch (key) { switch (key) {
case DynSave.XY_Curve: case DynSave.XY_Curve:
break; break;
...@@ -4579,38 +4452,6 @@ class DynXY_Curve extends DynElem { ...@@ -4579,38 +4452,6 @@ class DynXY_Curve extends DynElem {
static scan2(id, self, sts, value) { static scan2(id, self, sts, value) {
switch (self.xAttrType) { switch (self.xAttrType) {
case Type.Float32: case Type.Float32:
if (!(sts & 1)) {
return;
}
switch (self.datatype) {
case CurveDataType.XYArrays:
self.curveX = value.slice(0, self.noOfPoints);
break;
case CurveDataType.PointArray:
self.curveX = new Array(self.noOfPoints);
self.curveY = new Array(self.noOfPoints);
for (let i = 0; i < self.noOfPoints; i++) {
self.curveX[i] = value[2 * i];
self.curveY[i] = value[2 * i + 1];
}
self.dyn.repaintNow = true;
break;
case CurveDataType.TableObject:
self.noOfPoints = Math.min(Math.floor(value[0]), self.noofpoints);
if (attrSize < self.noOfPoints) {
self.noOfPoints = attrSize;
}
self.curveY = new Array(self.noOfPoints);
self.curveX = new Array(self.noOfPoints);
for (let i = 0; i < self.noOfPoints; i++) {
self.curveX[i] = value[2 * i + 1];
self.curveY[i] = value[2 * i + 2];
}
self.dyn.repaintNow = true;
break;
}
break;
case Type.Int32: case Type.Int32:
case Type.Int16: case Type.Int16:
case Type.Int8: case Type.Int8:
...@@ -4635,9 +4476,6 @@ class DynXY_Curve extends DynElem { ...@@ -4635,9 +4476,6 @@ class DynXY_Curve extends DynElem {
break; break;
case CurveDataType.TableObject: case CurveDataType.TableObject:
self.noOfPoints = Math.min(Math.floor(value[0]), self.noofpoints); self.noOfPoints = Math.min(Math.floor(value[0]), self.noofpoints);
if (attrSize < self.noOfPoints) {
self.noOfPoints = attrSize;
}
self.curveY = new Array(self.noOfPoints); self.curveY = new Array(self.noOfPoints);
self.curveX = new Array(self.noOfPoints); self.curveX = new Array(self.noOfPoints);
for (let i = 0; i < self.noOfPoints; i++) { for (let i = 0; i < self.noOfPoints; i++) {
...@@ -4734,10 +4572,6 @@ class DynPie extends DynElem { ...@@ -4734,10 +4572,6 @@ class DynPie extends DynElem {
let tokens = lines[i].split(' '); let tokens = lines[i].split(' ');
let key = parseInt(tokens[0], 10); let key = parseInt(tokens[0], 10);
if (this.dyn.debug) {
console.log("DynPie : " + lines[i]);
}
switch (key) { switch (key) {
case DynSave.Pie: case DynSave.Pie:
break; break;
...@@ -4945,10 +4779,6 @@ class DynBarChart extends DynElem { ...@@ -4945,10 +4779,6 @@ class DynBarChart extends DynElem {
let tokens = lines[i].split(' '); let tokens = lines[i].split(' ');
let key = parseInt(tokens[0], 10); let key = parseInt(tokens[0], 10);
if (this.dyn.debug) {
console.log("DynBarChart : " + lines[i]);
}
if (key === DynSave.End) { if (key === DynSave.End) {
return i; return i;
} else if (key === DynSave.BarChart_fix_range) { } else if (key === DynSave.BarChart_fix_range) {
...@@ -5109,10 +4939,6 @@ class DynTable extends DynElem { ...@@ -5109,10 +4939,6 @@ class DynTable extends DynElem {
let tokens = lines[i].split(' '); let tokens = lines[i].split(' ');
let key = parseInt(tokens[0], 10); let key = parseInt(tokens[0], 10);
if (this.dyn.debug) {
console.log("DynTable : " + lines[i]);
}
if (key === DynSave.End) { if (key === DynSave.End) {
return i; return i;
} else if (key >= DynSave.Table_attribute1 && key <= DynSave.Table_attribute12) { } else if (key >= DynSave.Table_attribute1 && key <= DynSave.Table_attribute12) {
...@@ -5268,7 +5094,7 @@ class DynTable extends DynElem { ...@@ -5268,7 +5094,7 @@ class DynTable extends DynElem {
this.sel_p[i] = this.dyn.graph.getGdh() this.sel_p[i] = this.dyn.graph.getGdh()
.refObjectInfo(pname.tname, pname.type, pname.elements); .refObjectInfo(pname.tname, pname.type, pname.elements);
if (this.sel_p[i] !== 0) { if (this.sel_p[i] !== 0) {
if (ret.getElements() === 0) { if (pname.elements === 0) {
break; break;
} }
this.sel_elements[i] = Math.min(pname.elements, this.elements[i]); this.sel_elements[i] = Math.min(pname.elements, this.elements[i]);
...@@ -5367,7 +5193,6 @@ class DynTable extends DynElem { ...@@ -5367,7 +5193,6 @@ class DynTable extends DynElem {
} else { } else {
object.setValue("0", i, j); object.setValue("0", i, j);
} }
object.setValue(sb, i, j);
this.oldValueB[i][j] = val; this.oldValueB[i][j] = val;
} }
break; break;
...@@ -5587,7 +5412,6 @@ class DynTable extends DynElem { ...@@ -5587,7 +5412,6 @@ class DynTable extends DynElem {
class DynStatusColor extends DynElem { class DynStatusColor extends DynElem {
a; a;
attribute;
nostatus_color; nostatus_color;
use_colortheme; use_colortheme;
firstScan = true; firstScan = true;
...@@ -5721,10 +5545,6 @@ class DynStatusColor extends DynElem { ...@@ -5721,10 +5545,6 @@ class DynStatusColor extends DynElem {
let tokens = lines[i].split(' '); let tokens = lines[i].split(' ');
let key = parseInt(tokens[0], 10); let key = parseInt(tokens[0], 10);
if (this.dyn.debug) {
console.log("DynStatusColor : " + lines[i]);
}
switch (key) { switch (key) {
case DynSave.StatusColor: case DynSave.StatusColor:
break; break;
...@@ -5771,10 +5591,6 @@ class DynAxis extends DynElem { ...@@ -5771,10 +5591,6 @@ class DynAxis extends DynElem {
let tokens = lines[i].split(' '); let tokens = lines[i].split(' ');
let key = parseInt(tokens[0], 10); let key = parseInt(tokens[0], 10);
if (this.dyn.debug) {
console.log("DynAxis : " + lines[i]);
}
switch (key) { switch (key) {
case DynSave.Axis: case DynSave.Axis:
break; break;
...@@ -5896,10 +5712,6 @@ class DynTimeoutColor extends DynElem { ...@@ -5896,10 +5712,6 @@ class DynTimeoutColor extends DynElem {
let tokens = lines[i].split(' '); let tokens = lines[i].split(' ');
let key = parseInt(tokens[0], 10); let key = parseInt(tokens[0], 10);
if (this.dyn.debug) {
console.log("DynTimeoutColor : " + lines[i]);
}
switch (key) { switch (key) {
case DynSave.TimeoutColor: case DynSave.TimeoutColor:
break; break;
...@@ -5935,10 +5747,6 @@ class DynHostObject extends DynElem { ...@@ -5935,10 +5747,6 @@ class DynHostObject extends DynElem {
let tokens = lines[i].split(' '); let tokens = lines[i].split(' ');
let key = parseInt(tokens[0], 10); let key = parseInt(tokens[0], 10);
if (this.dyn.debug) {
console.log("DynHostObject : " + lines[i]);
}
switch (key) { switch (key) {
case DynSave.HostObject: case DynSave.HostObject:
break; break;
...@@ -5960,7 +5768,6 @@ class DynHostObject extends DynElem { ...@@ -5960,7 +5768,6 @@ class DynHostObject extends DynElem {
} }
class DynDigSound extends DynElem { class DynDigSound extends DynElem {
attribute;
soundobject; soundobject;
level; level;
interval; interval;
...@@ -5976,10 +5783,6 @@ class DynDigSound extends DynElem { ...@@ -5976,10 +5783,6 @@ class DynDigSound extends DynElem {
let tokens = lines[i].split(' '); let tokens = lines[i].split(' ');
let key = parseInt(tokens[0], 10); let key = parseInt(tokens[0], 10);
if (this.dyn.debug) {
console.log("DynDigSound : " + lines[i]);
}
switch (key) { switch (key) {
case DynSave.DigSound: case DynSave.DigSound:
break; break;
...@@ -6021,7 +5824,6 @@ class DynFillLevel extends DynElem { ...@@ -6021,7 +5824,6 @@ class DynFillLevel extends DynElem {
a = null; a = null;
minvalue_a; minvalue_a;
maxvalue_a; maxvalue_a;
attribute;
color; color;
direction; direction;
max_value; max_value;
...@@ -6155,10 +5957,6 @@ class DynFillLevel extends DynElem { ...@@ -6155,10 +5957,6 @@ class DynFillLevel extends DynElem {
let tokens = lines[i].split(' '); let tokens = lines[i].split(' ');
let key = parseInt(tokens[0], 10); let key = parseInt(tokens[0], 10);
if (this.dyn.debug) {
console.log("DynFillLevel : " + lines[i]);
}
switch (key) { switch (key) {
case DynSave.FillLevel: case DynSave.FillLevel:
break; break;
...@@ -6202,8 +6000,6 @@ class DynFillLevel extends DynElem { ...@@ -6202,8 +6000,6 @@ class DynFillLevel extends DynElem {
} }
class DynSetDig extends DynElem { class DynSetDig extends DynElem {
attribute;
constructor(dyn) { constructor(dyn) {
super(dyn, DynPrio.SetDig); super(dyn, DynPrio.SetDig);
this.action_type1 = ActionType1.SetDig; this.action_type1 = ActionType1.SetDig;
...@@ -6259,10 +6055,6 @@ class DynSetDig extends DynElem { ...@@ -6259,10 +6055,6 @@ class DynSetDig extends DynElem {
let tokens = lines[i].split(' '); let tokens = lines[i].split(' ');
let key = parseInt(tokens[0], 10); let key = parseInt(tokens[0], 10);
if (this.dyn.debug) {
console.log("DynSetDig : " + lines[i]);
}
switch (key) { switch (key) {
case DynSave.SetDig: case DynSave.SetDig:
break; break;
...@@ -6290,8 +6082,6 @@ class DynSetDig extends DynElem { ...@@ -6290,8 +6082,6 @@ class DynSetDig extends DynElem {
} }
class DynResetDig extends DynElem { class DynResetDig extends DynElem {
attribute;
constructor(dyn) { constructor(dyn) {
super(dyn, DynPrio.ResetDig); super(dyn, DynPrio.ResetDig);
this.action_type1 = ActionType1.ResetDig; this.action_type1 = ActionType1.ResetDig;
...@@ -6347,10 +6137,6 @@ class DynResetDig extends DynElem { ...@@ -6347,10 +6137,6 @@ class DynResetDig extends DynElem {
let tokens = lines[i].split(' '); let tokens = lines[i].split(' ');
let key = parseInt(tokens[0], 10); let key = parseInt(tokens[0], 10);
if (this.dyn.debug) {
console.log("DynResetDig : " + lines[i]);
}
switch (key) { switch (key) {
case DynSave.ResetDig: case DynSave.ResetDig:
break; break;
...@@ -6378,8 +6164,6 @@ class DynResetDig extends DynElem { ...@@ -6378,8 +6164,6 @@ class DynResetDig extends DynElem {
} }
class DynToggleDig extends DynElem { class DynToggleDig extends DynElem {
attribute;
constructor(dyn) { constructor(dyn) {
super(dyn, DynPrio.ToggleDig); super(dyn, DynPrio.ToggleDig);
this.action_type1 = ActionType1.ToggleDig; this.action_type1 = ActionType1.ToggleDig;
...@@ -6431,10 +6215,6 @@ class DynToggleDig extends DynElem { ...@@ -6431,10 +6215,6 @@ class DynToggleDig extends DynElem {
let tokens = lines[i].split(' '); let tokens = lines[i].split(' ');
let key = parseInt(tokens[0], 10); let key = parseInt(tokens[0], 10);
if (this.dyn.debug) {
console.log("DynToggleDig : " + lines[i]);
}
switch (key) { switch (key) {
case DynSave.ToggleDig: case DynSave.ToggleDig:
break; break;
...@@ -6456,8 +6236,6 @@ class DynToggleDig extends DynElem { ...@@ -6456,8 +6236,6 @@ class DynToggleDig extends DynElem {
} }
class DynStoDig extends DynElem { class DynStoDig extends DynElem {
attribute;
constructor(dyn) { constructor(dyn) {
super(dyn, DynPrio.StoDig); super(dyn, DynPrio.StoDig);
this.action_type1 = ActionType1.StoDig; this.action_type1 = ActionType1.StoDig;
...@@ -6505,10 +6283,6 @@ class DynStoDig extends DynElem { ...@@ -6505,10 +6283,6 @@ class DynStoDig extends DynElem {
let tokens = lines[i].split(' '); let tokens = lines[i].split(' ');
let key = parseInt(tokens[0], 10); let key = parseInt(tokens[0], 10);
if (this.dyn.debug) {
console.log("DynToggleDig : " + lines[i]);
}
switch (key) { switch (key) {
case DynSave.StoDig: case DynSave.StoDig:
break; break;
...@@ -6582,10 +6356,6 @@ class DynCommand extends DynElem { ...@@ -6582,10 +6356,6 @@ class DynCommand extends DynElem {
let tokens = lines[i].split(' '); let tokens = lines[i].split(' ');
let key = parseInt(tokens[0], 10); let key = parseInt(tokens[0], 10);
if (this.dyn.debug) {
console.log("DynCommand : " + lines[i]);
}
switch (key) { switch (key) {
case DynSave.Command: case DynSave.Command:
break; break;
...@@ -6648,10 +6418,6 @@ class DynScript extends DynElem { ...@@ -6648,10 +6418,6 @@ class DynScript extends DynElem {
let tokens = lines[i].split(' '); let tokens = lines[i].split(' ');
let key = parseInt(tokens[0], 10); let key = parseInt(tokens[0], 10);
if (this.dyn.debug) {
console.log("DynScript : " + lines[i]);
}
switch (key) { switch (key) {
case DynSave.Script: case DynSave.Script:
break; break;
...@@ -6724,7 +6490,7 @@ class DynCommandDoubleClick extends DynElem { ...@@ -6724,7 +6490,7 @@ class DynCommandDoubleClick extends DynElem {
object.setColorInverse(e.event === Event.MB1Down); object.setColorInverse(e.event === Event.MB1Down);
this.dyn.repaintNow = true; this.dyn.repaintNow = true;
break; break;
case Event.MB1ClickDoubleClick: case Event.MB1DoubleClick:
if ((this.dyn.action_type1 & ActionType1.Confirm) !== 0) { if ((this.dyn.action_type1 & ActionType1.Confirm) !== 0) {
break; break;
} }
...@@ -6748,10 +6514,6 @@ class DynCommandDoubleClick extends DynElem { ...@@ -6748,10 +6514,6 @@ class DynCommandDoubleClick extends DynElem {
let tokens = lines[i].split(' '); let tokens = lines[i].split(' ');
let key = parseInt(tokens[0], 10); let key = parseInt(tokens[0], 10);
if (this.dyn.debug) {
console.log("DynCommandDoubleClick : " + lines[i]);
}
switch (key) { switch (key) {
case DynSave.CommandDC: case DynSave.CommandDC:
break; break;
...@@ -6794,20 +6556,17 @@ class DynConfirm extends DynElem { ...@@ -6794,20 +6556,17 @@ class DynConfirm extends DynElem {
switch (e.event) { switch (e.event) {
case Event.MB1Down: case Event.MB1Down:
break; break;
case Event.Key_Return:
case Event.MB1Click: case Event.MB1Click:
case Event.ValueChanged:
let skip = 0; let skip = 0;
if (((this.on_set !== 0 && this.on_reset === 0) || if (((this.on_set !== 0 && this.on_reset === 0) ||
(this.on_reset !== 0 && this.on_set === 0)) && (this.on_reset !== 0 && this.on_set === 0)) &&
(this.dyn.total_action_type1 & ActionType1.ToggleDig) !== 0) { (this.dyn.total_action_type1 & ActionType1.ToggleDig) !== 0) {
for (let j = 0; j < this.dyn.elements.length; j++) { for (let j = 0; j < this.dyn.elements.length; j++) {
if (this.dyn.elements.get(j).action_type1 === if (this.dyn.elements[j].action_type1 === ActionType1.ToggleDig) {
ActionType1.ToggleDig) { let pname = this.dyn.parseAttrName(this.dyn.elements[j].attribute);
let pname = this.dyn.parseAttrName(
this.dyn.elements.get(j).attribute);
if (pname.name.substring(0, 1) === "&") { if (pname.name.substring(0, 1) === "&") {
pname.name = this.dyn.graph.get_reference_name(pname.name); pname.name = this.dyn.graph.getReferenceName(pname.name);
} }
switch (pname.database) { switch (pname.database) {
...@@ -6851,10 +6610,6 @@ class DynConfirm extends DynElem { ...@@ -6851,10 +6610,6 @@ class DynConfirm extends DynElem {
let tokens = lines[i].split(' '); let tokens = lines[i].split(' ');
let key = parseInt(tokens[0], 10); let key = parseInt(tokens[0], 10);
if (this.dyn.debug) {
console.log("DynConfirm : " + lines[i]);
}
switch (key) { switch (key) {
case DynSave.Confirm: case DynSave.Confirm:
break; break;
...@@ -6882,7 +6637,6 @@ class DynConfirm extends DynElem { ...@@ -6882,7 +6637,6 @@ class DynConfirm extends DynElem {
} }
class DynIncrAnalog extends DynElem { class DynIncrAnalog extends DynElem {
attribute;
increment; increment;
min_value; min_value;
max_value; max_value;
...@@ -6979,10 +6733,6 @@ class DynIncrAnalog extends DynElem { ...@@ -6979,10 +6733,6 @@ class DynIncrAnalog extends DynElem {
let tokens = lines[i].split(' '); let tokens = lines[i].split(' ');
let key = parseInt(tokens[0], 10); let key = parseInt(tokens[0], 10);
if (this.dyn.debug) {
console.log("DynConfirm : " + lines[i]);
}
switch (key) { switch (key) {
case DynSave.IncrAnalog: case DynSave.IncrAnalog:
break; break;
...@@ -7014,7 +6764,6 @@ class DynIncrAnalog extends DynElem { ...@@ -7014,7 +6764,6 @@ class DynIncrAnalog extends DynElem {
class DynRadioButton extends DynElem { class DynRadioButton extends DynElem {
a; a;
attribute;
firstScan = true; firstScan = true;
constructor(dyn) { constructor(dyn) {
...@@ -7109,7 +6858,7 @@ class DynRadioButton extends DynElem { ...@@ -7109,7 +6858,7 @@ class DynRadioButton extends DynElem {
let pname = this.dyn.parseAttrName( let pname = this.dyn.parseAttrName(
gm_dyn.elements[j].attribute); gm_dyn.elements[j].attribute);
if (pname.name.substring(0, 1) === "&") { if (pname.name.substring(0, 1) === "&") {
pname.name = this.dyn.graph.get_reference_name(pname.name); pname.name = this.dyn.graph.getReferenceName(pname.name);
} }
setObjectInfo(pname, value); setObjectInfo(pname, value);
} }
...@@ -7120,7 +6869,7 @@ class DynRadioButton extends DynElem { ...@@ -7120,7 +6869,7 @@ class DynRadioButton extends DynElem {
let pname = this.dyn.parseAttrName(this.attribute); let pname = this.dyn.parseAttrName(this.attribute);
if (pname.name.substring(0, 1) === "&") { if (pname.name.substring(0, 1) === "&") {
pname.name = this.dyn.graph.get_reference_name(pname.name); pname.name = this.dyn.graph.getReferenceName(pname.name);
} }
value = true; value = true;
...@@ -7137,10 +6886,6 @@ class DynRadioButton extends DynElem { ...@@ -7137,10 +6886,6 @@ class DynRadioButton extends DynElem {
let tokens = lines[i].split(' '); let tokens = lines[i].split(' ');
let key = parseInt(tokens[0], 10); let key = parseInt(tokens[0], 10);
if (this.dyn.debug) {
console.log("DynRadioButton : " + lines[i]);
}
switch (key) { switch (key) {
case DynSave.RadioButton: case DynSave.RadioButton:
break; break;
...@@ -7175,10 +6920,6 @@ class DynTipText extends DynElem { ...@@ -7175,10 +6920,6 @@ class DynTipText extends DynElem {
let tokens = lines[i].split(' '); let tokens = lines[i].split(' ');
let key = parseInt(tokens[0], 10); let key = parseInt(tokens[0], 10);
if (this.dyn.debug) {
console.log("DynTipText : " + lines[i]);
}
switch (key) { switch (key) {
case DynSave.TipText: case DynSave.TipText:
break; break;
...@@ -7242,10 +6983,6 @@ class DynHelp extends DynElem { ...@@ -7242,10 +6983,6 @@ class DynHelp extends DynElem {
let tokens = lines[i].split(' '); let tokens = lines[i].split(' ');
let key = parseInt(tokens[0], 10); let key = parseInt(tokens[0], 10);
if (this.dyn.debug) {
console.log("DynHelp : " + lines[i]);
}
switch (key) { switch (key) {
case DynSave.Help: case DynSave.Help:
break; break;
...@@ -7297,12 +7034,12 @@ class DynOpenGraph extends DynElem { ...@@ -7297,12 +7034,12 @@ class DynOpenGraph extends DynElem {
if (this.graph_object === null || this.graph_object === "") { if (this.graph_object === null || this.graph_object === "") {
// Open classgraph for popup menu object // Open classgraph for popup menu object
if ((this.dyn.total_action_type1 & ActionType1.PopupMenu) !== 0) { if ((this.dyn.total_action_type1 & ActionType1.PopupMenu) !== 0) {
let obj = this.dyn.elements.find(e => e.action_type1 === ActionType1.PopupMenu); let obj = <DynPopupMenu>this.dyn.elements.find(e => e.action_type1 === ActionType1.PopupMenu);
if (obj) { if (obj) {
this.dyn.graph.command("open graph/class/instance=" + obj.ref_object); this.dyn.graph.command("open graph/class/instance=" + obj.ref_object);
} }
} else if ((this.dyn.total_dyn_type1 & DynType1.HostObject) !== 0) { } else if ((this.dyn.total_dyn_type1 & DynType1.HostObject) !== 0) {
let obj = this.dyn.elements.find(e => e.dyn_type1 === DynType1.HostObject); let obj = <DynHostObject>this.dyn.elements.find(e => e.dyn_type1 === DynType1.HostObject);
if (obj) { if (obj) {
this.dyn.graph.command("open graph/class/instance=" + obj.hostobject); this.dyn.graph.command("open graph/class/instance=" + obj.hostobject);
} }
...@@ -7322,10 +7059,6 @@ class DynOpenGraph extends DynElem { ...@@ -7322,10 +7059,6 @@ class DynOpenGraph extends DynElem {
let tokens = lines[i].split(' '); let tokens = lines[i].split(' ');
let key = parseInt(tokens[0], 10); let key = parseInt(tokens[0], 10);
if (this.dyn.debug) {
console.log("DynOpenGraph : " + lines[i]);
}
switch (key) { switch (key) {
case DynSave.OpenGraph: case DynSave.OpenGraph:
break; break;
...@@ -7383,10 +7116,6 @@ class DynOpenURL extends DynElem { ...@@ -7383,10 +7116,6 @@ class DynOpenURL extends DynElem {
let tokens = lines[i].split(' '); let tokens = lines[i].split(' ');
let key = parseInt(tokens[0], 10); let key = parseInt(tokens[0], 10);
if (this.dyn.debug) {
console.log("DynOpenURL : " + lines[i]);
}
switch (key) { switch (key) {
case DynSave.OpenURL: case DynSave.OpenURL:
break; break;
...@@ -7428,10 +7157,6 @@ class DynInputFocus extends DynElem { ...@@ -7428,10 +7157,6 @@ class DynInputFocus extends DynElem {
let tokens = lines[i].split(' '); let tokens = lines[i].split(' ');
let key = parseInt(tokens[0], 10); let key = parseInt(tokens[0], 10);
if (this.dyn.debug) {
console.log("DynInputFocus : " + lines[i]);
}
switch (key) { switch (key) {
case DynSave.InputFocus: case DynSave.InputFocus:
break; break;
...@@ -7793,7 +7518,7 @@ class DynSlider extends DynElem { ...@@ -7793,7 +7518,7 @@ class DynSlider extends DynElem {
let info = object.get_info(); let info = object.get_info();
if (info.min_position !== info.max_position) { if (info.min_position !== info.max_position) {
if (!(this.max_value_p !== 0 && this.min_value_p !== 0 && if (!(this.max_value !== 0 && this.min_value !== 0 &&
this.max_value !== this.min_value)) { this.max_value !== this.min_value)) {
this.max_value = info.max_value; this.max_value = info.max_value;
this.min_value = info.min_value; this.min_value = info.min_value;
...@@ -7824,7 +7549,7 @@ class DynSlider extends DynElem { ...@@ -7824,7 +7549,7 @@ class DynSlider extends DynElem {
let setObjectInfo = function(pname, value, type) { let setObjectInfo = function(pname, value, type) {
if (pname.database === Database.Gdh) { if (pname.database === Database.Gdh) {
return this.dyn.graph.getGdh()["setObjectInfo" + type](pname.name, value); return this.dyn.graph.getGdh().setObjectInfo(pname.name, value, type);
} else if (pname.database === Database.Local) { } else if (pname.database === Database.Local) {
return this.dyn.graph.getLdb().setObjectInfo(this.dyn.graph, pname.name, value); return this.dyn.graph.getLdb().setObjectInfo(this.dyn.graph, pname.name, value);
} else { } else {
...@@ -7835,14 +7560,14 @@ class DynSlider extends DynElem { ...@@ -7835,14 +7560,14 @@ class DynSlider extends DynElem {
let sts; let sts;
switch (pname.type) { switch (pname.type) {
case Type.Float32: case Type.Float32:
sts = setObjectInfo(pname, value, "Float"); sts = setObjectInfo(pname, value, pname.type);
break; break;
case Type.Boolean: case Type.Boolean:
sts = setObjectInfo(pname, (value > 0.5), "Boolean"); sts = setObjectInfo(pname, (value > 0.5), pname.type);
break; break;
default: default:
let ivalue = Math.floor(value > 0 ? value + 0.5 : value - 0.5); let ivalue = Math.floor(value > 0 ? value + 0.5 : value - 0.5);
sts = setObjectInfo(pname, ivalue, "Int"); sts = setObjectInfo(pname, ivalue, pname.type);
} }
if (even(sts)) { if (even(sts)) {
console.log("Slider error: " + this.attribute); console.log("Slider error: " + this.attribute);
...@@ -7861,10 +7586,6 @@ class DynSlider extends DynElem { ...@@ -7861,10 +7586,6 @@ class DynSlider extends DynElem {
let tokens = lines[i].split(' '); let tokens = lines[i].split(' ');
let key = parseInt(tokens[0], 10); let key = parseInt(tokens[0], 10);
if (this.dyn.debug) {
console.log("DynSlider : " + lines[i]);
}
switch (key) { switch (key) {
case DynSave.Slider: case DynSave.Slider:
break; break;
...@@ -7921,10 +7642,6 @@ class DynFastCurve extends DynElem { ...@@ -7921,10 +7642,6 @@ class DynFastCurve extends DynElem {
let tokens = lines[i].split(' '); let tokens = lines[i].split(' ');
let key = parseInt(tokens[0], 10); let key = parseInt(tokens[0], 10);
if (this.dyn.debug) {
console.log("DynSlider : " + lines[i]);
}
switch (key) { switch (key) {
case DynSave.FastCurve: case DynSave.FastCurve:
break; break;
...@@ -8150,7 +7867,6 @@ class DynPulldownMenu extends DynElem { ...@@ -8150,7 +7867,6 @@ class DynPulldownMenu extends DynElem {
class DynOptionMenu extends DynElem { class DynOptionMenu extends DynElem {
a; a;
update_a = null; update_a = null;
attribute;
text_attribute; text_attribute;
size_attribute; size_attribute;
update_attribute; update_attribute;
...@@ -8415,10 +8131,6 @@ class DynOptionMenu extends DynElem { ...@@ -8415,10 +8131,6 @@ class DynOptionMenu extends DynElem {
let tokens = lines[i].split(' '); let tokens = lines[i].split(' ');
let key = parseInt(tokens[0], 10); let key = parseInt(tokens[0], 10);
if (this.dyn.debug) {
console.log("OptionsMenu : " + lines[i]);
}
if (key >= DynSave.OptionMenu_items_text0 && key <= DynSave.OptionMenu_items_text31) { if (key >= DynSave.OptionMenu_items_text0 && key <= DynSave.OptionMenu_items_text31) {
if (tokens.length > 1) { if (tokens.length > 1) {
this.items_text[key - DynSave.OptionMenu_items_text0] = lines[i].substring(5); this.items_text[key - DynSave.OptionMenu_items_text0] = lines[i].substring(5);
...@@ -8487,10 +8199,6 @@ class DynAnalogText extends DynOptionMenu { ...@@ -8487,10 +8199,6 @@ class DynAnalogText extends DynOptionMenu {
let tokens = lines[i].split(' '); let tokens = lines[i].split(' ');
let key = parseInt(tokens[0], 10); let key = parseInt(tokens[0], 10);
if (this.dyn.debug) {
console.log("AnalogText : " + lines[i]);
}
switch (key) { switch (key) {
case DynSave.AnalogText: case DynSave.AnalogText:
break; break;
...@@ -8510,7 +8218,6 @@ class DynAnalogText extends DynOptionMenu { ...@@ -8510,7 +8218,6 @@ class DynAnalogText extends DynOptionMenu {
} }
class DynSetValue extends DynElem { class DynSetValue extends DynElem {
attribute;
value; value;
constructor(dyn) { constructor(dyn) {
...@@ -8524,10 +8231,6 @@ class DynSetValue extends DynElem { ...@@ -8524,10 +8231,6 @@ class DynSetValue extends DynElem {
let tokens = lines[i].split(' '); let tokens = lines[i].split(' ');
let key = parseInt(tokens[0], 10); let key = parseInt(tokens[0], 10);
if (this.dyn.debug) {
console.log("AnalogText : " + lines[i]);
}
switch (key) { switch (key) {
case DynSave.SetValue: case DynSave.SetValue:
break; break;
...@@ -8580,7 +8283,7 @@ class DynSetValue extends DynElem { ...@@ -8580,7 +8283,7 @@ class DynSetValue extends DynElem {
let setObjectInfo = function(pname, value, type) { let setObjectInfo = function(pname, value, type) {
let sts = 0; let sts = 0;
if (pname.database === Database.Gdh) { if (pname.database === Database.Gdh) {
sts = this.dyn.graph.getGdh()["setObjectInfo" + type](pname.name, value); sts = this.dyn.graph.getGdh().setObjectInfo(pname.name, value, type);
} else if (pname.database === Database.Local) { } else if (pname.database === Database.Local) {
sts = this.dyn.graph.getLdb().setObjectInfo(this.dyn.graph, pname.name, value); sts = this.dyn.graph.getLdb().setObjectInfo(this.dyn.graph, pname.name, value);
} }
...@@ -8594,7 +8297,7 @@ class DynSetValue extends DynElem { ...@@ -8594,7 +8297,7 @@ class DynSetValue extends DynElem {
switch (pname.type) { switch (pname.type) {
case Type.Float32: case Type.Float32:
let inputValue = parseFloat(this.value.trim()); let inputValue = parseFloat(this.value.trim());
sts = setObjectInfo(pname, inputValue, "Float"); sts = setObjectInfo(pname, inputValue, pname.type);
if (even(sts)) { if (even(sts)) {
return 0; return 0;
} }
...@@ -8608,7 +8311,7 @@ class DynSetValue extends DynElem { ...@@ -8608,7 +8311,7 @@ class DynSetValue extends DynElem {
case Type.Mask: case Type.Mask:
case Type.Enum: case Type.Enum:
let inputValue = parseInt(this.value.trim(), 10); let inputValue = parseInt(this.value.trim(), 10);
sts = setObjectInfo(pname, inputValue, "Int"); sts = setObjectInfo(pname, inputValue, pname.type);
if (even(sts)) { if (even(sts)) {
return 0; return 0;
} }
...@@ -8624,13 +8327,13 @@ class DynSetValue extends DynElem { ...@@ -8624,13 +8327,13 @@ class DynSetValue extends DynElem {
break; break;
} }
sts = setObjectInfo(pname, inputValue, "Boolean"); sts = setObjectInfo(pname, inputValue, pname.type);
if (even(sts)) { if (even(sts)) {
return 0; return 0;
} }
break; break;
case Type.String: case Type.String:
sts = setObjectInfo(pname, inputValue, "String"); sts = setObjectInfo(pname, inputValue, pname.type);
if (even(sts)) { if (even(sts)) {
return 0; return 0;
} }
...@@ -8651,7 +8354,7 @@ class DynMethodToolbar extends DynElem { ...@@ -8651,7 +8354,7 @@ class DynMethodToolbar extends DynElem {
method_object; method_object;
toolbar_type; toolbar_type;
pname; pname_name;
xm_mask_flags = 0; xm_mask_flags = 0;
xm_mask_opmethods = 0; xm_mask_opmethods = 0;
xm_mask_mntmethods = 0; xm_mask_mntmethods = 0;
...@@ -8670,10 +8373,6 @@ class DynMethodToolbar extends DynElem { ...@@ -8670,10 +8373,6 @@ class DynMethodToolbar extends DynElem {
let tokens = lines[i].split(' '); let tokens = lines[i].split(' ');
let key = parseInt(tokens[0], 10); let key = parseInt(tokens[0], 10);
if (this.dyn.debug) {
console.log("MethodToolbar : " + lines[i]);
}
switch (key) { switch (key) {
case DynSave.MethodToolbar: case DynSave.MethodToolbar:
break; break;
...@@ -9257,10 +8956,6 @@ class DynPopupMenu extends DynElem { ...@@ -9257,10 +8956,6 @@ class DynPopupMenu extends DynElem {
let tokens = lines[i].split(' '); let tokens = lines[i].split(' ');
let key = parseInt(tokens[0], 10); let key = parseInt(tokens[0], 10);
if (this.dyn.debug) {
console.log("DynResetDig : " + lines[i]);
}
switch (key) { switch (key) {
case DynSave.PopupMenu: case DynSave.PopupMenu:
break; break;
......
...@@ -75,7 +75,7 @@ class GraphLocalDb { ...@@ -75,7 +75,7 @@ class GraphLocalDb {
let typeId = this.getTypeId(attributeName); let typeId = this.getTypeId(attributeName);
let name = this.getName(attributeName); let name = this.getName(attributeName);
if (typeId === 0) { if (typeId === 0) {
return i; return 0;
} }
let id = this.nameToId(owner, name); let id = this.nameToId(owner, name);
...@@ -212,7 +212,7 @@ class Graph { ...@@ -212,7 +212,7 @@ class Graph {
constructor(appl) { constructor(appl) {
this.appl = appl; this.appl = appl;
if (typeof InstallTrigger !== 'undefined') { if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1) {
// Firefox is not os fast... // Firefox is not os fast...
this.scan_time = 1; this.scan_time = 1;
this.fast_scan_time = 1; this.fast_scan_time = 1;
...@@ -306,9 +306,6 @@ class Graph { ...@@ -306,9 +306,6 @@ class Graph {
return ret; return ret;
} }
let dyn = new Dyn(this); let dyn = new Dyn(this);
if (type !== UserdataCbType.NodeClass) {
dyn.userdata = this;
}
ret.userdata = dyn; ret.userdata = dyn;
ret.row = dyn.open(lines, row); ret.row = dyn.open(lines, row);
} }
...@@ -354,7 +351,6 @@ class Graph { ...@@ -354,7 +351,6 @@ class Graph {
case Event.MB1Down: case Event.MB1Down:
case Event.MB1DoubleClick: case Event.MB1DoubleClick:
case Event.MB3Press: case Event.MB3Press:
case Event.ValueChanged:
case Event.SliderMoveStart: case Event.SliderMoveStart:
case Event.SliderMoveEnd: case Event.SliderMoveEnd:
case Event.SliderMoved: case Event.SliderMoved:
...@@ -712,6 +708,18 @@ class Graph { ...@@ -712,6 +708,18 @@ class Graph {
return Math.min(this.scan_time, this.animation_scan_time); return Math.min(this.scan_time, this.animation_scan_time);
} }
setScanTime(scan_time) {
this.scan_time = scan_time;
}
setFastScanTime(fast_scan_time) {
this.fast_scan_time = fast_scan_time;
}
setAnimationScanTime(animation_scan_time) {
this.animation_scan_time = animation_scan_time;
}
command(cmd) { command(cmd) {
if (this.appl) { if (this.appl) {
return this.appl.command(cmd); return this.appl.command(cmd);
...@@ -754,4 +762,9 @@ class Graph { ...@@ -754,4 +762,9 @@ class Graph {
loadCtx(file, read_cb) { loadCtx(file, read_cb) {
return this.frame.readGrowWindow(file, read_cb); return this.frame.readGrowWindow(file, read_cb);
} }
getReferenceName(name) {
// TODO
return null;
}
} }
\ No newline at end of file
...@@ -1653,20 +1653,93 @@ enum EventType { ...@@ -1653,20 +1653,93 @@ enum EventType {
} }
enum Event { enum Event {
Null,
MB1Click, MB1Click,
MB1Up = 2,
MB1Down,
MB1DoubleClick, MB1DoubleClick,
CursorMotion, MB1Press,
MB2Click,
MB2DoubleClick,
MB2Press,
MB1ClickShift,
MB1DoubleClickShift,
MB1PressShift,
MB2ClickShift,
MB2DoubleClickShift,
MB2PressShift,
MB1ClickCtrl,
MB1DoubleClickCtrl,
MB1PressCtrl,
MB2ClickCtrl,
MB2DoubleClickCtrl,
MB2PressCtrl,
MB1ClickShiftCtrl,
MB1DoubleClickShiftCtrl,
MB1PressShiftCtrl,
MB2ClickShiftCtrl,
MB2DoubleClickShiftCtrl,
MB2PressShiftCtrl,
MB3Click,
MB3Press,
ButtonRelease,
ButtonMotion, ButtonMotion,
ValueChanged, Exposure,
MenuCreate, Enter,
MenuActivated, Leave,
MenuDelete, CursorMotion,
Init,
PasteSequenceStart,
PasteSequenceEnd,
VisibilityUnobscured,
VisibilityObscured,
SelectClear,
ObjectMoved,
ObjectDeleted,
AnnotationInput,
Radiobutton,
Key_Return,
Key_Up,
Key_Down,
Key_Right,
Key_Left,
Key_PageUp,
Key_PageDown,
Key_BackSpace,
Key_PF1,
Key_PF2,
Key_PF3,
Key_PF4,
CreateGrowObject,
GrowDynamics,
SliderMoveStart, SliderMoveStart,
SliderMoved,
SliderMoveEnd, SliderMoveEnd,
MB3Press, SliderMoved,
HotRequest,
MB1Down,
MB1Up,
MB2Down,
MB2Up,
MB3Down,
MB3Up,
Key_Tab,
Map,
Unmap,
Resized,
Translate,
TipText,
Key_Ascii,
InputFocusLost,
InputFocusGained,
InputFocusInit,
Key_CtrlAscii,
Key_ShiftTab,
Key_Escape,
MenuActivated,
MenuCreate,
MenuDelete,
ScrollUp,
ScrollDown,
AnteUndo,
PostUndo,
Signal Signal
} }
......
...@@ -329,7 +329,6 @@ class GlowColor { ...@@ -329,7 +329,6 @@ class GlowColor {
} }
class GlowCustomColors { class GlowCustomColors {
debug = false;
colors_size = DrawType.CustomColor__ - DrawType.CustomColor1; colors_size = DrawType.CustomColor__ - DrawType.CustomColor1;
colors = new Array(this.colors_size); colors = new Array(this.colors_size);
colortheme_lightness = 0; colortheme_lightness = 0;
...@@ -380,10 +379,6 @@ class GlowCustomColors { ...@@ -380,10 +379,6 @@ class GlowCustomColors {
this.colors[j][0] = parseFloat(tokens[0]); this.colors[j][0] = parseFloat(tokens[0]);
this.colors[j][1] = parseFloat(tokens[1]); this.colors[j][1] = parseFloat(tokens[1]);
this.colors[j][2] = parseFloat(tokens[2]); this.colors[j][2] = parseFloat(tokens[2]);
if (this.debug) {
console.log(j, this.colors[j][0], this.colors[j][1],
this.colors[j][2]);
}
} }
break; break;
case GlowSave.End: case GlowSave.End:
......
...@@ -13,7 +13,6 @@ class GrowCtxWindow { ...@@ -13,7 +13,6 @@ class GrowCtxWindow {
class GrowCtx extends Rect { class GrowCtx extends Rect {
appl = null; appl = null;
debug = false;
antiAliasing = 0; antiAliasing = 0;
name = null; name = null;
version = 0; version = 0;
...@@ -110,10 +109,6 @@ class GrowCtx extends Rect { ...@@ -110,10 +109,6 @@ class GrowCtx extends Rect {
let tokens = lines[i].split(' '); let tokens = lines[i].split(' ');
let key = parseInt(tokens[0], 10); let key = parseInt(tokens[0], 10);
if (this.debug) {
console.log("ctx : " + lines[i]);
}
switch (key) { switch (key) {
case GlowSave.Ctx: case GlowSave.Ctx:
break; break;
......
...@@ -470,10 +470,6 @@ class GrowTrend extends GrowRect { ...@@ -470,10 +470,6 @@ class GrowTrend extends GrowRect {
return null; return null;
} }
getClassUserData() {
return this.nc.userdata;
}
getUserData() { getUserData() {
return this.userdata; return this.userdata;
} }
......
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