Commit 867fdfb6 authored by Christoffer Ackelman's avatar Christoffer Ackelman

Web: Minor cleanup.

parent 121334c9
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
class CliTable { class CliTable {
command: string; command: string;
qualifier: Array<string>; qualifier: Array<string>;
constructor(command, qualifier) { constructor(command, qualifier) {
this.command = command; this.command = command;
this.qualifier = qualifier; this.qualifier = qualifier;
...@@ -32,19 +33,16 @@ enum State { ...@@ -32,19 +33,16 @@ enum State {
} }
class Cli { class Cli {
verb: Array; verb: Array = new Array(CliC.VERB_VECT_SIZE);
qualifier: Array; qualifier: Array = new Array(30);
qualValue: Array; qualValue: Array = new Array(30);
status: number; status: number;
cliTableIndex: number; cliTableIndex: number;
cliQualifierIndex: Array; cliQualifierIndex: Array = new Array(30);
configuredVerbs: number; configuredVerbs: number;
cliTable: Array<CliTable>; cliTable: Array<CliTable>;
constructor(cliTable) { constructor(cliTable) {
this.verb = new Array(CliC.VERB_VECT_SIZE);
this.qualifier = new Array(30);
this.qualValue = new Array(30);
this.cliQualifierIndex = new Array(30);
this.cliTable = cliTable; this.cliTable = cliTable;
} }
...@@ -161,7 +159,7 @@ class Cli { ...@@ -161,7 +159,7 @@ class Cli {
state = State.SPACE; state = State.SPACE;
} else if (c === '/') { } else if (c === '/') {
this.qualValue[this.qualifier.length - 1] = this.qualValue[this.qualifier.length - 1] =
cmd.substring(start_pos, i); cmd.substring(start_pos, i);
state = State.QUAL; state = State.QUAL;
start_pos = i; start_pos = i;
} }
...@@ -169,7 +167,7 @@ class Cli { ...@@ -169,7 +167,7 @@ class Cli {
case State.QUALVALUE_EXACT: case State.QUALVALUE_EXACT:
if (c === '"') { if (c === '"') {
this.qualValue[this.qualifier.length - 1] = this.qualValue[this.qualifier.length - 1] =
cmd.substring(start_pos, i); cmd.substring(start_pos, i);
state = State.SPACE; state = State.SPACE;
} }
break; break;
...@@ -248,7 +246,7 @@ class Cli { ...@@ -248,7 +246,7 @@ class Cli {
continue; continue;
} }
if (this.verb[0] === if (this.verb[0] ===
(this.cliTable[i].command.substring(0, this.verb[0].length))) { (this.cliTable[i].command.substring(0, this.verb[0].length))) {
this.verb[0] = this.cliTable[i].command; this.verb[0] = this.cliTable[i].command;
found = true; found = true;
break; break;
...@@ -291,12 +289,12 @@ class Cli { ...@@ -291,12 +289,12 @@ class Cli {
break; break;
} }
if (this.qualifier[j].length > if (this.qualifier[j].length >
this.cliTable[this.cliTableIndex].qualifier[i].length) { this.cliTable[this.cliTableIndex].qualifier[i].length) {
continue; continue;
} }
if (this.qualifier[j] === if (this.qualifier[j] ===
(this.cliTable[this.cliTableIndex].qualifier[i].substring(0, (this.cliTable[this.cliTableIndex].qualifier[i].substring(0,
this.qualifier[j].length))) { this.qualifier[j].length))) {
this.cliQualifierIndex[j] = i; this.cliQualifierIndex[j] = i;
found = true; found = true;
this.qualifier[j] = this.cliTable[this.cliTableIndex].qualifier[i]; this.qualifier[j] = this.cliTable[this.cliTableIndex].qualifier[i];
......
...@@ -130,15 +130,13 @@ class GlowBarChartInfo { ...@@ -130,15 +130,13 @@ class GlowBarChartInfo {
class GlowTableInfo { class GlowTableInfo {
columns; columns;
rows; rows;
column_size: Array; column_size: Array = new Array(30);
constructor() {
this.column_size = new Array(30);
}
} }
class PendingData { class PendingData {
func_cb: (id: number, val: number, sts: number = 0, res: number = 0) => void; func_cb: (id: number, val: number, sts: number = 0, res: number = 0) => void;
data: object; data: object;
constructor(func_cb, data) { constructor(func_cb, data) {
this.func_cb = func_cb; this.func_cb = func_cb;
this.data = data; this.data = data;
...@@ -227,6 +225,7 @@ enum Msg { ...@@ -227,6 +225,7 @@ enum Msg {
class Uint8ArrayHelper { class Uint8ArrayHelper {
buf: Uint8Array; buf: Uint8Array;
idx: number; idx: number;
constructor(size, tag) { constructor(size, tag) {
this.buf = new Uint8Array(size); this.buf = new Uint8Array(size);
this.buf[0] = tag; this.buf[0] = tag;
...@@ -255,10 +254,10 @@ class Uint8ArrayHelper { ...@@ -255,10 +254,10 @@ class Uint8ArrayHelper {
class DataViewHelper { class DataViewHelper {
dv: DataView; dv: DataView;
offset: number; offset = 0;
constructor(data: ArrayBuffer) { constructor(data: ArrayBuffer) {
this.dv = new DataView(data); this.dv = new DataView(data);
this.offset = 0;
} }
getUint8() { getUint8() {
...@@ -266,11 +265,6 @@ class DataViewHelper { ...@@ -266,11 +265,6 @@ class DataViewHelper {
return this.dv.getUint8(this.offset - 1); return this.dv.getUint8(this.offset - 1);
} }
getInt16() {
this.offset += 2;
return this.dv.getInt16(this.offset - 2);
}
getUint16() { getUint16() {
this.offset += 2; this.offset += 2;
return this.dv.getUint8(this.offset - 2); return this.dv.getUint8(this.offset - 2);
...@@ -302,32 +296,17 @@ class DataViewHelper { ...@@ -302,32 +296,17 @@ class DataViewHelper {
} }
class Gdh { class Gdh {
debug: boolean; debug = false;
pending: Array; pending: Array = [];
sub: Array<Sub>; sub: Array<Sub> = [];
PORT: number; static PORT = 4448;
ws: WebSocket; ws: WebSocket = null;
open_cb: () => void; return_cb: () => void = null;
close_cb: () => void; next_id = 1234;
return_cb: () => void; subscriptionCount = 1;
next_id: number; listSent = false;
subscriptionCount: number;
listSent: boolean; constructor(open_cb, close_cb = null) {
constructor() {
this.debug = false;
this.pending = [];
this.sub = [];
this.PORT = 4448;
this.ws = null;
this.open_cb = null;
this.close_cb = null;
this.return_cb = null;
this.next_id = 1234;
this.subscriptionCount = 1;
this.listSent = false;
}
init() {
if (window.location.hostname === "") { if (window.location.hostname === "") {
this.ws = new WebSocket("ws:127.0.0.1:4448"); this.ws = new WebSocket("ws:127.0.0.1:4448");
} else { } else {
...@@ -336,8 +315,8 @@ class Gdh { ...@@ -336,8 +315,8 @@ class Gdh {
this.ws.binaryType = "arraybuffer"; this.ws.binaryType = "arraybuffer";
this.ws.onopen = function (e) { this.ws.onopen = function (e) {
if (this.gdh.open_cb !== null) { if (open_cb !== null) {
this.gdh.open_cb(); open_cb();
} }
}; };
...@@ -345,8 +324,8 @@ class Gdh { ...@@ -345,8 +324,8 @@ class Gdh {
if (this.debug) { if (this.debug) {
console.log("Socket closed"); console.log("Socket closed");
} }
if (this.gdh.close_cb !== null) { if (close_cb !== null) {
this.gdh.close_cb(); close_cb();
} }
}; };
...@@ -465,7 +444,7 @@ class Gdh { ...@@ -465,7 +444,7 @@ class Gdh {
let elements = esize; let elements = esize;
if (elements !== sub.elements) { if (elements !== sub.elements) {
console.log("Subscription size error", elements, console.log("Subscription size error", elements,
sub.elements, eid); sub.elements, eid);
} }
value = new Array(elements); value = new Array(elements);
for (let k = 0; k < elements; k++) { for (let k = 0; k < elements; k++) {
...@@ -480,7 +459,7 @@ class Gdh { ...@@ -480,7 +459,7 @@ class Gdh {
let elements = esize / 4; let elements = esize / 4;
if (elements !== sub.elements) { if (elements !== sub.elements) {
console.log("Subscription size error", elements, console.log("Subscription size error", elements,
sub.elements, eid); sub.elements, eid);
} }
value = new Array(elements); value = new Array(elements);
for (let k = 0; k < elements; k++) { for (let k = 0; k < elements; k++) {
...@@ -505,7 +484,7 @@ class Gdh { ...@@ -505,7 +484,7 @@ class Gdh {
let elements = esize / 4; let elements = esize / 4;
if (elements !== sub.elements) { if (elements !== sub.elements) {
console.log("Subscription size error", elements, console.log("Subscription size error", elements,
sub.elements, eid); sub.elements, eid);
} }
value = new Array(elements); value = new Array(elements);
for (let k = 0; k < elements; k++) { for (let k = 0; k < elements; k++) {
...@@ -524,7 +503,7 @@ class Gdh { ...@@ -524,7 +503,7 @@ class Gdh {
let elements = sub.elements; let elements = sub.elements;
if (elements !== sub.elements) { if (elements !== sub.elements) {
console.log("Subscription size error", elements, console.log("Subscription size error", elements,
sub.elements, eid); sub.elements, eid);
} }
value = new Array(elements); value = new Array(elements);
for (let l = 0; l < elements; l++) { for (let l = 0; l < elements; l++) {
...@@ -827,7 +806,7 @@ class Gdh { ...@@ -827,7 +806,7 @@ class Gdh {
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) { if (this.debug) {
console.log("Sending RefObjectInfo", this.next_id, size); console.log("Sending RefObjectInfo", this.next_id, size);
} }
...@@ -858,7 +837,7 @@ class Gdh { ...@@ -858,7 +837,7 @@ class Gdh {
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) { if (this.debug) {
console.log("Sending UnrefObjectInfo", this.next_id, size, refid); console.log("Sending UnrefObjectInfo", this.next_id, size, refid);
} }
...@@ -1037,7 +1016,7 @@ class Gdh { ...@@ -1037,7 +1016,7 @@ class Gdh {
this.pending[this.next_id] = new PendingData(return_cb, data); this.pending[this.next_id] = new PendingData(return_cb, data);
if (this.debug) { if (this.debug) {
console.log("Sending getAllClassAttributes", this.next_id, cid, oid.vid, console.log("Sending getAllClassAttributes", this.next_id, cid, oid.vid,
oid.oix); oid.oix);
} }
this.ws.send(helper.buf); this.ws.send(helper.buf);
this.next_id++; this.next_id++;
......
...@@ -122,15 +122,13 @@ enum Event { ...@@ -122,15 +122,13 @@ enum Event {
class PlowNodeClass { class PlowNodeClass {
a: PlowArray; a: PlowArray;
ctx: PlowCtx; ctx: PlowCtx;
nc_name: string; nc_name = "";
group: number; group = 0;
node_open: number; node_open = 0;
constructor(ctx) { constructor(ctx) {
this.a = new PlowArray(ctx); this.a = new PlowArray(ctx);
this.ctx = ctx; this.ctx = ctx;
this.nc_name = "";
this.group = 0;
this.node_open = 0;
} }
draw(g, p, node, highlight) { draw(g, p, node, highlight) {
...@@ -143,10 +141,10 @@ class PlowNodeClass { ...@@ -143,10 +141,10 @@ class PlowNodeClass {
} }
class PlowArray { class PlowArray {
a: Array<PlowNode>; a: Array = [];
ctx: PlowCtx; ctx: PlowCtx;
constructor(ctx) { constructor(ctx) {
this.a = [];
this.ctx = ctx; this.ctx = ctx;
} }
...@@ -391,56 +389,35 @@ class PlowArray { ...@@ -391,56 +389,35 @@ class PlowArray {
class PlowNode { class PlowNode {
ctx: PlowCtx; ctx: PlowCtx;
userdata: object; userdata: object = null;
x_right: number; x_right = 0.0;
x_left: number; x_left = 0.0;
y_high: number; y_high = 0.0;
y_low: number; y_low = 0.0;
nc: PlowNodeClass; nc: PlowNodeClass;
pos: Point; pos = new Point();
n_name: string; n_name = "";
annotv: Array; annotv = [];
annotsize: Array; annotsize = [];
pixmapv: Array; pixmapv = [];
trace_object: string; trace_object = "";
trace_attribute: string; trace_attribute = "";
trace_attr_type: number; trace_attr_type = 0;
highlight: boolean; highlight = false;
select: boolean; select = false;
invert: boolean; invert = false;
level: number; level: number;
node_open: number; node_open = 0;
fill_color: number; fill_color = 0;
p: number; p = 0;
old_value: number; old_value = 0;
first_scan: boolean; first_scan = true;
relative_position: number; relative_position = 0;
constructor(ctx, nc, level) { constructor(ctx, nc, level) {
this.ctx = ctx; this.ctx = ctx;
this.userdata = null;
this.x_right = 0.0;
this.x_left = 0.0;
this.y_high = 0.0;
this.y_low = 0.0;
this.nc = nc; this.nc = nc;
this.pos = new Point();
this.n_name = "";
this.annotv = [];
this.annotsize = [];
this.pixmapv = [];
this.trace_object = "";
this.trace_attribute = "";
this.trace_attr_type = 0;
this.highlight = false;
this.select = false;
this.invert = false;
this.level = level; this.level = level;
this.node_open = 0;
this.fill_color = 0;
this.p = 0;
this.old_value = 0;
this.first_scan = true;
this.relative_position = 0;
} }
set_annotation(number, text) { set_annotation(number, text) {
...@@ -518,9 +495,9 @@ class PlowNode { ...@@ -518,9 +495,9 @@ class PlowNode {
event_handler(event, x, y) { event_handler(event, x, y) {
if ((x - this.ctx.offset_x) / this.ctx.zoom_factor >= this.x_left && if ((x - this.ctx.offset_x) / this.ctx.zoom_factor >= this.x_left &&
(x - this.ctx.offset_x) / this.ctx.zoom_factor <= this.x_right && (x - this.ctx.offset_x) / this.ctx.zoom_factor <= this.x_right &&
(y - this.ctx.offset_y) / this.ctx.zoom_factor >= this.y_low && (y - this.ctx.offset_y) / this.ctx.zoom_factor >= this.y_low &&
(y - this.ctx.offset_y) / this.ctx.zoom_factor <= this.y_high) { (y - this.ctx.offset_y) / this.ctx.zoom_factor <= this.y_high) {
this.ctx.event_object = this; this.ctx.event_object = this;
return 1; return 1;
} }
...@@ -557,7 +534,7 @@ class PlowNode { ...@@ -557,7 +534,7 @@ class PlowNode {
in_icon(x, y) { in_icon(x, y) {
return x >= this.x_left * this.ctx.zoom_factor && x <= return x >= this.x_left * this.ctx.zoom_factor && x <=
(this.x_left + 1.75) * this.ctx.zoom_factor; (this.x_left + 1.75) * this.ctx.zoom_factor;
} }
measure() { measure() {
...@@ -570,13 +547,14 @@ class PlowNode { ...@@ -570,13 +547,14 @@ class PlowNode {
} }
class PlowAnnot { class PlowAnnot {
RELATIVE_OFFSET = 1; static RELATIVE_OFFSET = 1;
ctx: PlowCtx; ctx: PlowCtx;
p: Point; p: Point;
draw_type: number; draw_type: number;
text_size: number; text_size: number;
annot_type: number; annot_type: number;
number: number; number: number;
constructor(ctx, x, y, text_size, text_color, annot_type, number) { constructor(ctx, x, y, text_size, text_color, annot_type, number) {
this.p = new Point(x, y); this.p = new Point(x, y);
this.draw_type = text_color; this.draw_type = text_color;
...@@ -596,7 +574,7 @@ class PlowAnnot { ...@@ -596,7 +574,7 @@ class PlowAnnot {
let tsize = 0; let tsize = 0;
let idx = this.ctx.zoom_factor / this.ctx.base_zoom_factor * let idx = this.ctx.zoom_factor / this.ctx.base_zoom_factor *
(this.text_size + 4) - 4; (this.text_size + 4) - 4;
if (idx < 0) { if (idx < 0) {
return; return;
} }
...@@ -646,8 +624,8 @@ class PlowAnnot { ...@@ -646,8 +624,8 @@ class PlowAnnot {
let y = (this.p.y + p0.y) * this.ctx.zoom_factor - tsize / 4; let y = (this.p.y + p0.y) * this.ctx.zoom_factor - tsize / 4;
if ((this.annot_type & RELATIVE_POSITION) !== 0) { if ((this.annot_type & RELATIVE_POSITION) !== 0) {
let rel_x = (p0.x + node.relative_position + this.RELATIVE_OFFSET) * let rel_x = (p0.x + node.relative_position + PlowAnnot.RELATIVE_OFFSET) *
this.ctx.zoom_factor; this.ctx.zoom_factor;
if (x < rel_x) { if (x < rel_x) {
x = rel_x; x = rel_x;
} }
...@@ -659,10 +637,10 @@ class PlowAnnot { ...@@ -659,10 +637,10 @@ class PlowAnnot {
y += tsize * 1.4; y += tsize * 1.4;
} }
if ((this.annot_type & NEXT_RELATIVE_POSITION) !== 0 || if ((this.annot_type & NEXT_RELATIVE_POSITION) !== 0 ||
(this.annot_type & RELATIVE_POSITION) !== 0) { (this.annot_type & RELATIVE_POSITION) !== 0) {
node.relative_position = node.relative_position =
(x + g.measureText(node.annotv[this.number]).width) / (x + g.measureText(node.annotv[this.number]).width) /
this.ctx.zoom_factor - p0.x; this.ctx.zoom_factor - p0.x;
} }
} }
...@@ -674,6 +652,7 @@ class PlowAnnotPixmap { ...@@ -674,6 +652,7 @@ class PlowAnnotPixmap {
ctx: PlowCtx; ctx: PlowCtx;
p: Point; p: Point;
number: number; number: number;
constructor(ctx, x, y, number) { constructor(ctx, x, y, number) {
this.p = new Point(x, y); this.p = new Point(x, y);
this.number = number; this.number = number;
...@@ -704,7 +683,7 @@ class PlowAnnotPixmap { ...@@ -704,7 +683,7 @@ class PlowAnnotPixmap {
img.onload = function () { img.onload = function () {
for (let i = 0; i < Bitmaps.pending[bix].length; i++) { for (let i = 0; i < Bitmaps.pending[bix].length; i++) {
gctx.drawImage(img, Bitmaps.pending[bix][i].x, gctx.drawImage(img, Bitmaps.pending[bix][i].x,
Bitmaps.pending[bix][i].y); Bitmaps.pending[bix][i].y);
} }
Bitmaps.pending[bix] = null; Bitmaps.pending[bix] = null;
} }
...@@ -729,6 +708,7 @@ class PlowRect { ...@@ -729,6 +708,7 @@ class PlowRect {
fill_color: number; fill_color: number;
fill: number; fill: number;
fix_color: number; fix_color: number;
constructor(ctx, x, y, width, height, fill_color, border_color, fill, fix_color) { constructor(ctx, x, y, width, height, fill_color, border_color, fill, fix_color) {
this.ll = new Point(x, y); this.ll = new Point(x, y);
this.ur = new Point(x + width, y + height); this.ur = new Point(x + width, y + height);
...@@ -817,6 +797,7 @@ class GDraw { ...@@ -817,6 +797,7 @@ class GDraw {
canvas: HTMLCanvasElement; canvas: HTMLCanvasElement;
gctx: CanvasRenderingContext2D; gctx: CanvasRenderingContext2D;
offset_top: number; offset_top: number;
constructor(ctx) { constructor(ctx) {
this.ctx = ctx; this.ctx = ctx;
this.canvas = document.querySelector("canvas"); this.canvas = document.querySelector("canvas");
...@@ -826,43 +807,29 @@ class GDraw { ...@@ -826,43 +807,29 @@ class GDraw {
} }
class PlowCtx { class PlowCtx {
gdh: Gdh; gdh: Gdh = null;
debug: boolean; debug = false;
nodraw: number; nodraw = 0;
zoom_factor: number; zoom_factor = 20.0;
base_zoom_factor: number; base_zoom_factor = 20.0;
offset_x: number; offset_x = 0;
offset_y: number; offset_y = 0;
x_right: number; x_right = 0.0;
x_left: number; x_left = 0.0;
y_high: number; y_high = 0.0;
y_low: number; y_low = 0.0;
a: PlowArray; a: PlowArray;
a_nc: PlowArray; a_nc: PlowArray;
name: string; name = "Claes context";
gdraw: GDraw; gdraw: GDraw;
select_object: PlowNode; select_object: PlowNode = null;
event_cb: (event: object, object: PlowNode, x: number, y: number) => void; event_cb: (event: object, object: PlowNode, x: number, y: number) => void = null;
event_object: PlowNode; event_object: PlowNode = null;
constructor() { constructor() {
this.gdh = null;
this.debug = false;
this.nodraw = 0;
this.zoom_factor = 20.0;
this.base_zoom_factor = 20.0;
this.offset_x = 0;
this.offset_y = 0;
this.x_right = 0.0;
this.x_left = 0.0;
this.y_high = 0.0;
this.y_low = 0.0;
this.a = new PlowArray(this); this.a = new PlowArray(this);
this.a_nc = new PlowArray(this); this.a_nc = new PlowArray(this);
this.name = "Claes context";
this.gdraw = new GDraw(this); this.gdraw = new GDraw(this);
this.select_object = null;
this.event_cb = null;
this.event_object = null;
} }
draw() { draw() {
...@@ -871,7 +838,7 @@ class PlowCtx { ...@@ -871,7 +838,7 @@ class PlowCtx {
} }
this.gdraw.gctx.fillStyle = "white"; this.gdraw.gctx.fillStyle = "white";
this.gdraw.gctx.fillRect(0, 0, this.gdraw.canvas.width, this.gdraw.gctx.fillRect(0, 0, this.gdraw.canvas.width,
this.gdraw.canvas.height); this.gdraw.canvas.height);
this.a.draw(this.gdraw.gctx, null, null, false); this.a.draw(this.gdraw.gctx, null, null, false);
} }
...@@ -1002,13 +969,13 @@ class PlowCtx { ...@@ -1002,13 +969,13 @@ class PlowCtx {
is_visible(o) { is_visible(o) {
return (o.y_high * this.zoom_factor <= window.pageYOffset + return (o.y_high * this.zoom_factor <= window.pageYOffset +
window.innerHeight - this.gdraw.offset_top) && window.innerHeight - this.gdraw.offset_top) &&
(o.y_low * this.zoom_factor >= window.pageYOffset - (o.y_low * this.zoom_factor >= window.pageYOffset -
this.gdraw.offset_top); this.gdraw.offset_top);
} }
scroll(y, factor) { scroll(y, factor) {
window.scrollTo(window.scrollX, y * this.zoom_factor - window.innerHeight * window.scrollTo(window.scrollX, y * this.zoom_factor - window.innerHeight *
factor + this.gdraw.offset_top) factor + this.gdraw.offset_top)
}; };
} }
\ No newline at end of file
...@@ -159,6 +159,7 @@ enum XttMntMethodsMask { ...@@ -159,6 +159,7 @@ enum XttMntMethodsMask {
class PwrtObjid { class PwrtObjid {
vid: number; vid: number;
oix: number; oix: number;
constructor(vid, oix) { constructor(vid, oix) {
this.oix = oix; this.oix = oix;
this.vid = vid; this.vid = vid;
...@@ -176,6 +177,7 @@ class PwrtAttrRef { ...@@ -176,6 +177,7 @@ class PwrtAttrRef {
class CdhrNumber { class CdhrNumber {
value: number; value: number;
sts: number; sts: number;
constructor(value, sts) { constructor(value, sts) {
this.value = value; this.value = value;
this.sts = sts; this.sts = sts;
...@@ -195,9 +197,11 @@ class UserdataCbReturn { ...@@ -195,9 +197,11 @@ class UserdataCbReturn {
class Point { class Point {
x = 0; x = 0;
y = 0; y = 0;
constructor() { constructor() {
} }
constructor(x: number, y:number) {
constructor(x: number, y: number) {
this.x = x; this.x = x;
this.y = y; this.y = y;
} }
...@@ -208,9 +212,11 @@ class Rect { ...@@ -208,9 +212,11 @@ class Rect {
y = 0; y = 0;
width = 0; width = 0;
height = 0; height = 0;
constructor() { constructor() {
} }
constructor(x: number, y:number, width: number, height: number) {
constructor(x: number, y: number, width: number, height: number) {
this.x = x; this.x = x;
this.y = y; this.y = y;
this.width = width; this.width = width;
......
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>Alarm List</title> <title>Alarm List</title>
<link rel="stylesheet" type="text/css" href="toolbar.css"> <link rel="stylesheet" type="text/css" href="toolbar.css">
</head> </head>
<body> <body>
<div class="toolbar" role="toolbar"> <div class="toolbar" role="toolbar">
<div id="toolitem1" tabindex="0" class="toolbar-item" role="button"><img src="toolbar_ack.png"><img>....</div> <div id="toolitem1" tabindex="0" class="toolbar-item" role="button">
<div id="toolitem2" tabindex="-1" class="toolbar-item" role="button"><img src="toolbar_navigator.png"><img></div> <img src="toolbar_ack.png"/>....
<div id="toolitem3" tabindex="-1" class="toolbar-item" role="button"><img src="toolbar_plc.png"><img>....</div> </div>
<div id="toolitem4" tabindex="-1" class="toolbar-item" role="button"><img src="toolbar_graph.png"><img></div> <div id="toolitem2" tabindex="-1" class="toolbar-item" role="button">
<div id="toolitem5" tabindex="-1" class="toolbar-item" role="button"><img src="toolbar_objectgraph.png"><img></div> <img src="toolbar_navigator.png"/>
<div id="toolitem6" tabindex="-1" class="toolbar-item" role="button"><img src="toolbar_navigator.png"><img></div> </div>
<div id="toolitem7" tabindex="-1" class="toolbar-item" role="button"><img src="toolbar_plc.png"><img></div> <div id="toolitem3" tabindex="-1" class="toolbar-item" role="button">
<div id="toolitem8" tabindex="-1" class="toolbar-item" role="button"><img src="toolbar_history.png"><img></div> <img src="toolbar_plc.png"/>....
<div id="toolitem9" tabindex="-1" class="toolbar-item" role="button"><img src="toolbar_object.png"><img></div> </div>
<div id="toolitem10" tabindex="-1" class="toolbar-item" role="button"><img src="toolbar_crossref.png"><img></div> <div id="toolitem4" tabindex="-1" class="toolbar-item" role="button">
<div id="toolitem11" tabindex="-1" class="toolbar-item" role="button"><img src="toolbar_help.png"><img></div> <img src="toolbar_graph.png"/>
<div id="toolitem12" tabindex="-1" class="toolbar-item" role="button"><img src="toolbar_classhelp.png"><img></div> </div>
</div> <div id="toolitem5" tabindex="-1" class="toolbar-item" role="button">
<canvas id="flowcanvas" width="1200" height="800"></canvas> <img src="toolbar_objectgraph.png"/>
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script> </div>
<script type="text/babel" src="pwr.js"></script> <div id="toolitem6" tabindex="-1" class="toolbar-item" role="button">
<script type="text/babel" src="cli.js"></script> <img src="toolbar_navigator.png"/>
<script type="text/babel" src="gdh.js"></script> </div>
<script type="text/babel" src="plow.js"></script> <div id="toolitem7" tabindex="-1" class="toolbar-item" role="button">
<script type="text/babel" src="ev.ts"></script> <img src="toolbar_plc.png"/>
<hr> </div>
<address><a href="mailto:claes@debian86.ssab.com"></a></address> <div id="toolitem8" tabindex="-1" class="toolbar-item" role="button">
</body> <img src="toolbar_history.png"/>
</div>
<div id="toolitem9" tabindex="-1" class="toolbar-item" role="button">
<img src="toolbar_object.png"/>
</div>
<div id="toolitem10" tabindex="-1" class="toolbar-item" role="button">
<img src="toolbar_crossref.png"/>
</div>
<div id="toolitem11" tabindex="-1" class="toolbar-item" role="button">
<img src="toolbar_help.png"/>
</div>
<div id="toolitem12" tabindex="-1" class="toolbar-item" role="button">
<img src="toolbar_classhelp.png"/>
</div>
</div>
<canvas id="flowcanvas" width="1200" height="800"></canvas>
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
<script type="text/babel" src="pwr.js"></script>
<script type="text/babel" src="cli.js"></script>
<script type="text/babel" src="gdh.js"></script>
<script type="text/babel" src="plow.js"></script>
<script type="text/babel" src="ev.ts"></script>
<hr>
<address><a href="mailto:claes@debian86.ssab.com"></a></address>
</body>
</html> </html>
...@@ -15,14 +15,12 @@ class Ev { ...@@ -15,14 +15,12 @@ class Ev {
ncSuccess: PlowNodeClass; ncSuccess: PlowNodeClass;
scan_update: boolean; scan_update: boolean;
priv: number; priv: number;
mhSyncIdx: number; mhSyncIdx = 0;
maxEve: number; maxEve = 30;
type: EvType; type: EvType;
timer: number; timer: number;
constructor() {
this.mhSyncIdx = 0;
this.maxEve = 30;
constructor() {
this.type = this.get_type(); this.type = this.get_type();
switch (this.type) { switch (this.type) {
case EvType.EventList: case EvType.EventList:
...@@ -39,9 +37,7 @@ class Ev { ...@@ -39,9 +37,7 @@ class Ev {
this.ctx.event_cb = this.plow_event; this.ctx.event_cb = this.plow_event;
this.createNodeClasses(); this.createNodeClasses();
this.ctx.gdh = new Gdh(); this.ctx.gdh = new Gdh(this.gdh_init_cb);
this.ctx.gdh.open_cb = this.gdh_init_cb;
this.ctx.gdh.init();
this.ctx.gdraw.canvas.addEventListener("click", function (event) { this.ctx.gdraw.canvas.addEventListener("click", function (event) {
let y = event.pageY - this.ctx.gdraw.offset_top; let y = event.pageY - this.ctx.gdraw.offset_top;
...@@ -88,122 +84,122 @@ class Ev { ...@@ -88,122 +84,122 @@ class Ev {
}); });
// Ack // Ack
document.getElementById("toolitem1") document.getElementById("toolitem1")
.addEventListener("click", function (event) { .addEventListener("click", function (event) {
console.log("Ack"); console.log("Ack");
this.ack(); this.ack();
}); });
// Navigator sup object // Navigator sup object
document.getElementById("toolitem2") document.getElementById("toolitem2")
.addEventListener("click", function (event) { .addEventListener("click", function (event) {
let o = this.ctx.get_select(); let o = this.ctx.get_select();
if (o === null || typeof o === 'undefined') { if (o === null || typeof o === 'undefined') {
return; return;
} }
console.log("toolitem2", o.userdata.e.supObject.vid, console.log("toolitem2", o.userdata.e.supObject.vid,
o.userdata.e.supObject.oix); o.userdata.e.supObject.oix);
this.ctx.gdh.getObjectFromAref(o.userdata.e.supObject, this.ctx.gdh.getObjectFromAref(o.userdata.e.supObject,
GdhOp.GET_OP_SELF, this.open_navigator_cb, null); GdhOp.GET_OP_SELF, this.open_navigator_cb, null);
console.log("toolitem2 event"); console.log("toolitem2 event");
}); });
// Trace sup object // Trace sup object
document.getElementById("toolitem3") document.getElementById("toolitem3")
.addEventListener("click", function (event) { .addEventListener("click", function (event) {
console.log("toolitem5 event"); console.log("toolitem5 event");
let o = this.ctx.get_select(); let o = this.ctx.get_select();
if (o === null) { if (o === null) {
return; return;
} }
let newwindow = window.open("", "_blank"); let newwindow = window.open("", "_blank");
this.ctx.gdh.getObjectFromAref(o.userdata.e.supObject, this.ctx.gdh.getObjectFromAref(o.userdata.e.supObject,
GdhOp.GET_OP_METHOD_PLC, this.open_plc_cb, newwindow); GdhOp.GET_OP_METHOD_PLC, this.open_plc_cb, newwindow);
}); });
// Graph event name // Graph event name
document.getElementById("toolitem4") document.getElementById("toolitem4")
.addEventListener("click", function (event) { .addEventListener("click", function (event) {
let o = this.ctx.get_select(); let o = this.ctx.get_select();
if (o.userdata instanceof EvItemAlarm) { if (o.userdata instanceof EvItemAlarm) {
let newwindow = window.open("", "_blank"); let newwindow = window.open("", "_blank");
this.ctx.gdh.getObjectFromName(o.userdata.e.eventName, this.ctx.gdh.getObjectFromName(o.userdata.e.eventName,
GdhOp.GET_OP_METHOD_GRAPH, this.open_graph_cb, newwindow); GdhOp.GET_OP_METHOD_GRAPH, this.open_graph_cb, newwindow);
} }
}); });
// Object raph event name // Object raph event name
document.getElementById("toolitem5") document.getElementById("toolitem5")
.addEventListener("click", function (event) { .addEventListener("click", function (event) {
let o = this.ctx.get_select(); let o = this.ctx.get_select();
if (o.userdata instanceof EvItemAlarm) { if (o.userdata instanceof EvItemAlarm) {
let newwindow = window.open("", "_blank"); let newwindow = window.open("", "_blank");
this.ctx.gdh.getObjectFromName(o.userdata.e.eventName, this.ctx.gdh.getObjectFromName(o.userdata.e.eventName,
GdhOp.GET_OP_METHOD_OBJECTGRAPH, this.open_graph_cb, newwindow); GdhOp.GET_OP_METHOD_OBJECTGRAPH, this.open_graph_cb, newwindow);
} }
}); });
// Navigator event name // Navigator event name
document.getElementById("toolitem6") document.getElementById("toolitem6")
.addEventListener("click", function (event) { .addEventListener("click", function (event) {
let o = this.ctx.get_select(); let o = this.ctx.get_select();
console.log("storage", localStorage.getItem("XttMethodNavigator")); console.log("storage", localStorage.getItem("XttMethodNavigator"));
localStorage.setItem("XttMethodNavigator", o.userdata.e.eventName); localStorage.setItem("XttMethodNavigator", o.userdata.e.eventName);
console.log("storage", localStorage.getItem("XttMethodNavigator")); console.log("storage", localStorage.getItem("XttMethodNavigator"));
console.log("toolitem6 event window", window.opener); console.log("toolitem6 event window", window.opener);
window.opener.focus(); window.opener.focus();
}); });
// Trace event name // Trace event name
document.getElementById("toolitem7") document.getElementById("toolitem7")
.addEventListener("click", function (event) { .addEventListener("click", function (event) {
let o = this.ctx.get_select(); let o = this.ctx.get_select();
if (o === null) { if (o === null) {
return; return;
} }
let newwindow = window.open("", "_blank"); let newwindow = window.open("", "_blank");
this.ctx.gdh.getObjectFromName(o.userdata.e.eventName, this.ctx.gdh.getObjectFromName(o.userdata.e.eventName,
GdhOp.GET_OP_METHOD_PLC, this.open_plc_cb, newwindow); GdhOp.GET_OP_METHOD_PLC, this.open_plc_cb, newwindow);
console.log("toolitem7 event"); console.log("toolitem7 event");
}); });
// History event name // History event name
document.getElementById("toolitem8") document.getElementById("toolitem8")
.addEventListener("click", function (event) { .addEventListener("click", function (event) {
console.log("toolitem8 event"); console.log("toolitem8 event");
}); });
// Object event name // Object event name
document.getElementById("toolitem9") document.getElementById("toolitem9")
.addEventListener("click", function (event) { .addEventListener("click", function (event) {
console.log("toolitem9 event"); console.log("toolitem9 event");
let o = this.ctx.get_select(); let o = this.ctx.get_select();
if (o === null) { if (o === null) {
return; return;
} }
let item = o.userdata; let item = o.userdata;
item.open_attributes(this); item.open_attributes(this);
}); });
// Crossref event name // Crossref event name
document.getElementById("toolitem10") document.getElementById("toolitem10")
.addEventListener("click", function (event) { .addEventListener("click", function (event) {
let o = this.ctx.get_select(); let o = this.ctx.get_select();
if (o === null) { if (o === null) {
return; return;
} }
this.ctx.gdh.crrSignal(o.userdata.e.eventName, this.open_crr_cb, o); this.ctx.gdh.crrSignal(o.userdata.e.eventName, this.open_crr_cb, o);
console.log("toolitem10 event"); console.log("toolitem10 event");
}); });
// Help event name // Help event name
document.getElementById("toolitem11") document.getElementById("toolitem11")
.addEventListener("click", function (event) { .addEventListener("click", function (event) {
console.log("toolitem11 event"); console.log("toolitem11 event");
}); });
// Class help event name // Class help event name
document.getElementById("toolitem12") document.getElementById("toolitem12")
.addEventListener("click", function (event) { .addEventListener("click", function (event) {
console.log("toolitem12 event"); console.log("toolitem12 event");
let o = this.ctx.get_select(); let o = this.ctx.get_select();
if (o === null) { if (o === null) {
return; return;
} }
if (o.userdata instanceof EvItemAlarm) { if (o.userdata instanceof EvItemAlarm) {
let newwindow = window.open("", "_blank"); let newwindow = window.open("", "_blank");
this.ctx.gdh.getObjectFromName(o.userdata.e.eventName, this.ctx.gdh.getObjectFromName(o.userdata.e.eventName,
GdhOp.GET_OP_METHOD_HELPCLASS, this.open_helpclass_cb, newwindow); GdhOp.GET_OP_METHOD_HELPCLASS, this.open_helpclass_cb, newwindow);
} }
}); });
} }
...@@ -316,7 +312,7 @@ class Ev { ...@@ -316,7 +312,7 @@ class Ev {
o = this.ctx.get_next_object(o)) { o = this.ctx.get_next_object(o)) {
let item = o.get_userdata(); let item = o.get_userdata();
if (item.e.eventId.nix === event_id.nix && if (item.e.eventId.nix === event_id.nix &&
item.e.eventId.idx === event_id.idx) { item.e.eventId.idx === event_id.idx) {
return item; return item;
} }
} }
...@@ -362,7 +358,7 @@ class Ev { ...@@ -362,7 +358,7 @@ class Ev {
data.document.write("Error status " + sts); data.document.write("Error status " + sts);
} else { } else {
data.location.href = data.location.href =
"ge.html?graph=" + result.param1 + "&instance=" + result.fullname; "ge.html?graph=" + result.param1 + "&instance=" + result.fullname;
data.document.title = result.fullname; data.document.title = result.fullname;
} }
} }
...@@ -397,10 +393,10 @@ class Ev { ...@@ -397,10 +393,10 @@ class Ev {
param1 = "&obj=" + result.param1; param1 = "&obj=" + result.param1;
} }
console.log("flow.html?vid=" + result.objid.vid + "&oix=" + console.log("flow.html?vid=" + result.objid.vid + "&oix=" +
result.objid.oix + param1); result.objid.oix + param1);
data.location.href = data.location.href =
"flow.html?vid=" + result.objid.vid + "&oix=" + result.objid.oix + "flow.html?vid=" + result.objid.vid + "&oix=" + result.objid.oix +
param1; param1;
data.document.title = "Trace " + result.fullname; data.document.title = "Trace " + result.fullname;
} }
} }
...@@ -425,7 +421,7 @@ class Ev { ...@@ -425,7 +421,7 @@ class Ev {
} }
let graphname = "pwr_c_" + classname; let graphname = "pwr_c_" + classname;
data.location.href = data.location.href =
"ge.html?graph=" + graphname + "&instance=" + result.fullname; "ge.html?graph=" + graphname + "&instance=" + result.fullname;
data.document.title = graphname + " " + result.fullname; data.document.title = graphname + " " + result.fullname;
} }
} }
...@@ -436,7 +432,7 @@ class Ev { ...@@ -436,7 +432,7 @@ class Ev {
} else { } else {
console.log("open_helpclass", result.param1); console.log("open_helpclass", result.param1);
data.location.href = data.location.href =
location.protocol + "//" + location.host + result.param1; location.protocol + "//" + location.host + result.param1;
} }
} }
...@@ -471,15 +467,15 @@ class Ev { ...@@ -471,15 +467,15 @@ class Ev {
createNodeClasses() { createNodeClasses() {
let r1 = new PlowRect(this.ctx, 0, 0, 50, 1.0, Color.WHITE, let r1 = new PlowRect(this.ctx, 0, 0, 50, 1.0, Color.WHITE,
Color.WHITE, true, false); Color.WHITE, true, false);
let r2a = new PlowRect(this.ctx, 0.1, 0.15, 0.7, 0.7, Color.RED, let r2a = new PlowRect(this.ctx, 0.1, 0.15, 0.7, 0.7, Color.RED,
Color.BLACK, true, false); Color.BLACK, true, false);
let r2b = new PlowRect(this.ctx, 0.1, 0.15, 0.7, 0.7, Color.YELLOW, let r2b = new PlowRect(this.ctx, 0.1, 0.15, 0.7, 0.7, Color.YELLOW,
Color.BLACK, true, false); Color.BLACK, true, false);
let r2info = new PlowRect(this.ctx, 0.1, 0.15, 0.7, 0.7, Color.WHITE, let r2info = new PlowRect(this.ctx, 0.1, 0.15, 0.7, 0.7, Color.WHITE,
Color.BLACK, true, false); Color.BLACK, true, false);
let r2success = new PlowRect(this.ctx, 0.1, 0.15, 0.7, 0.7, let r2success = new PlowRect(this.ctx, 0.1, 0.15, 0.7, 0.7,
Color.GREEN, Color.BLACK, true, false); Color.GREEN, Color.BLACK, true, false);
let a1 = new PlowAnnot(this.ctx, 1, 0.9, 4, Color.BLACK, 0, 0); let a1 = new PlowAnnot(this.ctx, 1, 0.9, 4, Color.BLACK, 0, 0);
let p1 = new PlowAnnotPixmap(this.ctx, 1.8, 0.2, 0); let p1 = new PlowAnnotPixmap(this.ctx, 1.8, 0.2, 0);
let p2 = new PlowAnnotPixmap(this.ctx, 2.4, 0.2, 1); let p2 = new PlowAnnotPixmap(this.ctx, 2.4, 0.2, 1);
...@@ -487,9 +483,9 @@ class Ev { ...@@ -487,9 +483,9 @@ class Ev {
let p4 = new PlowAnnotPixmap(this.ctx, 4.0, 0.2, 3); let p4 = new PlowAnnotPixmap(this.ctx, 4.0, 0.2, 3);
let a2 = new PlowAnnot(this.ctx, 4.8, 0.9, 4, Color.BLACK, 0, 1); let a2 = new PlowAnnot(this.ctx, 4.8, 0.9, 4, Color.BLACK, 0, 1);
let a3 = new PlowAnnot(this.ctx, 11.5, 0.9, 4, Color.BLACK, let a3 = new PlowAnnot(this.ctx, 11.5, 0.9, 4, Color.BLACK,
NEXT_RELATIVE_POSITION, 2); NEXT_RELATIVE_POSITION, 2);
let a4 = new PlowAnnot(this.ctx, 22.5, 0.9, 4, Color.BLACK, let a4 = new PlowAnnot(this.ctx, 22.5, 0.9, 4, Color.BLACK,
RELATIVE_POSITION, 3); RELATIVE_POSITION, 3);
// A alarm with red square // A alarm with red square
this.ncAlarmA = new PlowNodeClass(this.ctx); this.ncAlarmA = new PlowNodeClass(this.ctx);
...@@ -575,7 +571,7 @@ class Ev { ...@@ -575,7 +571,7 @@ class Ev {
break; break;
case Event.MB1Click: case Event.MB1Click:
if (item !== null && item.e.eventMoreText !== "" && if (item !== null && item.e.eventMoreText !== "" &&
x >= object.measure().ll_x + 70 && x <= object.measure().ll_x + 90) { x >= object.measure().ll_x + 70 && x <= object.measure().ll_x + 90) {
window.alert(item.e.eventMoreText); window.alert(item.e.eventMoreText);
} else if (object.select) { } else if (object.select) {
object.set_select(false); object.set_select(false);
...@@ -629,7 +625,7 @@ class Ev { ...@@ -629,7 +625,7 @@ class Ev {
if (o.userdata instanceof EvItemAlarm) { if (o.userdata instanceof EvItemAlarm) {
let newwindow = window.open("", "_blank"); let newwindow = window.open("", "_blank");
this.ctx.gdh.getObject(o.userdata.objid, GdhOp.GET_OP_METHOD_PLC, this.ctx.gdh.getObject(o.userdata.objid, GdhOp.GET_OP_METHOD_PLC,
this.open_plc_cb, newwindow); this.open_plc_cb, newwindow);
} }
break; break;
case Event.Key_CtrlG: case Event.Key_CtrlG:
...@@ -637,7 +633,7 @@ class Ev { ...@@ -637,7 +633,7 @@ class Ev {
if (o.userdata instanceof EvItemAlarm) { if (o.userdata instanceof EvItemAlarm) {
let newwindow = window.open("", "_blank"); let newwindow = window.open("", "_blank");
this.ctx.gdh.getObject(o.userdata.objid, GdhOp.GET_OP_METHOD_PLC, this.ctx.gdh.getObject(o.userdata.objid, GdhOp.GET_OP_METHOD_PLC,
this.open_objectgraph_cb, newwindow); this.open_objectgraph_cb, newwindow);
} }
break; break;
default: default:
...@@ -671,6 +667,7 @@ class Ev { ...@@ -671,6 +667,7 @@ class Ev {
class EvItemAlarm { class EvItemAlarm {
node: PlowNode; node: PlowNode;
e: MhEvent; e: MhEvent;
constructor(ev, e, destination, destCode) { constructor(ev, e, destination, destCode) {
this.e = e; this.e = e;
......
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html> <html>
<head> <head>
<title>Trace</title> <title>Trace</title>
<link rel="stylesheet" type="text/css" href="toolbar.css"> <link rel="stylesheet" type="text/css" href="toolbar.css">
</head> </head>
<body> <body>
<div class="toolbar" role="toolbar"> <div class="toolbar" role="toolbar">
<div id="toolitem1" tabindex="0" class="toolbar-item" role="button"><img src="toolbar_graph.png"><img></div> <div id="toolitem1" tabindex="0" class="toolbar-item" role="button">
<div id="toolitem2" tabindex="-1" class="toolbar-item" role="button"><img src="toolbar_navigator.png"><img></div> <img src="toolbar_graph.png"/>
<div id="toolitem3" tabindex="-1" class="toolbar-item" role="button"><img src="toolbar_history.png"><img></div>
<div id="toolitem4" tabindex="-1" class="toolbar-item" role="button"><img src="toolbar_object.png"><img></div>
</div> </div>
<canvas id="flowcanvas" width="1200" height="800"></canvas> <div id="toolitem2" tabindex="-1" class="toolbar-item" role="button">
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script> <img src="toolbar_navigator.png"/>
<script type="text/babel" src="pwr.js"></script> </div>
<script type="text/babel" src="gdh.js"></script> <div id="toolitem3" tabindex="-1" class="toolbar-item" role="button">
<script type="text/babel" src="flow.ts"></script> <img src="toolbar_history.png"/>
<hr> </div>
<address><a href="mailto:claes@debian86.ssab.com"></a></address> <div id="toolitem4" tabindex="-1" class="toolbar-item" role="button">
</body> <img src="toolbar_object.png"/>
</div>
</div>
<canvas id="flowcanvas" width="1200" height="800"></canvas>
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
<script type="text/babel" src="pwr.js"></script>
<script type="text/babel" src="gdh.js"></script>
<script type="text/babel" src="flow.ts"></script>
<hr>
<address><a href="mailto:claes@debian86.ssab.com"></a></address>
</body>
</html> </html>
"use strict"; "use strict";
enum ConType { enum ConType {
Straight, Straight,
Fixed, Fixed,
AllFixed, AllFixed,
Routed, Routed,
StepDiv, StepDiv,
StepConv, StepConv,
TransDiv, TransDiv,
TransConv, TransConv,
StraightOneArrow, StraightOneArrow,
Reference Reference
} }
enum DrawType { enum DrawType {
Line, Line,
LineRed, LineRed,
LineGray, LineGray,
LineErase, LineErase,
LineDashed, LineDashed,
LineDashedRed, LineDashedRed,
TextHelvetica, TextHelvetica,
TextHelveticaBold, TextHelveticaBold,
TextHelveticaErase, TextHelveticaErase,
TextHelveticaEraseBold, TextHelveticaEraseBold,
_, _,
Green, Green,
Yellow, Yellow,
DarkGray, DarkGray,
Inherit = 9999 Inherit = 9999
} }
enum DisplayLevel { enum DisplayLevel {
One = 1 << 0, One = 1 << 0,
Two = 1 << 2, Two = 1 << 2,
Three = 1 << 3, Three = 1 << 3,
Four = 1 << 4, Four = 1 << 4,
Five = 1 << 5, Five = 1 << 5,
Six = 1 << 6 Six = 1 << 6
} }
enum NodeGroup { enum NodeGroup {
...@@ -220,6 +220,7 @@ class GDraw { ...@@ -220,6 +220,7 @@ class GDraw {
gctx: CanvasRenderingContext2D; gctx: CanvasRenderingContext2D;
offset_top: number; offset_top: number;
offset_left: number; offset_left: number;
constructor(ctx: FlowCtx) { constructor(ctx: FlowCtx) {
this.ctx = ctx; this.ctx = ctx;
this.canvas = document.querySelector("canvas"); this.canvas = document.querySelector("canvas");
...@@ -243,9 +244,9 @@ class GDraw { ...@@ -243,9 +244,9 @@ class GDraw {
class FlowArray { class FlowArray {
ctx: FlowCtx; ctx: FlowCtx;
a: Array<any>; a = [];
constructor(ctx: FlowCtx) { constructor(ctx: FlowCtx) {
this.a = [];
this.ctx = ctx; this.ctx = ctx;
} }
...@@ -335,7 +336,7 @@ class FlowArray { ...@@ -335,7 +336,7 @@ class FlowArray {
this.a.push(arrow); this.a.push(arrow);
break; break;
case Save.Point: case Save.Point:
let point = new FlowPoint(this.ctx); let point = new FlowPoint();
i = point.open(lines, i + 1); i = point.open(lines, i + 1);
this.a.push(point); this.a.push(point);
break; break;
...@@ -372,13 +373,12 @@ class FlowArray { ...@@ -372,13 +373,12 @@ class FlowArray {
class FlowNodeClass { class FlowNodeClass {
ctx: FlowCtx; ctx: FlowCtx;
a: FlowArray; a: FlowArray;
nc_name: string; nc_name = "";
group: number; group = 0;
constructor(ctx: FlowCtx) { constructor(ctx: FlowCtx) {
this.a = new FlowArray(ctx); this.a = new FlowArray(ctx);
this.ctx = ctx; this.ctx = ctx;
this.nc_name = "";
this.group = 0;
} }
draw(g, p, node, highlight) { draw(g, p, node, highlight) {
...@@ -424,25 +424,17 @@ class FlowNodeClass { ...@@ -424,25 +424,17 @@ class FlowNodeClass {
class FlowConClass { class FlowConClass {
ctx: FlowCtx; ctx: FlowCtx;
cc_name: string; cc_name = "";
con_type: number; con_type = 0;
corner: number; corner = 0;
draw_type: number; draw_type = 0;
line_width: number; line_width = 0;
arrow_width: number; arrow_width = 0.0;
arrow_length: number; arrow_length = 0.0;
round_corner_amount: number; round_corner_amount = 0.0;
group: number; group = 0;
constructor(ctx: FlowCtx) { constructor(ctx: FlowCtx) {
this.cc_name = "";
this.con_type = 0;
this.corner = 0;
this.draw_type = 0;
this.line_width = 0;
this.arrow_width = 0.0;
this.arrow_length = 0.0;
this.round_corner_amount = 0.0;
this.group = 0;
this.ctx = ctx; this.ctx = ctx;
} }
...@@ -498,14 +490,8 @@ class FlowConClass { ...@@ -498,14 +490,8 @@ class FlowConClass {
} }
class FlowPoint { class FlowPoint {
ctx: FlowCtx; x = 0.0;
x: number; y = 0.0;
y: number;
constructor(ctx: FlowCtx) {
this.x = 0.0;
this.y = 0.0;
this.ctx = ctx;
}
open(lines, row) { open(lines, row) {
let i; let i;
...@@ -513,10 +499,6 @@ class FlowPoint { ...@@ -513,10 +499,6 @@ class FlowPoint {
let tokens = lines[i].split(' '); let tokens = lines[i].split(' ');
let key = parseInt(tokens[0]); let key = parseInt(tokens[0]);
if (this.ctx.debug) {
console.log("point : " + lines[i]);
}
switch (key) { switch (key) {
case Save.Point: case Save.Point:
break; break;
...@@ -539,15 +521,12 @@ class FlowPoint { ...@@ -539,15 +521,12 @@ class FlowPoint {
class FlowLine { class FlowLine {
ctx: FlowCtx; ctx: FlowCtx;
p1: FlowPoint; p1 = new FlowPoint();
p2: FlowPoint; p2 = new FlowPoint();
draw_type: DrawType; draw_type: DrawType = 0;
line_width: number; line_width = 0;
constructor(ctx: FlowCtx) { constructor(ctx: FlowCtx) {
this.p1 = new FlowPoint(ctx);
this.p2 = new FlowPoint(ctx);
this.draw_type = 0;
this.line_width = 0;
this.ctx = ctx; this.ctx = ctx;
} }
...@@ -558,7 +537,7 @@ class FlowLine { ...@@ -558,7 +537,7 @@ class FlowLine {
let y2 = (this.p2.y + p.y) * this.ctx.zoom_factor; let y2 = (this.p2.y + p.y) * this.ctx.zoom_factor;
g.lineWidth = g.lineWidth =
this.ctx.zoom_factor / this.ctx.base_zoom_factor * this.line_width; this.ctx.zoom_factor / this.ctx.base_zoom_factor * this.line_width;
if (g.lineWidth < 1) { if (g.lineWidth < 1) {
g.lineWidth = 1; g.lineWidth = 1;
} }
...@@ -637,19 +616,14 @@ class FlowLine { ...@@ -637,19 +616,14 @@ class FlowLine {
class FlowRect { class FlowRect {
ctx: FlowCtx; ctx: FlowCtx;
ll: FlowPoint; ll = new FlowPoint();
ur: FlowPoint; ur = new FlowPoint();
draw_type: DrawType; draw_type: DrawType = 0;
line_width: number; line_width = 0;
display_level: DisplayLevel; display_level: DisplayLevel = 0;
fill: number; fill = 0;
constructor(ctx: FlowCtx) { constructor(ctx: FlowCtx) {
this.ll = new FlowPoint(ctx);
this.ur = new FlowPoint(ctx);
this.draw_type = 0;
this.line_width = 0;
this.display_level = 0;
this.fill = 0;
this.ctx = ctx; this.ctx = ctx;
} }
...@@ -705,7 +679,7 @@ class FlowRect { ...@@ -705,7 +679,7 @@ class FlowRect {
let height = (this.ur.y - this.ll.y) * this.ctx.zoom_factor; let height = (this.ur.y - this.ll.y) * this.ctx.zoom_factor;
g.lineWidth = g.lineWidth =
this.ctx.zoom_factor / this.ctx.base_zoom_factor * this.line_width; this.ctx.zoom_factor / this.ctx.base_zoom_factor * this.line_width;
if (g.lineWidth < 1) { if (g.lineWidth < 1) {
g.lineWidth = 1; g.lineWidth = 1;
} }
...@@ -731,19 +705,14 @@ class FlowRect { ...@@ -731,19 +705,14 @@ class FlowRect {
class FlowArc { class FlowArc {
ctx: FlowCtx; ctx: FlowCtx;
ll: FlowPoint; ll = new FlowPoint();
ur: FlowPoint; ur = new FlowPoint();
angle1: number; angle1 = 0.0;
angle2: number; angle2 = 0.0;
draw_type: DrawType; draw_type: DrawType = 0;
line_width: number; line_width = 0;
constructor(ctx: FlowCtx) { constructor(ctx: FlowCtx) {
this.ll = new FlowPoint(ctx);
this.ur = new FlowPoint(ctx);
this.angle1 = 0.0;
this.angle2 = 0.0;
this.draw_type = 0;
this.line_width = 0;
this.ctx = ctx; this.ctx = ctx;
} }
...@@ -759,7 +728,7 @@ class FlowArc { ...@@ -759,7 +728,7 @@ class FlowArc {
} }
let a2 = a1 + this.angle2 / 180 * Math.PI; let a2 = a1 + this.angle2 / 180 * Math.PI;
g.lineWidth = g.lineWidth =
this.ctx.zoom_factor / this.ctx.base_zoom_factor * this.line_width; this.ctx.zoom_factor / this.ctx.base_zoom_factor * this.line_width;
if (g.lineWidth < 1) { if (g.lineWidth < 1) {
g.lineWidth = 1; g.lineWidth = 1;
} }
...@@ -818,22 +787,19 @@ class FlowArc { ...@@ -818,22 +787,19 @@ class FlowArc {
class FlowText { class FlowText {
ctx: FlowCtx; ctx: FlowCtx;
p: FlowPoint; p = new FlowPoint();
draw_type: DrawType; draw_type: DrawType = 0;
text_size: number; text_size = 0;
text: string; text = "";
constructor(ctx: FlowCtx) { constructor(ctx: FlowCtx) {
this.p = new FlowPoint(ctx);
this.draw_type = 0;
this.text_size = 0;
this.text = "";
this.ctx = ctx; this.ctx = ctx;
} }
draw(g, p0, node, highlight) { draw(g, p0, node, highlight) {
let tsize = 0; let tsize = 0;
let idx = this.ctx.zoom_factor / this.ctx.base_zoom_factor * let idx = this.ctx.zoom_factor / this.ctx.base_zoom_factor *
(this.text_size + 4) - 4; (this.text_size + 4) - 4;
if (idx < 0) { if (idx < 0) {
return; return;
} }
...@@ -917,21 +883,15 @@ class FlowText { ...@@ -917,21 +883,15 @@ class FlowText {
class FlowArrow { class FlowArrow {
ctx: FlowCtx; ctx: FlowCtx;
p1: FlowPoint; p1 = new FlowPoint();
p2: FlowPoint; p2 = new FlowPoint();
p_dest: FlowPoint; p_dest = new FlowPoint();
arrow_width: number; arrow_width = 0.0;
arrow_length: number; arrow_length = 0.0;
draw_type: DrawType; draw_type: DrawType = 0;
line_width: number; line_width = 0;
constructor(ctx: FlowCtx) { constructor(ctx: FlowCtx) {
this.p1 = new FlowPoint(ctx);
this.p2 = new FlowPoint(ctx);
this.p_dest = new FlowPoint(ctx);
this.arrow_width = 0.0;
this.arrow_length = 0.0;
this.draw_type = 0;
this.line_width = 0;
this.ctx = ctx; this.ctx = ctx;
} }
...@@ -1012,6 +972,7 @@ class FlowArrow { ...@@ -1012,6 +972,7 @@ class FlowArrow {
class FlowTriangle extends FlowRect { class FlowTriangle extends FlowRect {
ctx: FlowCtx; ctx: FlowCtx;
constructor(ctx: FlowCtx) { constructor(ctx: FlowCtx) {
super(ctx); super(ctx);
} }
...@@ -1091,18 +1052,14 @@ class FlowTriangle extends FlowRect { ...@@ -1091,18 +1052,14 @@ class FlowTriangle extends FlowRect {
class FlowConPoint { class FlowConPoint {
ctx: FlowCtx; ctx: FlowCtx;
p: FlowPoint; p = new FlowPoint();
number: number; number = 0;
direction: number; direction = 0;
trace_attribute: string; trace_attribute = "";
trace_attr_type: number; trace_attr_type = 0;
constructor(ctx: FlowCtx) { constructor(ctx: FlowCtx) {
this.ctx = ctx; this.ctx = ctx;
this.p = new FlowPoint(ctx);
this.number = 0;
this.direction = 0;
this.trace_attribute = "";
this.trace_attr_type = 0;
} }
draw(g, p, node, highlight) { draw(g, p, node, highlight) {
...@@ -1149,19 +1106,14 @@ class FlowConPoint { ...@@ -1149,19 +1106,14 @@ class FlowConPoint {
class FlowAnnot { class FlowAnnot {
ctx: FlowCtx; ctx: FlowCtx;
p: FlowPoint; p = new FlowPoint();
draw_type: DrawType; draw_type: DrawType = 0;
text_size: number; text_size = 0
display_level: DisplayLevel; display_level: DisplayLevel = 0;
annot_type: number; annot_type = 0;
number: number; number = 0;
constructor(ctx: FlowCtx) { constructor(ctx: FlowCtx) {
this.p = new FlowPoint(ctx);
this.draw_type = 0;
this.text_size = 0;
this.display_level = 0;
this.annot_type = 0;
this.number = 0;
this.ctx = ctx; this.ctx = ctx;
} }
...@@ -1178,7 +1130,7 @@ class FlowAnnot { ...@@ -1178,7 +1130,7 @@ class FlowAnnot {
let tsize = 0; let tsize = 0;
let idx = this.ctx.zoom_factor / this.ctx.base_zoom_factor * let idx = this.ctx.zoom_factor / this.ctx.base_zoom_factor *
(this.text_size + 4) - 4; (this.text_size + 4) - 4;
if (idx < 0) { if (idx < 0) {
return; return;
} }
...@@ -1279,65 +1231,47 @@ class FlowAnnot { ...@@ -1279,65 +1231,47 @@ class FlowAnnot {
class FlowCon { class FlowCon {
ctx: FlowCtx; ctx: FlowCtx;
x_right: number;
x_left: number;
y_high: number;
y_low: number;
cc: object;
p_num: number;
l_num: number;
a_num: number;
arrow_num: number;
ref_num: number;
point_x: FlowArray; point_x: FlowArray;
point_y: FlowArray; point_y: FlowArray;
line_a: FlowArray; line_a: FlowArray;
arc_a: FlowArray; arc_a: FlowArray;
arrow_a: FlowArray; arrow_a: FlowArray;
ref_a: FlowArray; ref_a: FlowArray;
c_name: string; x_right = 0.0;
trace_object: string; x_left = 0.0;
trace_attribute: string; y_high = 0.0;
trace_attr_type: number; y_low = 0.0;
temporary_ref: number; cc = null;
highlight: boolean; p_num = 0;
redraw: boolean; l_num = 0;
a_num = 0;
arrow_num = 0;
ref_num = 0;
c_name = "";
trace_object = "";
trace_attribute = "";
trace_attr_type = 0;
temporary_ref = 0;
highlight = false;
redraw = true;
constructor(ctx: FlowCtx) { constructor(ctx: FlowCtx) {
this.ctx = ctx; this.ctx = ctx;
this.x_right = 0.0;
this.x_left = 0.0;
this.y_high = 0.0;
this.y_low = 0.0;
this.cc = null;
this.p_num = 0;
this.l_num = 0;
this.a_num = 0;
this.arrow_num = 0;
this.ref_num = 0;
this.point_x = new FlowArray(ctx); this.point_x = new FlowArray(ctx);
this.point_y = new FlowArray(ctx); this.point_y = new FlowArray(ctx);
this.line_a = new FlowArray(ctx); this.line_a = new FlowArray(ctx);
this.arc_a = new FlowArray(ctx); this.arc_a = new FlowArray(ctx);
this.arrow_a = new FlowArray(ctx); this.arrow_a = new FlowArray(ctx);
this.ref_a = new FlowArray(ctx); this.ref_a = new FlowArray(ctx);
this.c_name = "";
this.trace_object = "";
this.trace_attribute = "";
this.trace_attr_type = 0;
this.temporary_ref = 0;
this.highlight = false;
this.redraw = true;
} }
draw(g, p0, node, highlight) { draw(g, p0, node, highlight) {
if (!this.redraw) { if (!this.redraw) {
return; return;
} }
let p = new FlowPoint(this.ctx); let p = new FlowPoint();
p.x = 0;
p.y = 0;
if (this.temporary_ref !== 0 || if (this.temporary_ref !== 0 ||
this.cc.con_type === ConType.Reference) { this.cc.con_type === ConType.Reference) {
this.ref_a.draw(g, p, null, highlight); this.ref_a.draw(g, p, null, highlight);
} else { } else {
this.line_a.draw(g, p, null, highlight); this.line_a.draw(g, p, null, highlight);
...@@ -1480,46 +1414,28 @@ class FlowCon { ...@@ -1480,46 +1414,28 @@ class FlowCon {
class FlowNode { class FlowNode {
ctx: FlowCtx; ctx: FlowCtx;
x_right: number; x_right = 0.0;
x_left: number; x_left = 0.0;
y_high: number; y_high = 0.0;
y_low: number; y_low = 0.0;
nc: FlowNodeClass; nc: FlowNodeClass = null;
pos: FlowPoint; pos = new FlowPoint();
n_name: string; n_name = "";
annotv: Array; annotv: Array = [];
annotsize: Array; annotsize: Array = [];
trace_object: string; trace_object = "";
trace_attribute: string; trace_attribute = "";
trace_attr_type: number; trace_attr_type = 0;
highlight: boolean; highlight = false;
select: boolean; select = false;
fill_color: number; fill_color = 0;
p: number; p = 0;
old_value: number; old_value = 0;
first_scan: boolean; first_scan = true;
redraw: boolean; redraw = true;
constructor(ctx: FlowCtx) { constructor(ctx: FlowCtx) {
this.ctx = ctx; this.ctx = ctx;
this.x_right = 0.0;
this.x_left = 0.0;
this.y_high = 0.0;
this.y_low = 0.0;
this.nc = null;
this.pos = new FlowPoint(ctx);
this.n_name = "";
this.annotv = [];
this.annotsize = [];
this.trace_object = "";
this.trace_attribute = "";
this.trace_attr_type = 0;
this.highlight = false;
this.select = false;
this.fill_color = 0;
this.p = 0;
this.old_value = 0;
this.first_scan = true;
this.redraw = true;
} }
draw(g, p, node, highlight) { draw(g, p, node, highlight) {
...@@ -1729,7 +1645,7 @@ class FlowNode { ...@@ -1729,7 +1645,7 @@ class FlowNode {
let zx = x / this.ctx.zoom_factor + this.ctx.x_left; let zx = x / this.ctx.zoom_factor + this.ctx.x_left;
let zy = y / this.ctx.zoom_factor + this.ctx.y_low; let zy = y / this.ctx.zoom_factor + this.ctx.y_low;
if (zx >= this.x_left && zx <= this.x_right && zy >= this.y_low && if (zx >= this.x_left && zx <= this.x_right && zy >= this.y_low &&
zy <= this.y_high) { zy <= this.y_high) {
console.log("Hit in node"); console.log("Hit in node");
if (this.select) { if (this.select) {
this.select = false; this.select = false;
...@@ -1758,41 +1674,29 @@ class FlowNode { ...@@ -1758,41 +1674,29 @@ class FlowNode {
} }
class FlowCtx { class FlowCtx {
display_level: DisplayLevel;
gdh: Gdh;
debug: boolean;
zoom_factor: number;
base_zoom_factor: number;
offset_x: number;
offset_y: number;
x_right: number;
x_left: number;
y_high: number;
y_low: number;
a: FlowArray; a: FlowArray;
a_nc: FlowArray; a_nc: FlowArray;
a_cc: FlowArray; a_cc: FlowArray;
name: string;
gdraw: GDraw; gdraw: GDraw;
select_object: FlowNode; display_level = DisplayLevel.One;
gdh: Gdh = null;
debug = false;
zoom_factor = 20.0;
base_zoom_factor = 20.0;
offset_x = 0;
offset_y = 0;
x_right = 0.0;
x_left = 0.0;
y_high = 0.0;
y_low = 0.0;
name = "Claes context";
select_object: FlowNode = null;
constructor() { constructor() {
this.display_level = DisplayLevel.One;
this.gdh = null;
this.debug = false;
this.zoom_factor = 20.0;
this.base_zoom_factor = 20.0;
this.offset_x = 0;
this.offset_y = 0;
this.x_right = 0.0;
this.x_left = 0.0;
this.y_high = 0.0;
this.y_low = 0.0;
this.a = new FlowArray(this); this.a = new FlowArray(this);
this.a_nc = new FlowArray(this); this.a_nc = new FlowArray(this);
this.a_cc = new FlowArray(this); this.a_cc = new FlowArray(this);
this.name = "Claes context";
this.gdraw = new GDraw(this); this.gdraw = new GDraw(this);
this.select_object = null;
} }
draw() { draw() {
...@@ -1926,26 +1830,24 @@ class FlowCtx { ...@@ -1926,26 +1830,24 @@ class FlowCtx {
center_object(o) { center_object(o) {
console.log("center_object", o.pos.x * this.zoom_factor + this.offset_x, 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, o.pos.x * this.zoom_factor + this.offset_x -
window.innerWidth / 2); window.innerWidth / 2);
console.log("center_object", o.pos.y * this.zoom_factor + this.offset_y, 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, o.pos.y * this.zoom_factor + this.offset_y -
window.innerHeight / 2); window.innerHeight / 2);
window.scrollTo(o.pos.x * this.zoom_factor + this.offset_x - window.scrollTo(o.pos.x * this.zoom_factor + this.offset_x -
window.innerWidth / 2, o.pos.y * this.zoom_factor + this.offset_y - window.innerWidth / 2, o.pos.y * this.zoom_factor + this.offset_y -
window.innerHeight / 2 + this.gdraw.offset_top); window.innerHeight / 2 + this.gdraw.offset_top);
} }
} }
class FlowFrame { class FlowFrame {
ctx: FlowCtx; ctx: FlowCtx;
timer: number; timer: number = null;
vars_object: string; vars_object: string = null;
constructor() { constructor() {
this.ctx = new FlowCtx(); this.ctx = new FlowCtx();
this.timer = null;
console.log("ctx: ", this.ctx);
this.vars_object = null;
} }
readFlowWeb(fname, read_cb) { readFlowWeb(fname, read_cb) {
...@@ -1976,44 +1878,39 @@ class FlowFrame { ...@@ -1976,44 +1878,39 @@ class FlowFrame {
this.ctx.event_handler(x, y); this.ctx.event_handler(x, y);
}); });
document.getElementById("toolitem1") document.getElementById("toolitem1")
.addEventListener("click", function (event) { .addEventListener("click", function (event) {
console.log("toolitem3 event"); console.log("toolitem3 event");
}); });
document.getElementById("toolitem2") document.getElementById("toolitem2")
.addEventListener("click", function (event) { .addEventListener("click", function (event) {
console.log("toolitem1 event, storage"); console.log("toolitem1 event, storage");
console.log("storage", localStorage.getItem("XttMethodNavigator")); console.log("storage", localStorage.getItem("XttMethodNavigator"));
if (this.ctx.select_object !== null) { if (this.ctx.select_object !== null) {
localStorage.setItem("XttMethodNavigator", localStorage.setItem("XttMethodNavigator",
this.ctx.select_object.trace_object); this.ctx.select_object.trace_object);
} }
console.log("storage", localStorage.getItem("XttMethodNavigator")); console.log("storage", localStorage.getItem("XttMethodNavigator"));
console.log("toolitem2 event window", window.opener); console.log("toolitem2 event window", window.opener);
window.opener.focus(); window.opener.focus();
}); });
document.getElementById("toolitem3") document.getElementById("toolitem3")
.addEventListener("click", function (event) { .addEventListener("click", function (event) {
}); });
document.getElementById("toolitem4") document.getElementById("toolitem4")
.addEventListener("click", function (event) { .addEventListener("click", function (event) {
}); });
this.ctx.gdraw.canvas.width = this.ctx.gdraw.canvas.width =
(this.ctx.x_right - this.ctx.x_left) * this.ctx.zoom_factor; (this.ctx.x_right - this.ctx.x_left) * this.ctx.zoom_factor;
this.ctx.gdraw.canvas.height = this.ctx.gdraw.canvas.height =
(this.ctx.y_high - this.ctx.y_low) * this.ctx.zoom_factor; (this.ctx.y_high - this.ctx.y_low) * this.ctx.zoom_factor;
this.ctx.gdraw.gctx.translate(-this.ctx.x_left * this.ctx.gdraw.gctx.translate(-this.ctx.x_left *
this.ctx.zoom_factor, -this.ctx.y_low * this.ctx.zoom_factor); this.ctx.zoom_factor, -this.ctx.y_low * this.ctx.zoom_factor);
this.ctx.offset_x -= this.ctx.x_left * this.ctx.zoom_factor; this.ctx.offset_x -= this.ctx.x_left * this.ctx.zoom_factor;
this.ctx.offset_y -= this.ctx.y_low * this.ctx.zoom_factor; this.ctx.offset_y -= this.ctx.y_low * this.ctx.zoom_factor;
this.ctx.draw(); this.ctx.draw();
console.log("New Gdh"); this.ctx.gdh = new Gdh(this.flow_open, this.flow_close);
this.ctx.gdh = new Gdh();
this.ctx.gdh.open_cb = this.flow_open;
this.ctx.gdh.close_cb = this.flow_close;
console.log("ctx.gdh", this.ctx.gdh);
this.ctx.gdh.init();
if (this.vars_object !== null) { if (this.vars_object !== null) {
let o = this.ctx.search_object(this.vars_object); let o = this.ctx.search_object(this.vars_object);
...@@ -2057,7 +1954,7 @@ class FlowFrame { ...@@ -2057,7 +1954,7 @@ class FlowFrame {
console.log("query", query); console.log("query", query);
let vars = query.split('&'); let vars = query.split('&');
console.log("vars", vars.length, vars[0].substring(4), console.log("vars", vars.length, vars[0].substring(4),
vars[1].substring(4)); vars[1].substring(4));
let vid = parseInt(vars[0].substring(4)); let vid = parseInt(vars[0].substring(4));
let oix = parseInt(vars[1].substring(4)); let oix = parseInt(vars[1].substring(4));
let avid = []; let avid = [];
...@@ -2082,7 +1979,7 @@ class FlowFrame { ...@@ -2082,7 +1979,7 @@ class FlowFrame {
} }
let fname = "pwr_" + svid[3] + "_" + svid[2] + "_" + svid[1] + "_" + let fname = "pwr_" + svid[3] + "_" + svid[2] + "_" + svid[1] + "_" +
svid[0] + "_" + soix + ".flw"; svid[0] + "_" + soix + ".flw";
console.log(fname); console.log(fname);
if (vars.length > 2) { if (vars.length > 2) {
......
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>Ge graph</title> <title>Ge graph</title>
<link rel="stylesheet" type="text/css" href="toolbar.css"> <link rel="stylesheet" type="text/css" href="toolbar.css">
</head> </head>
<body> <body>
<canvas id="flowcanvas" width="1200" height="800"></canvas> <canvas id="flowcanvas" width="1200" height="800"></canvas>
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script> <script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
<script type="text/babel" src="pwr.js"></script> <script type="text/babel" src="pwr.js"></script>
<script type="text/babel" src="cli.js"></script> <script type="text/babel" src="cli.js"></script>
<script type="text/babel" src="gdh.js"></script> <script type="text/babel" src="gdh.js"></script>
<script type="text/babel" src="glow.ts"></script> <script type="text/babel" src="glow.ts"></script>
<script type="text/babel" src="glow_point.ts"></script> <script type="text/babel" src="glow_point.ts"></script>
<script type="text/babel" src="glow_color.ts"></script> <script type="text/babel" src="glow_color.ts"></script>
<script type="text/babel" src="glow_array.ts"></script> <script type="text/babel" src="glow_array.ts"></script>
<script type="text/babel" src="glow_transform.ts"></script> <script type="text/babel" src="glow_transform.ts"></script>
<script type="text/babel" src="glow_nodeclass.ts"></script> <script type="text/babel" src="glow_nodeclass.ts"></script>
<script type="text/babel" src="glow_nodegroup.ts"></script> <script type="text/babel" src="glow_nodegroup.ts"></script>
<script type="text/babel" src="glow_conclass.ts"></script> <script type="text/babel" src="glow_conclass.ts"></script>
<script type="text/babel" src="glow_con.ts"></script> <script type="text/babel" src="glow_con.ts"></script>
<script type="text/babel" src="glow_line.ts"></script> <script type="text/babel" src="glow_line.ts"></script>
<script type="text/babel" src="glow_arc.ts"></script> <script type="text/babel" src="glow_arc.ts"></script>
<script type="text/babel" src="glow_rect.ts"></script> <script type="text/babel" src="glow_rect.ts"></script>
<script type="text/babel" src="glow_text.ts"></script> <script type="text/babel" src="glow_text.ts"></script>
<script type="text/babel" src="glow_conpoint.ts"></script> <script type="text/babel" src="glow_conpoint.ts"></script>
<script type="text/babel" src="glow_draw.ts"></script> <script type="text/babel" src="glow_draw.ts"></script>
<script type="text/babel" src="glow_cformat.ts"></script> <script type="text/babel" src="glow_cformat.ts"></script>
<script type="text/babel" src="grow_node.ts"></script> <script type="text/babel" src="grow_node.ts"></script>
<script type="text/babel" src="grow_group.ts"></script> <script type="text/babel" src="grow_group.ts"></script>
<script type="text/babel" src="grow_slider.ts"></script> <script type="text/babel" src="grow_slider.ts"></script>
<script type="text/babel" src="grow_toolbar.ts"></script> <script type="text/babel" src="grow_toolbar.ts"></script>
<script type="text/babel" src="grow_rect.ts"></script> <script type="text/babel" src="grow_rect.ts"></script>
<script type="text/babel" src="grow_rectrounded.ts"></script> <script type="text/babel" src="grow_rectrounded.ts"></script>
<script type="text/babel" src="grow_line.ts"></script> <script type="text/babel" src="grow_line.ts"></script>
<script type="text/babel" src="grow_arc.ts"></script> <script type="text/babel" src="grow_arc.ts"></script>
<script type="text/babel" src="grow_text.ts"></script> <script type="text/babel" src="grow_text.ts"></script>
<script type="text/babel" src="grow_annot.ts"></script> <script type="text/babel" src="grow_annot.ts"></script>
<script type="text/babel" src="grow_polyline.ts"></script> <script type="text/babel" src="grow_polyline.ts"></script>
<script type="text/babel" src="grow_conpoint.ts"></script> <script type="text/babel" src="grow_conpoint.ts"></script>
<script type="text/babel" src="grow_image.ts"></script> <script type="text/babel" src="grow_image.ts"></script>
<script type="text/babel" src="grow_conglue.ts"></script> <script type="text/babel" src="grow_conglue.ts"></script>
<script type="text/babel" src="grow_bar.ts"></script> <script type="text/babel" src="grow_bar.ts"></script>
<script type="text/babel" src="grow_bararc.ts"></script> <script type="text/babel" src="grow_bararc.ts"></script>
<script type="text/babel" src="grow_trend.ts"></script> <script type="text/babel" src="grow_trend.ts"></script>
<script type="text/babel" src="grow_xycurve.ts"></script> <script type="text/babel" src="grow_xycurve.ts"></script>
<script type="text/babel" src="grow_menu.ts"></script> <script type="text/babel" src="grow_menu.ts"></script>
<script type="text/babel" src="grow_scrollbar.ts"></script> <script type="text/babel" src="grow_scrollbar.ts"></script>
<script type="text/babel" src="grow_window.ts"></script> <script type="text/babel" src="grow_window.ts"></script>
<script type="text/babel" src="grow_folder.ts"></script> <script type="text/babel" src="grow_folder.ts"></script>
<script type="text/babel" src="grow_axis.ts"></script> <script type="text/babel" src="grow_axis.ts"></script>
<script type="text/babel" src="grow_axisarc.ts"></script> <script type="text/babel" src="grow_axisarc.ts"></script>
<script type="text/babel" src="grow_pie.ts"></script> <script type="text/babel" src="grow_pie.ts"></script>
<script type="text/babel" src="grow_barchart.ts"></script> <script type="text/babel" src="grow_barchart.ts"></script>
<script type="text/babel" src="grow_table.ts"></script> <script type="text/babel" src="grow_table.ts"></script>
<script type="text/babel" src="grow_ctx.ts"></script> <script type="text/babel" src="grow_ctx.ts"></script>
<script type="text/babel" src="grow_frame.ts"></script> <script type="text/babel" src="grow_frame.ts"></script>
<script type="text/babel" src="ge.ts"></script> <script type="text/babel" src="ge.ts"></script>
<script type="text/babel" src="ge_dyn.ts"></script> <script type="text/babel" src="ge_dyn.ts"></script>
<script type="text/babel" src="ge_graph.ts"></script> <script type="text/babel" src="ge_graph.ts"></script>
<script type="text/babel" src="ge_appl.ts"></script> <script type="text/babel" src="ge_appl.ts"></script>
<hr> <hr>
<address><a href="mailto:claes@debian86.ssab.com"></a></address> <address><a href="mailto:claes@debian86.ssab.com"></a></address>
</body> </body>
</html> </html>
...@@ -14,6 +14,7 @@ let cliTable = [new CliTable("OPEN", ...@@ -14,6 +14,7 @@ let cliTable = [new CliTable("OPEN",
class Appl { class Appl {
graph: Graph; graph: Graph;
constructor() { constructor() {
this.graph = new Graph(this); this.graph = new Graph(this);
} }
......
...@@ -30,7 +30,7 @@ class Dyn { ...@@ -30,7 +30,7 @@ class Dyn {
resetColor = false; resetColor = false;
ignoreBgColor = false; ignoreBgColor = false;
resetBgColor = false; resetBgColor = false;
constructor(graph) { constructor(graph) {
this.graph = graph; this.graph = graph;
} }
...@@ -106,7 +106,7 @@ class Dyn { ...@@ -106,7 +106,7 @@ class Dyn {
} }
let elem = null; let elem = null;
switch (key) { switch (key) {
case DynSave.Dyn: case DynSave.Dyn:
break; break;
...@@ -331,13 +331,13 @@ class Dyn { ...@@ -331,13 +331,13 @@ class Dyn {
console.log("Syntax error in Dyn"); console.log("Syntax error in Dyn");
break; break;
} }
if (elem !== null) { if (elem !== null) {
this.elements.push(elem); this.elements.push(elem);
i = elem.open(lines, i + 1); i = elem.open(lines, i + 1);
} }
} }
return i; return i;
} }
...@@ -1026,7 +1026,7 @@ class DynDigLowColor extends DynElem { ...@@ -1026,7 +1026,7 @@ class DynDigLowColor extends DynElem {
if (this.dyn.debug) { if (this.dyn.debug) {
console.log("DynDigLowColor : " + lines[i]); console.log("DynDigLowColor : " + lines[i]);
} }
switch (key) { switch (key) {
case DynSave.DigLowColor: case DynSave.DigLowColor:
break; break;
...@@ -1147,7 +1147,7 @@ class DynDigColor extends DynElem { ...@@ -1147,7 +1147,7 @@ class DynDigColor extends DynElem {
if (this.dyn.debug) { if (this.dyn.debug) {
console.log("DynDigColor : " + lines[i]); console.log("DynDigColor : " + lines[i]);
} }
switch (key) { switch (key) {
case DynSave.DigColor: case DynSave.DigColor:
break; break;
...@@ -1172,7 +1172,7 @@ class DynDigColor extends DynElem { ...@@ -1172,7 +1172,7 @@ class DynDigColor extends DynElem {
break; break;
} }
} }
return i; return i;
} }
} }
...@@ -1260,7 +1260,7 @@ class DynDigWarning extends DynElem { ...@@ -1260,7 +1260,7 @@ class DynDigWarning extends DynElem {
if (this.dyn.debug) { if (this.dyn.debug) {
console.log("DynDigWarning : " + lines[i]); console.log("DynDigWarning : " + lines[i]);
} }
switch (key) { switch (key) {
case DynSave.DigWarning: case DynSave.DigWarning:
break; break;
...@@ -1279,7 +1279,7 @@ class DynDigWarning extends DynElem { ...@@ -1279,7 +1279,7 @@ class DynDigWarning extends DynElem {
break; break;
} }
} }
return i; return i;
} }
} }
...@@ -1367,7 +1367,7 @@ class DynDigError extends DynElem { ...@@ -1367,7 +1367,7 @@ class DynDigError extends DynElem {
if (this.dyn.debug) { if (this.dyn.debug) {
console.log("DynDigError : " + lines[i]); console.log("DynDigError : " + lines[i]);
} }
switch (key) { switch (key) {
case DynSave.DigError: case DynSave.DigError:
break; break;
...@@ -1386,7 +1386,7 @@ class DynDigError extends DynElem { ...@@ -1386,7 +1386,7 @@ class DynDigError extends DynElem {
break; break;
} }
} }
return i; return i;
} }
} }
...@@ -1495,7 +1495,7 @@ class DynDigFlash extends DynElem { ...@@ -1495,7 +1495,7 @@ class DynDigFlash extends DynElem {
if (this.dyn.debug) { if (this.dyn.debug) {
console.log("DynDigError : " + lines[i]); console.log("DynDigError : " + lines[i]);
} }
switch (key) { switch (key) {
case DynSave.DigFlash: case DynSave.DigFlash:
break; break;
...@@ -1626,7 +1626,7 @@ class DynInvisible extends DynElem { ...@@ -1626,7 +1626,7 @@ class DynInvisible extends DynElem {
if (this.dyn.debug) { if (this.dyn.debug) {
console.log("DynInvisible : " + lines[i]); console.log("DynInvisible : " + lines[i]);
} }
switch (key) { switch (key) {
case DynSave.Invisible: case DynSave.Invisible:
break; break;
...@@ -1727,7 +1727,7 @@ class DynDigTextColor extends DynElem { ...@@ -1727,7 +1727,7 @@ class DynDigTextColor extends DynElem {
if (this.dyn.debug) { if (this.dyn.debug) {
console.log("DigTextColor : " + lines[i]); console.log("DigTextColor : " + lines[i]);
} }
switch (key) { switch (key) {
case DynSave.DigTextColor: case DynSave.DigTextColor:
break; break;
...@@ -1823,7 +1823,7 @@ class DynDigText extends DynElem { ...@@ -1823,7 +1823,7 @@ class DynDigText extends DynElem {
if (this.dyn.debug) { if (this.dyn.debug) {
console.log("DigText : " + lines[i]); console.log("DigText : " + lines[i]);
} }
switch (key) { switch (key) {
case DynSave.DigText: case DynSave.DigText:
break; break;
...@@ -1850,7 +1850,7 @@ class DynDigText extends DynElem { ...@@ -1850,7 +1850,7 @@ class DynDigText extends DynElem {
break; break;
} }
} }
return i; return i;
} }
} }
...@@ -1919,7 +1919,7 @@ class DynDigBorder extends DynElem { ...@@ -1919,7 +1919,7 @@ class DynDigBorder extends DynElem {
if (this.dyn.debug) { if (this.dyn.debug) {
console.log("DynBorder : " + lines[i]); console.log("DynBorder : " + lines[i]);
} }
switch (key) { switch (key) {
case DynSave.DigBorder: case DynSave.DigBorder:
break; break;
...@@ -2190,7 +2190,7 @@ class DynValue extends DynElem { ...@@ -2190,7 +2190,7 @@ class DynValue extends DynElem {
if (this.dyn.debug) { if (this.dyn.debug) {
console.log("DynBorder : " + lines[i]); console.log("DynBorder : " + lines[i]);
} }
switch (key) { switch (key) {
case DynSave.Value: case DynSave.Value:
break; break;
...@@ -8319,6 +8319,7 @@ class DynInputFocus extends DynElem { ...@@ -8319,6 +8319,7 @@ class DynInputFocus extends DynElem {
action(o, e) { action(o, e) {
return 1; return 1;
} }
open(lines, row) { open(lines, row) {
let i; let i;
for (i = row; i < lines.length; i++) { for (i = row; i < lines.length; i++) {
......
...@@ -27,9 +27,11 @@ class LocalSub { ...@@ -27,9 +27,11 @@ class LocalSub {
ref() { ref() {
this.refCount++; this.refCount++;
} }
unref() { unref() {
this.refCount--; this.refCount--;
} }
getRefCount() { getRefCount() {
return this.refCount; return this.refCount;
} }
...@@ -235,6 +237,7 @@ class Graph { ...@@ -235,6 +237,7 @@ class Graph {
priv = 0; priv = 0;
timer: number; timer: number;
frame: GrowFrame; frame: GrowFrame;
constructor(appl) { constructor(appl) {
this.appl = appl; this.appl = appl;
if (typeof InstallTrigger !== 'undefined') { if (typeof InstallTrigger !== 'undefined') {
...@@ -268,9 +271,7 @@ class Graph { ...@@ -268,9 +271,7 @@ class Graph {
this.ctx.traceConnect(); this.ctx.traceConnect();
this.trace_cyclic(); this.trace_cyclic();
} else { } else {
this.gdh = new Gdh(); this.gdh = new Gdh(this.gdh_init_cb);
this.gdh.open_cb = this.gdh_init_cb;
this.gdh.init();
} }
} }
...@@ -303,6 +304,7 @@ class Graph { ...@@ -303,6 +304,7 @@ class Graph {
this.gdh.getRefObjectInfoAll(this.trace_scan); this.gdh.getRefObjectInfoAll(this.trace_scan);
} }
} }
trace_scan(id, sts) { trace_scan(id, sts) {
this.scan_time = this.ctx.scantime; this.scan_time = this.ctx.scantime;
this.fast_scan_time = this.ctx.fast_scantime; this.fast_scan_time = this.ctx.fast_scantime;
...@@ -713,9 +715,11 @@ class Graph { ...@@ -713,9 +715,11 @@ class Graph {
getLdb() { getLdb() {
return this.ldb; return this.ldb;
} }
getGdh() { getGdh() {
return this.gdh; return this.gdh;
} }
isAuthorized(access) { isAuthorized(access) {
return !!(this.priv & access); return !!(this.priv & access);
// return appl.isAuthorized( access); // return appl.isAuthorized( access);
...@@ -769,11 +773,13 @@ class Graph { ...@@ -769,11 +773,13 @@ class Graph {
this.ctxPush(); this.ctxPush();
} }
} }
traceDisconnect(o) { traceDisconnect(o) {
if (o.userdata !== null) { if (o.userdata !== null) {
o.userdata.disconnect(o); o.userdata.disconnect(o);
} }
} }
traceScan(o) { traceScan(o) {
if (o.userdata !== null) { if (o.userdata !== null) {
let dyn = o.userdata; let dyn = o.userdata;
......
...@@ -288,8 +288,8 @@ class JopCrypt { ...@@ -288,8 +288,8 @@ class JopCrypt {
c = results[1]; c = results[1];
d = d =
(((d & 0x000000ff) << 16) | (d & 0x0000ff00) | ((d & 0x00ff0000) >>> 16) | (((d & 0x000000ff) << 16) | (d & 0x0000ff00) | ((d & 0x00ff0000) >>> 16) |
((c & 0xf0000000) >>> 4)); ((c & 0xf0000000) >>> 4));
c &= 0x0fffffff; c &= 0x0fffffff;
let s, t; let s, t;
...@@ -311,7 +311,7 @@ class JopCrypt { ...@@ -311,7 +311,7 @@ class JopCrypt {
JopCrypt.skb[1][((c >>> 6) & 0x03) | ((c >>> 7) & 0x3c)] | JopCrypt.skb[1][((c >>> 6) & 0x03) | ((c >>> 7) & 0x3c)] |
JopCrypt.skb[2][((c >>> 13) & 0x0f) | ((c >>> 14) & 0x30)] | JopCrypt.skb[2][((c >>> 13) & 0x0f) | ((c >>> 14) & 0x30)] |
JopCrypt.skb[3][((c >>> 20) & 0x01) | ((c >>> 21) & 0x06) | JopCrypt.skb[3][((c >>> 20) & 0x01) | ((c >>> 21) & 0x06) |
((c >>> 22) & 0x38)]; ((c >>> 22) & 0x38)];
t = JopCrypt.skb[4][(d) & 0x3f] | t = JopCrypt.skb[4][(d) & 0x3f] |
JopCrypt.skb[5][((d >>> 7) & 0x03) | ((d >>> 8) & 0x3c)] | JopCrypt.skb[5][((d >>> 7) & 0x03) | ((d >>> 8) & 0x3c)] |
...@@ -448,8 +448,8 @@ class JopCrypt { ...@@ -448,8 +448,8 @@ class JopCrypt {
u = 0x80; u = 0x80;
} }
buffer = buffer =
buffer.substring(0, i) + String.fromCharCode(JopCrypt.cov_2char[c]) + buffer.substring(0, i) + String.fromCharCode(JopCrypt.cov_2char[c]) +
buffer.substring(i + 1, buffer.length); buffer.substring(i + 1, buffer.length);
} }
} }
return buffer; return buffer;
......
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html> <html>
<head> <head>
<title>Operator window</title> <title>Operator window</title>
<link rel="stylesheet" type="text/css" href="toolbar.css"> <link rel="stylesheet" type="text/css" href="toolbar.css">
<style> <style>
.menu { .menu {
float:left; float: left;
width:20%; width: 20%;
height:100%; height: 100%;
} }
.main {
float:left;
width:79%;
height:100%;
}
</style>
</head>
<body> .main {
<iframe class="menu" src="opwind_menu.html"></iframe> float: left;
<iframe class="main" src="xtt_help_index.html"></iframe> width: 79%;
</body> height: 100%;
}
</style>
</head>
<body>
<iframe class="menu" src="opwind_menu.html"></iframe>
<iframe class="main" src="xtt_help_index.html"></iframe>
</body>
</html> </html>
"use strict"; "use strict";
class OpWindMenu { class OpWindMenu {
priv: number; priv = 0;
user: string; user = "";
user_text: Text; user_text: Text = null;
host: string; host: string;
gdh: Gdh; gdh: Gdh;
info: OpwindMenuInfo; info: OpwindMenuInfo;
constructor() { constructor() {
this.priv = 0;
this.user = "";
this.user_text = null;
this.host = window.location.hostname; this.host = window.location.hostname;
if (this.host === "") { if (this.host === "") {
this.host = "localhost"; this.host = "localhost";
} }
this.gdh = new Gdh(); this.gdh = new Gdh(this.gdh_init_cb);
this.gdh.open_cb = this.gdh_init_cb;
this.gdh.init();
} }
is_authorized(access) { is_authorized(access) {
...@@ -46,7 +42,7 @@ class OpWindMenu { ...@@ -46,7 +42,7 @@ class OpWindMenu {
button.type = "button"; button.type = "button";
button.className = "leftmenu-button"; button.className = "leftmenu-button";
button.value = text; button.value = text;
button.addEventListener('click', function() { button.addEventListener('click', function () {
menu.button_cb(button.value); menu.button_cb(button.value);
}); });
context.appendChild(button); context.appendChild(button);
...@@ -68,47 +64,47 @@ class OpWindMenu { ...@@ -68,47 +64,47 @@ class OpWindMenu {
context.appendChild(document.createElement("hr")); context.appendChild(document.createElement("hr"));
document.getElementById("login_button") document.getElementById("login_button")
.addEventListener("click", function (event) { .addEventListener("click", function (event) {
if (document.getElementById("login_frame").style.visibility === if (document.getElementById("login_frame").style.visibility ===
'hidden') { 'hidden') {
document.getElementById("login_user").innerHTML = ""; document.getElementById("login_user").innerHTML = "";
document.getElementById("login_passw").innerHTML = ""; document.getElementById("login_passw").innerHTML = "";
document.getElementById("login_frame").style.visibility = 'visible'; document.getElementById("login_frame").style.visibility = 'visible';
document.getElementById("login_frame").style.height = '120px'; document.getElementById("login_frame").style.height = '120px';
document.getElementById("login_user").focus(); document.getElementById("login_user").focus();
} else { } else {
document.getElementById("login_frame").style.visibility = 'hidden';
document.getElementById("login_frame").style.height = '0px';
}
});
document.getElementById("apply_button")
.addEventListener("click", function (event) {
let user = document.getElementById("login_user").innerHTML;
let passwd = document.getElementById("login_passw").innerHTML;
if (user.trim() === "") {
return;
}
document.getElementById("login_frame").style.visibility = 'hidden'; document.getElementById("login_frame").style.visibility = 'hidden';
document.getElementById("login_frame").style.height = '0px'; document.getElementById("login_frame").style.height = '0px';
} let c = new JopCrypt();
}); passwd = c.crypt("aa", passwd);
document.getElementById("apply_button")
.addEventListener("click", function (event) { this.user = user;
let user = document.getElementById("login_user").innerHTML; this.gdh.login(user, passwd, this.login_cb, this);
let passwd = document.getElementById("login_passw").innerHTML; });
if (user.trim() === "") {
return;
}
document.getElementById("login_frame").style.visibility = 'hidden';
document.getElementById("login_frame").style.height = '0px';
let c = new JopCrypt();
passwd = c.crypt("aa", passwd);
this.user = user;
this.gdh.login(user, passwd, this.login_cb, this);
});
document.getElementById("cancel_button") document.getElementById("cancel_button")
.addEventListener("click", function (event) { .addEventListener("click", function (event) {
document.getElementById("login_frame").style.visibility = 'hidden'; document.getElementById("login_frame").style.visibility = 'hidden';
document.getElementById("login_frame").style.height = '0px'; document.getElementById("login_frame").style.height = '0px';
}); });
document.getElementById("logout_button") document.getElementById("logout_button")
.addEventListener("click", function (event) { .addEventListener("click", function (event) {
document.getElementById("login_frame").style.visibility = 'hidden'; document.getElementById("login_frame").style.visibility = 'hidden';
document.getElementById("login_frame").style.height = '0px'; document.getElementById("login_frame").style.height = '0px';
this.priv = 0; this.priv = 0;
this.user = "Default"; this.user = "Default";
this.gdh.login("", "", this.login_cb, this); this.gdh.login("", "", this.login_cb, this);
}); });
document.getElementById("login_user").innerHTML = ""; document.getElementById("login_user").innerHTML = "";
document.getElementById("login_passw").innerHTML = ""; document.getElementById("login_passw").innerHTML = "";
...@@ -154,9 +150,9 @@ class OpWindMenu { ...@@ -154,9 +150,9 @@ class OpWindMenu {
} else if (this.info.enable_alarmlist && text === "AlarmList") { } else if (this.info.enable_alarmlist && text === "AlarmList") {
console.log("AlarmList activated"); console.log("AlarmList activated");
if (this.is_authorized(Access.RtRead | Access.RtWrite | if (this.is_authorized(Access.RtRead | Access.RtWrite |
Access.AllOperators | Access.System | Access.AllOperators | Access.System |
Access.Maintenance | Access.Process | Access.Maintenance | Access.Process |
Access.Instrument)) { Access.Instrument)) {
window.open("ev.html?list=alarm", "_blank"); window.open("ev.html?list=alarm", "_blank");
} else { } else {
window.alert("Not authorized for this operation"); window.alert("Not authorized for this operation");
...@@ -164,9 +160,9 @@ class OpWindMenu { ...@@ -164,9 +160,9 @@ class OpWindMenu {
} else if (this.info.enable_alarmlist && text === "EventList") { } else if (this.info.enable_alarmlist && text === "EventList") {
console.log("EventList activated"); console.log("EventList activated");
if (this.is_authorized(Access.RtRead | Access.RtWrite | if (this.is_authorized(Access.RtRead | Access.RtWrite |
Access.AllOperators | Access.System | Access.AllOperators | Access.System |
Access.Maintenance | Access.Process | Access.Maintenance | Access.Process |
Access.Instrument)) { Access.Instrument)) {
window.open("ev.html?list=event", "_blank"); window.open("ev.html?list=event", "_blank");
} else { } else {
window.alert("Not authorized for this operation"); window.alert("Not authorized for this operation");
...@@ -174,9 +170,9 @@ class OpWindMenu { ...@@ -174,9 +170,9 @@ class OpWindMenu {
} else if (this.info.enable_eventlog && text === "EventLog") { } else if (this.info.enable_eventlog && text === "EventLog") {
console.log("EventLog activated"); console.log("EventLog activated");
if (this.is_authorized(Access.RtRead | Access.RtWrite | if (this.is_authorized(Access.RtRead | Access.RtWrite |
Access.AllOperators | Access.System | Access.AllOperators | Access.System |
Access.Maintenance | Access.Process | Access.Maintenance | Access.Process |
Access.Instrument)) { Access.Instrument)) {
window.alert("Not yet implemented"); window.alert("Not yet implemented");
} else { } else {
window.alert("Not authorized for this operation"); window.alert("Not authorized for this operation");
...@@ -184,8 +180,8 @@ class OpWindMenu { ...@@ -184,8 +180,8 @@ class OpWindMenu {
} else if (this.info.enable_navigator && text === "Navigator") { } else if (this.info.enable_navigator && text === "Navigator") {
console.log("Navigator activated"); console.log("Navigator activated");
if (this.is_authorized(Access.RtNavigator | Access.System | if (this.is_authorized(Access.RtNavigator | Access.System |
Access.Maintenance | Access.Process | Access.Maintenance | Access.Process |
Access.Instrument)) { Access.Instrument)) {
window.open("xtt.html", "_blank"); window.open("xtt.html", "_blank");
} else { } else {
window.alert("Not authorized for this operation"); window.alert("Not authorized for this operation");
...@@ -198,9 +194,9 @@ class OpWindMenu { ...@@ -198,9 +194,9 @@ class OpWindMenu {
window.open("http://www.proview.se", "_blank"); window.open("http://www.proview.se", "_blank");
} else { } else {
if (this.is_authorized(Access.RtRead | Access.RtWrite | if (this.is_authorized(Access.RtRead | Access.RtWrite |
Access.AllOperators | Access.System | Access.AllOperators | Access.System |
Access.Maintenance | Access.Process | Access.Maintenance | Access.Process |
Access.Instrument)) { Access.Instrument)) {
for (let i = 0; i < this.info.buttons.length; i++) { for (let i = 0; i < this.info.buttons.length; i++) {
if (this.info.buttons[i].text === text) { if (this.info.buttons[i].text === text) {
console.log("Found", this.info.buttons[i].text); console.log("Found", this.info.buttons[i].text);
......
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html> <html>
<head> <head>
<title>Operator Menu</title> <title>Operator Menu</title>
<link rel="stylesheet" type="text/css" href="toolbar.css"> <link rel="stylesheet" type="text/css" href="toolbar.css">
</head> </head>
<body> <body>
<div id="opwindmenu" width="120" height="800"> <div id="opwindmenu" width="120" height="800">
<h1 id="opwind_title"></h1> <h1 id="opwind_title"></h1>
<p id="opwind_text"></p> <p id="opwind_text"></p>
<hr>
<button id="login_button" type="button" class="leftmenu-button">Login</button>
<div id="login_frame" class="login-frame">
Username<br>
<input id="login_user" name="username" class="login-field" /><br>
Password<br>
<input id="login_passw" name="password" type="password" class="login-field" /><br>
<button id="apply_button" type="button" style="flex-grow:1">Apply</button>
<button id="cancel_button" type="button" style="float:right">Cancel</button><br>
<button id="logout_button" type="button" class="leftmenu-button">Logout</button>
</div>
</div>
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
<script type="text/babel" src="crypt.ts"></script>
<script type="text/babel" src="pwr.js"></script>
<script type="text/babel" src="gdh.js"></script>
<script type="text/babel" src="opwind.ts"></script>
<hr> <hr>
<address><a href="mailto:claes@debian86.ssab.com"></a></address> <button id="login_button" type="button" class="leftmenu-button">Login</button>
</body> <div id="login_frame" class="login-frame">Username<br>
<input id="login_user" name="username" class="login-field"/><br>Password<br>
<input id="login_passw" name="password" type="password" class="login-field"/><br>
<button id="apply_button" type="button" style="flex-grow:1">Apply</button>
<button id="cancel_button" type="button" style="float:right">Cancel</button>
<br>
<button id="logout_button" type="button" class="leftmenu-button">Logout</button>
</div>
</div>
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
<script type="text/babel" src="crypt.ts"></script>
<script type="text/babel" src="pwr.js"></script>
<script type="text/babel" src="gdh.js"></script>
<script type="text/babel" src="opwind.ts"></script>
<hr>
<address><a href="mailto:claes@debian86.ssab.com"></a></address>
</body>
</html> </html>
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>Xtt</title> <title>Xtt</title>
<link rel="stylesheet" type="text/css" href="toolbar.css"> <link rel="stylesheet" type="text/css" href="toolbar.css">
</head> </head>
<body> <body>
<div class="toolbar" role="toolbar"> <div class="toolbar" role="toolbar">
<div id="toolitem1" tabindex="0" class="toolbar-item" role="button"><img src="toolbar_graph.png"><img></div> <div id="toolitem1" tabindex="0" class="toolbar-item" role="button">
<div id="toolitem2" tabindex="-1" class="toolbar-item" role="button"><img src="toolbar_objectgraph.png"><img></div> <img src="toolbar_graph.png"/>
<div id="toolitem3" tabindex="-1" class="toolbar-item" role="button"><img src="toolbar_plc.png"><img></div> </div>
<div id="toolitem4" tabindex="-1" class="toolbar-item" role="button"><img src="toolbar_history.png"><img></div> <div id="toolitem2" tabindex="-1" class="toolbar-item" role="button">
<div id="toolitem5" tabindex="-1" class="toolbar-item" role="button"><img src="toolbar_object.png"><img></div> <img src="toolbar_objectgraph.png"/>
<div id="toolitem6" tabindex="-1" class="toolbar-item" role="button"><img src="toolbar_crossref.png"><img></div> </div>
<div id="toolitem7" tabindex="-1" class="toolbar-item" role="button"><img src="toolbar_help.png"><img></div> <div id="toolitem3" tabindex="-1" class="toolbar-item" role="button">
<div id="toolitem8" tabindex="-1" class="toolbar-item" role="button"><img src="toolbar_classhelp.png"><img></div> <img src="toolbar_plc.png"/>
</div> </div>
<canvas id="flowcanvas" width="1200" height="800"></canvas> <div id="toolitem4" tabindex="-1" class="toolbar-item" role="button">
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script> <img src="toolbar_history.png"/>
<script type="text/babel" src="pwr.js"></script> </div>
<script type="text/babel" src="cli.js"></script> <div id="toolitem5" tabindex="-1" class="toolbar-item" role="button">
<script type="text/babel" src="gdh.js"></script> <img src="toolbar_object.png"/>
<script type="text/babel" src="plow.js"></script> </div>
<script type="text/babel" src="xtt.ts"></script> <div id="toolitem6" tabindex="-1" class="toolbar-item" role="button">
<hr> <img src="toolbar_crossref.png"/>
<address><a href="mailto:claes@debian86.ssab.com"></a></address> </div>
</body> <div id="toolitem7" tabindex="-1" class="toolbar-item" role="button">
<img src="toolbar_help.png"/>
</div>
<div id="toolitem8" tabindex="-1" class="toolbar-item" role="button">
<img src="toolbar_classhelp.png"/>
</div>
</div>
<canvas id="flowcanvas" width="1200" height="800"></canvas>
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
<script type="text/babel" src="pwr.js"></script>
<script type="text/babel" src="cli.js"></script>
<script type="text/babel" src="gdh.js"></script>
<script type="text/babel" src="plow.js"></script>
<script type="text/babel" src="xtt.ts"></script>
<hr>
<address><a href="mailto:claes@debian86.ssab.com"></a></address>
</body>
</html> </html>
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
class XttOpenChildrenData { class XttOpenChildrenData {
node: PlowNode; node: PlowNode;
open_next: PlowNode; open_next: PlowNode;
constructor(node, open_next) { constructor(node, open_next) {
this.node = node; this.node = node;
this.open_next = open_next; this.open_next = open_next;
...@@ -10,13 +11,13 @@ class XttOpenChildrenData { ...@@ -10,13 +11,13 @@ class XttOpenChildrenData {
} }
class Xtt { class Xtt {
ncObject: PlowNodeClass; ncObject: PlowNodeClass = null;
scan_update: boolean; scan_update: boolean;
priv: number; priv: number;
ctx: PlowCtx; ctx: PlowCtx;
timer: number; timer = null;
constructor() { constructor() {
this.ncObject = null;
this.priv = Number(sessionStorage.getItem("pwr_privilege")); this.priv = Number(sessionStorage.getItem("pwr_privilege"));
console.log("pwr_privilege", this.priv); console.log("pwr_privilege", this.priv);
...@@ -25,9 +26,7 @@ class Xtt { ...@@ -25,9 +26,7 @@ class Xtt {
this.ctx.event_cb = this.plow_event; this.ctx.event_cb = this.plow_event;
this.createNodeClasses(); this.createNodeClasses();
this.ctx.gdh = new Gdh(); this.ctx.gdh = new Gdh(this.gdh_init_cb);
this.ctx.gdh.open_cb = this.gdh_init_cb;
this.ctx.gdh.init();
this.ctx.gdraw.canvas.addEventListener("click", function (event) { this.ctx.gdraw.canvas.addEventListener("click", function (event) {
let y = event.pageY - this.ctx.gdraw.offset_top; let y = event.pageY - this.ctx.gdraw.offset_top;
...@@ -73,84 +72,84 @@ class Xtt { ...@@ -73,84 +72,84 @@ class Xtt {
} }
}); });
document.getElementById("toolitem1") document.getElementById("toolitem1")
.addEventListener("click", function (event) { .addEventListener("click", function (event) {
let o = this.ctx.get_select(); let o = this.ctx.get_select();
if (o.userdata instanceof XttItemObject) { if (o.userdata instanceof XttItemObject) {
let newwindow = window.open("", "_blank"); let newwindow = window.open("", "_blank");
this.ctx.gdh.getObject(o.userdata.objid, GdhOp.GET_OP_METHOD_GRAPH, this.ctx.gdh.getObject(o.userdata.objid, GdhOp.GET_OP_METHOD_GRAPH,
this.open_graph_cb, newwindow); this.open_graph_cb, newwindow);
} }
console.log("toolitem1 event"); console.log("toolitem1 event");
}); });
document.getElementById("toolitem2") document.getElementById("toolitem2")
.addEventListener("click", function (event) { .addEventListener("click", function (event) {
let o = this.ctx.get_select(); let o = this.ctx.get_select();
if (o.userdata instanceof XttItemObject) { if (o.userdata instanceof XttItemObject) {
let newwindow = window.open("", "_blank"); let newwindow = window.open("", "_blank");
this.ctx.gdh.getObject(o.userdata.objid, this.ctx.gdh.getObject(o.userdata.objid,
GdhOp.GET_OP_METHOD_OBJECTGRAPH, this.open_objectgraph_cb, GdhOp.GET_OP_METHOD_OBJECTGRAPH, this.open_objectgraph_cb,
newwindow); newwindow);
} }
console.log("toolitem2 event"); console.log("toolitem2 event");
}); });
document.getElementById("toolitem3") document.getElementById("toolitem3")
.addEventListener("click", function (event) { .addEventListener("click", function (event) {
console.log("toolitem1 event"); console.log("toolitem1 event");
let o = this.ctx.get_select(); let o = this.ctx.get_select();
if (o.userdata instanceof XttItemObject) { if (o.userdata instanceof XttItemObject) {
let newwindow = window.open("", "_blank"); let newwindow = window.open("", "_blank");
this.ctx.gdh.getObject(o.userdata.objid, GdhOp.GET_OP_METHOD_PLC, this.ctx.gdh.getObject(o.userdata.objid, GdhOp.GET_OP_METHOD_PLC,
this.open_plc_cb, newwindow); this.open_plc_cb, newwindow);
} else if (o.userdata instanceof XttItemCrr) { } else if (o.userdata instanceof XttItemCrr) {
let idx = o.userdata.name.lastIndexOf('-'); let idx = o.userdata.name.lastIndexOf('-');
let ostring = ""; let ostring = "";
if (idx !== -1) { if (idx !== -1) {
ostring = "&obj=" + o.userdata.name.substring(idx + 1); ostring = "&obj=" + o.userdata.name.substring(idx + 1);
}
console.log("flow.html?vid=" + o.userdata.objid.vid + "&oix=" +
o.userdata.objid.oix + ostring);
window.open("flow.html?vid=" + o.userdata.objid.vid + "&oix=" +
o.userdata.objid.oix + ostring);
} }
console.log("flow.html?vid=" + o.userdata.objid.vid + "&oix=" + console.log("toolitem3 event");
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") document.getElementById("toolitem4")
.addEventListener("click", function (event) { .addEventListener("click", function (event) {
console.log("toolitem4 event"); console.log("toolitem4 event");
}); });
document.getElementById("toolitem5") document.getElementById("toolitem5")
.addEventListener("click", function (event) { .addEventListener("click", function (event) {
console.log("toolitem5 event"); console.log("toolitem5 event");
let o = this.ctx.get_select(); let o = this.ctx.get_select();
if (o === null) { if (o === null) {
return; return;
} }
let item = o.userdata; let item = o.userdata;
item.open_attributes(this); item.open_attributes(this);
}); });
document.getElementById("toolitem6") document.getElementById("toolitem6")
.addEventListener("click", function (event) { .addEventListener("click", function (event) {
let o = this.ctx.get_select(); let o = this.ctx.get_select();
this.ctx.gdh.crrSignal(o.userdata.objid, this.open_crr_cb, o); this.ctx.gdh.crrSignal(o.userdata.objid, this.open_crr_cb, o);
console.log("toolitem6 event"); console.log("toolitem6 event");
}); });
document.getElementById("toolitem7") document.getElementById("toolitem7")
.addEventListener("click", function (event) { .addEventListener("click", function (event) {
console.log("toolitem7 event"); console.log("toolitem7 event");
}); });
document.getElementById("toolitem8") document.getElementById("toolitem8")
.addEventListener("click", function (event) { .addEventListener("click", function (event) {
console.log("toolitem8 event"); console.log("toolitem8 event");
let o = this.ctx.get_select(); let o = this.ctx.get_select();
if (o === null) { if (o === null) {
return; return;
} }
if (o.userdata instanceof XttItemObject) { if (o.userdata instanceof XttItemObject) {
let newwindow = window.open("", "_blank"); let newwindow = window.open("", "_blank");
this.ctx.gdh.getObject(o.userdata.objid, this.ctx.gdh.getObject(o.userdata.objid,
GdhOp.GET_OP_METHOD_HELPCLASS, this.open_helpclass_cb, newwindow); GdhOp.GET_OP_METHOD_HELPCLASS, this.open_helpclass_cb, newwindow);
} }
}); });
window.addEventListener("storage", function (event) { window.addEventListener("storage", function (event) {
if (event.newValue === "") { if (event.newValue === "") {
...@@ -172,7 +171,7 @@ class Xtt { ...@@ -172,7 +171,7 @@ class Xtt {
let oid = new PwrtObjid(0, 0); let oid = new PwrtObjid(0, 0);
this.ctx.gdh.getAllXttChildren(oid, this.open_children_cb, this.ctx.gdh.getAllXttChildren(oid, this.open_children_cb,
new XttOpenChildrenData(null, null)); new XttOpenChildrenData(null, null));
this.ctx.gdh.listSent = true; this.ctx.gdh.listSent = true;
this.trace_cyclic(); this.trace_cyclic();
...@@ -195,7 +194,7 @@ class Xtt { ...@@ -195,7 +194,7 @@ class Xtt {
new XttItemObject(this, result[i], null, Dest.AFTER); new XttItemObject(this, result[i], null, Dest.AFTER);
} else { } else {
result[i].full_name = result[i].full_name =
data.node.userdata.full_name + "-" + result[i].name; data.node.userdata.full_name + "-" + result[i].name;
new XttItemObject(this, result[i], data.node, Dest.INTOLAST); new XttItemObject(this, result[i], data.node, Dest.INTOLAST);
} }
} }
...@@ -291,10 +290,10 @@ class Xtt { ...@@ -291,10 +290,10 @@ class Xtt {
param1 = "&obj=" + result.param1; param1 = "&obj=" + result.param1;
} }
console.log("flow.html?vid=" + result.objid.vid + "&oix=" + console.log("flow.html?vid=" + result.objid.vid + "&oix=" +
result.objid.oix + param1); result.objid.oix + param1);
data.location.href = data.location.href =
"flow.html?vid=" + result.objid.vid + "&oix=" + result.objid.oix + "flow.html?vid=" + result.objid.vid + "&oix=" + result.objid.oix +
param1; param1;
data.document.title = "Trace " + result.fullname; data.document.title = "Trace " + result.fullname;
} }
} }
...@@ -304,7 +303,7 @@ class Xtt { ...@@ -304,7 +303,7 @@ class Xtt {
data.document.write("Error status " + sts); data.document.write("Error status " + sts);
} else { } else {
data.location.href = data.location.href =
"ge.html?graph=" + result.param1 + "&instance=" + result.fullname; "ge.html?graph=" + result.param1 + "&instance=" + result.fullname;
data.document.title = result.fullname; data.document.title = result.fullname;
} }
} }
...@@ -341,7 +340,7 @@ class Xtt { ...@@ -341,7 +340,7 @@ class Xtt {
} else { } else {
console.log("open_helpclass", result.param1); console.log("open_helpclass", result.param1);
data.location.href = data.location.href =
location.protocol + "//" + location.host + result.param1; location.protocol + "//" + location.host + result.param1;
} }
} }
...@@ -446,7 +445,7 @@ class Xtt { ...@@ -446,7 +445,7 @@ class Xtt {
if (o.userdata instanceof XttItemObject) { if (o.userdata instanceof XttItemObject) {
let newwindow = window.open("", "_blank"); let newwindow = window.open("", "_blank");
this.ctx.gdh.getObject(o.userdata.objid, GdhOp.GET_OP_METHOD_PLC, this.ctx.gdh.getObject(o.userdata.objid, GdhOp.GET_OP_METHOD_PLC,
this.open_plc_cb, newwindow); this.open_plc_cb, newwindow);
} else if (o.userdata instanceof XttItemCrr) { } else if (o.userdata instanceof XttItemCrr) {
let idx = o.userdata.name.lastIndexOf('-'); let idx = o.userdata.name.lastIndexOf('-');
let ostring = ""; let ostring = "";
...@@ -454,7 +453,7 @@ class Xtt { ...@@ -454,7 +453,7 @@ class Xtt {
ostring = "&obj=" + o.userdata.name.substring(idx + 1); ostring = "&obj=" + o.userdata.name.substring(idx + 1);
} }
window.open("flow.html?vid=" + o.userdata.objid.vid + "&oix=" + window.open("flow.html?vid=" + o.userdata.objid.vid + "&oix=" +
o.userdata.objid.oix + ostring); o.userdata.objid.oix + ostring);
} }
break; break;
case Event.Key_CtrlG: case Event.Key_CtrlG:
...@@ -463,8 +462,8 @@ class Xtt { ...@@ -463,8 +462,8 @@ class Xtt {
console.log("CtrlG", o.userdata.objid.vid, o.userdata.objid.oix); console.log("CtrlG", o.userdata.objid.vid, o.userdata.objid.oix);
let newwindow = window.open("", "_blank"); let newwindow = window.open("", "_blank");
this.ctx.gdh.getObject(o.userdata.objid, this.ctx.gdh.getObject(o.userdata.objid,
GdhOp.GET_OP_METHOD_OBJECTGRAPH, this.open_objectgraph_cb, GdhOp.GET_OP_METHOD_OBJECTGRAPH, this.open_objectgraph_cb,
newwindow); newwindow);
} }
break; break;
default: default:
...@@ -474,13 +473,13 @@ class Xtt { ...@@ -474,13 +473,13 @@ class Xtt {
createNodeClasses() { createNodeClasses() {
let r1 = new PlowRect(this.ctx, 0, 0, 50, 1.0, Color.WHITE, let r1 = new PlowRect(this.ctx, 0, 0, 50, 1.0, Color.WHITE,
Color.WHITE, true, false); Color.WHITE, true, false);
let a1 = new PlowAnnot(this.ctx, 3, 0.9, 4, Color.BLACK, let a1 = new PlowAnnot(this.ctx, 3, 0.9, 4, Color.BLACK,
NEXT_RELATIVE_POSITION, 0); NEXT_RELATIVE_POSITION, 0);
let a11 = new PlowAnnot(this.ctx, 7.5, 0.9, 4, Color.BLACK, let a11 = new PlowAnnot(this.ctx, 7.5, 0.9, 4, Color.BLACK,
RELATIVE_POSITION, 1); RELATIVE_POSITION, 1);
let a12 = new PlowAnnot(this.ctx, 12, 0.9, 4, Color.BLACK, let a12 = new PlowAnnot(this.ctx, 12, 0.9, 4, Color.BLACK,
RELATIVE_POSITION, 2); RELATIVE_POSITION, 2);
let p1 = new PlowAnnotPixmap(this.ctx, 0.4, 0.2, 0); let p1 = new PlowAnnotPixmap(this.ctx, 0.4, 0.2, 0);
this.ncObject = new PlowNodeClass(this.ctx); this.ncObject = new PlowNodeClass(this.ctx);
...@@ -572,7 +571,7 @@ class Xtt { ...@@ -572,7 +571,7 @@ class Xtt {
openValueInputDialog(item, text) { openValueInputDialog(item, text) {
console.log("priv acc", this.priv, Access.RtWrite | console.log("priv acc", this.priv, Access.RtWrite |
Access.System); Access.System);
if (this.is_authorized(Access.RtWrite | Access.System)) { if (this.is_authorized(Access.RtWrite | Access.System)) {
let value = prompt(text, ""); let value = prompt(text, "");
if (value !== null) { if (value !== null) {
...@@ -591,6 +590,7 @@ class XttItemObject { ...@@ -591,6 +590,7 @@ class XttItemObject {
full_name: string; full_name: string;
has_children: boolean; has_children: boolean;
node: PlowNode; node: PlowNode;
constructor(xtt, object_info, destination, destCode) { constructor(xtt, object_info, destination, destCode) {
this.objid = object_info.objid; this.objid = object_info.objid;
this.cid = object_info.cid; this.cid = object_info.cid;
...@@ -618,7 +618,7 @@ class XttItemObject { ...@@ -618,7 +618,7 @@ class XttItemObject {
this.open_attributes(xtt, null); this.open_attributes(xtt, null);
} else { } else {
xtt.ctx.gdh.getAllXttChildren(this.objid, xtt.open_children_cb, xtt.ctx.gdh.getAllXttChildren(this.objid, xtt.open_children_cb,
new XttOpenChildrenData(this.node, open_next)); new XttOpenChildrenData(this.node, open_next));
this.node.node_open |= Open.CHILDREN; this.node.node_open |= Open.CHILDREN;
this.node.set_annotation_pixmap(0, Bitmaps.openmap); this.node.set_annotation_pixmap(0, Bitmaps.openmap);
} }
...@@ -627,7 +627,7 @@ class XttItemObject { ...@@ -627,7 +627,7 @@ class XttItemObject {
open_attributes(xtt, open_next) { open_attributes(xtt, open_next) {
if (this.node.node_open === 0) { if (this.node.node_open === 0) {
xtt.ctx.gdh.getAllClassAttributes(this.cid, this.objid, xtt.ctx.gdh.getAllClassAttributes(this.cid, this.objid,
xtt.open_attributes_cb, new XttOpenChildrenData(this.node, open_next)); xtt.open_attributes_cb, new XttOpenChildrenData(this.node, open_next));
this.node.node_open |= Open.ATTRIBUTES; this.node.node_open |= Open.ATTRIBUTES;
xtt.ctx.configure(); xtt.ctx.configure();
...@@ -690,6 +690,7 @@ class XttItemAttr { ...@@ -690,6 +690,7 @@ class XttItemAttr {
firstScan: boolean; firstScan: boolean;
old_value: number; old_value: number;
node: PlowNode; node: PlowNode;
constructor(xtt, info, destination, destCode) { constructor(xtt, info, destination, destCode) {
this.name = info.name; this.name = info.name;
this.objid = info.objid; this.objid = info.objid;
...@@ -807,6 +808,7 @@ class XttItemAttrArray { ...@@ -807,6 +808,7 @@ class XttItemAttrArray {
size: number; size: number;
elements: number; elements: number;
node: PlowNode; node: PlowNode;
constructor(xtt, info, destination, destCode) { constructor(xtt, info, destination, destCode) {
this.name = info.name; this.name = info.name;
this.objid = info.objid; this.objid = info.objid;
...@@ -882,6 +884,7 @@ class XttItemAttrObject { ...@@ -882,6 +884,7 @@ class XttItemAttrObject {
flags: number; flags: number;
size: number; size: number;
node: PlowNode; node: PlowNode;
constructor(xtt, info, destination, destCode) { constructor(xtt, info, destination, destCode) {
this.name = info.name; this.name = info.name;
this.classname = info.classname; this.classname = info.classname;
...@@ -905,7 +908,7 @@ class XttItemAttrObject { ...@@ -905,7 +908,7 @@ class XttItemAttrObject {
open_attributes(xtt, open_next) { open_attributes(xtt, open_next) {
if (this.node.node_open === 0) { if (this.node.node_open === 0) {
xtt.ctx.gdh.getAllClassAttributes(this.cid, this.objid, xtt.ctx.gdh.getAllClassAttributes(this.cid, this.objid,
xtt.open_attributes_cb, new XttOpenChildrenData(this.node, open_next)); xtt.open_attributes_cb, new XttOpenChildrenData(this.node, open_next));
this.node.node_open |= Open.ATTRIBUTES; this.node.node_open |= Open.ATTRIBUTES;
} else { } else {
...@@ -941,6 +944,7 @@ class XttItemCrr { ...@@ -941,6 +944,7 @@ class XttItemCrr {
objid: PwrtObjid; objid: PwrtObjid;
type: number; type: number;
node: PlowNode; node: PlowNode;
constructor(xtt, info, destination, destCode) { constructor(xtt, info, destination, destCode) {
this.name = info.name; this.name = info.name;
this.classname = info.classname; this.classname = info.classname;
......
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