\class {vpane} \name {plot} \script { /* set environment variable PLOT_PATH to the vplot directory * ie: setenv PLOT_PATH "/usr/work/vplot" * * which should contain * - vplot binary * - the OFF data sub directory */ switch (arg[0]) { case "build": /* arg[1] sourcefile * arg[2] parent * arg[3] name * arg[4] width * ret documentObject or 0 */ docObj = plot.info("clone"); send(docObj, "build", arg[1], arg[2], arg[3], arg[4]); if (isBlank(docObj) == 1) { www.mesg.tf("show", concatenate("Failed to get ", arg[1])); cursorShape("idle"); return 0; } else { www.mesg.tf("show", ""); www.udi.tf("show", arg[1]); return docObj; } break; case "TTYObjP": return nthChild(0); break; case "canvas_WIDP": case "canvas_widthP": case "canvas_heightP": return send(nthChild(2), arg[0]); break; } usual(); } \children {plot.TTY plot.head plot.body plot.cmd} \width {500} \height {500} \ \class {txtLabel} \name {plot.head} \parent {plot} \label {XPlot} \maxHeight {18} \font {normal} \ \class {hpane} \name {plot.body} \parent {plot} \children {plot.body.view plot.body.ctrl} \script { switch (arg[0]) { case "canvas_WIDP": case "canvas_widthP": case "canvas_heightP": return send(nthChild(0), arg[0]); break; case "TTYObjP": return send(parent(), "TTYObjP"); break; } usual(); } \ \class {field} \name {plot.body.view} \parent {plot.body} \BGColor {LightSteelBlue4} \BDColor {LemonChiffon4} \FGColor {black} \script { switch (arg[0]) { case "canvas_WIDP": return get("window"); break; case "canvas_widthP": return get("width"); break; case "canvas_heightP": return get("height"); break; case "clear": clearWindow(); return; break; case "expose": case "config": usual(); if (get("window") != 0) { TTYObj = send(parent(), "TTYObjP"); /* send(TTYObj, "initClient"); */ after(1, TTYObj, "initClient"); } /* width = send(parent(), "canvas_widthP"); height = send(parent(), "canvas_heightP"); send(TTYObj, "output", concat("window ", get("window"), " ", get("width"), " ", get("height"))); print(">>>", concat("w ", get("window"), " ", get("width"), " ", get("height")), "\n"); */ return; break; } usual(); } \ \class {vpane} \name {plot.body.ctrl} \parent {plot.body} \children {plot.body.ctrl.ops plot.body.ctrl.cam} \script { switch (arg[0]) { case "TTYObjP": return send(parent(), "TTYObjP"); break; case "SUPER_HACK": return send(nthChild(0), "SUPER_HACK"); break; } usual(); } \maxWidth {70} \ \class {menu} \name {plot.body.ctrl.ops} \parent {plot.body.ctrl} \label {Ops} \script { switch (arg[0]) { case "buttonRelease": /* send(send(parent(), "TTYObjP"), "output", "quit"); quit(); */ break; case "x29": TTYObj = send(parent(), "TTYObjP"); send(TTYObj, "output", "domain -10 10 -10 10"); send(TTYObj, "output", concat("file ", PLOT_PATH, "/off/x29.geom")); send(TTYObj, "output", "expose"); return; break; case "TomCat": TTYObj = send(parent(), "TTYObjP"); send(TTYObj, "output", "domain -10 10 -10 10"); send(TTYObj, "output", concat("file ", PLOT_PATH, "/off/TomCat")); send(TTYObj, "output", "expose"); return; break; case "eq1": TTYObj = send(parent(), "TTYObjP"); send(TTYObj, "output", "interval .2"); send(TTYObj, "output", "domain -2 2 -2 2"); send(TTYObj, "output", "equation .4 * sin(x * y)"); send(TTYObj, "output", "expose"); return; break; case "eq2": TTYObj = send(parent(), "TTYObjP"); send(TTYObj, "output", "interval .2"); send(TTYObj, "output", "domain -2 2 -2 2"); send(TTYObj, "output", "equation .4 * sin(1 - x*x - y*y)"); send(TTYObj, "output", "expose"); return; break; case "eq3": TTYObj = send(parent(), "TTYObjP"); send(TTYObj, "output", "interval .2"); send(TTYObj, "output", "domain -2 2 -2 2"); send(TTYObj, "output", "equation .4 * exp(1 - x*x - y*y) * sin(1 - x*x - y*y)"); send(TTYObj, "output", "expose"); return; break; case "eq4": TTYObj = send(parent(), "TTYObjP"); send(TTYObj, "output", "interval .2"); send(TTYObj, "output", "domain -2 2 -2 2"); send(TTYObj, "output", "equation .4 * exp(1 - x*x - y*y) * sin(1 - x^4 - y^4)"); send(TTYObj, "output", "expose"); return; break; case "SUPER_HACK": set("visible", 0); set("visible", 1); return; break; case "init": usual(); PLOT_PATH = environVar("PLOT_PATH"); return; break; } usual(); } \gapH {3} \gapV {3} \maxHeight {20} \height {20} \border {3} \menuConfig { . {file x29.geom} {send(self(), "x29");} . {file TomCat} {send(self(), "TomCat");} . {equation .4 * sin(x * y)} {send(self(), "eq1");} . {equation .4 * sin(1 - x*x - y*y)} {send(self(), "eq2");} . {equation .4 * exp(1 - x*x - y*y) * sin(1 - x*x - y*y) } {send(self(), "eq3");} . {equation .4 * exp(1 - x*x - y*y) * sin(1 - x^4 - y^4) } {send(self(), "eq4");} . {\\} . {MB On} {send(send(parent(), "TTYObjP"), "mbuf on"); . {MB Off} {send(send(parent(), "TTYObjP"), "mbuf off"); . {Record On} {send(send(parent(), "TTYObjP"), "record on"); . {Record Off} {send(send(parent(), "TTYObjP"), "record off"); . {Clear} {send(send(parent(), "TTYObjP"), "clear"); . {Replay } {send(send(parent(), "TTYObjP"), "replay"); . {\\} . {Quit} {quit();} } \ \class {hpane} \name {plot.body.ctrl.cam} \parent {plot.body.ctrl} \children {plot.body.ctrl.cam.x plot.body.ctrl.cam.y plot.body.ctrl.cam.z} \script { switch (arg[0]) { case "TTYObjP": return send(parent(), "TTYObjP"); break; case "expose": send(parent(), "SUPER_HACK"); break; } usual(); } \gapH {3} \gapV {3} \maxHeight {200} \height {200} \ \class {slider} \name {plot.body.ctrl.cam.x} \parent {plot.body.ctrl.cam} \script { switch (arg[0]) { case "_shownPositionV": send(TTYObj, "cx", arg[1]); break; case "expose": usual(); TTYObj = send(parent(), "TTYObjP"); return; break; } usual(); } \ \class {slider} \name {plot.body.ctrl.cam.y} \parent {plot.body.ctrl.cam} \script { switch (arg[0]) { case "_shownPositionV": send(TTYObj, "cy", arg[1]); break; case "expose": usual(); TTYObj = send(parent(), "TTYObjP"); return; break; } usual(); } \ \class {slider} \name {plot.body.ctrl.cam.z} \parent {plot.body.ctrl.cam} \script { switch (arg[0]) { case "_shownPositionV": send(TTYObj, "cz", arg[1]); break; case "expose": usual(); TTYObj = send(parent(), "TTYObjP"); return; break; } usual(); } \ \class {txtEdit} \name {plot.cmd} \parent {plot} \script { switch (arg[0]) { case "buttonPress": send(send(parent(), "TTYObjP"), "initClient"); return; break; case "keyPress": c = key(); if (c == '\r') { /* cursorShape("busy"); */ print("issue command:", currentLine(), "\n"); send(get("parent"), "search", currentLine()); insert('\r'); insert(c); if (cursorRow() != 0) { /* a kludgy safe guard to simulate * carriage-return then ctrl-p */ insert("\r\16\1"); } } else { insert(c); } return; break; case "busy": case "idle": cursorShape(arg[0]); return; break; } usual(); } \maxHeight {18} \ \class {TTY} \name {plot.TTY} \parent {plot} \script { /* print(": ", arg[0], ", ", arg[1], "\n");*/ /* print("TTY: ", arg[0], "\n"); */ switch (arg[0]) { case "cx": output(concat("cx ", arg[1])); if (record == 1) { tape[tapeIdx++] = concat("cx ", arg[1]); } return; break; case "cy": output(concat("cy ", arg[1])); if (record == 1) { tape[tapeIdx++] = concat("cy ", arg[1]); } return; break; case "cz": output(concat("cz ", arg[1])); if (record == 1) { tape[tapeIdx++] = concat("cz ", arg[1]); } return; break; case "output": output(arg[1]); return; break; case "input": in = input(0); /* print("####### plot.tty input: {", in, "}\n"); */ /* if (in == "BEGIN") { print("plot.tty: sending initialization cmds\n"); output("bgcolor LemonChiffon1"); output("fgcolor black"); w = send(parent(), "canvas_WIDP"); width = send(parent(), "canvas_widthP"); height = send(parent(), "canvas_heightP"); output(concat("w ", w, " ", width, " ", height)); } */ return; break; case "init": usual(); PLOT_PATH = environVar("PLOT_PATH"); set("path", concat(PLOT_PATH, "/vplot")); print("plot.tty: init\n"); initialize(); set("inDelimStr1", "\n"); set("inDelimStr2", "\r"); set("outDelimStr", "\n"); startClient(); return; break; case "record on": record = 1; return; break; case "record off": record = 0; return; break; case "mbuf on": case "mbuf off": output(arg[0]); return; break; case "clear": tapeIdx = 0; /*XXX*/ return; break; case "replay": for (i = 0; i < tapeIdx; i++) { output(tape[i]); } return; break; case "initClient": print("plot.tty: sending initialization cmds\n"); w = send(parent(), "canvas_WIDP"); width = send(parent(), "canvas_widthP"); height = send(parent(), "canvas_heightP"); output(concat("window ", w, " ", width, " ", height)); output("domain -2 2 -2 2"); output("interval .2"); output("equation 0"); output("bgcolor LemonChiffon1"); output("fgcolor yellow"); output("expose"); output("expose"); print(" w = {", w, "}\n"); return; break; } usual(); } \height {1} \maxHeight {1} \