\class {vpane} \name {inset_talk} \children {inset_talk.ctrls inset_talk.com inset_talk.name inset_talk.sketchLabel inset_talk.fd inset_talk.talkOut inset_talk.tf inset_talk.entry} \script { switch (arg[0]) { case "make": set("parent", arg[1]); return get("height"); break; case "showLine": send(nthChild(4), arg[0], arg[1]); return; break; case "showText": send(nthChild(6), arg[0], arg[1]); return; break; case "output": send(nthChild(1), arg[0], arg[1]); return; break; case "connect": send(nthChild(1), arg[0], arg[1], arg[2]); return; break; } usual(); } \border {3} \gapH {2} \gapV {2} \width {500} \height {500} \ \class {hpane} \name {inset_talk.ctrls} \parent {inset_talk} \children {inset_talk.ctrls.ops} \script { switch (arg[0]) { case "output": return send(parent(), arg[0], arg[1]); break; } usual(); } \maxHeight {25} \gapH {4} \gapV {2} \ \class {menu} \name {inset_talk.ctrls.ops} \parent {inset_talk.ctrls} \label {Operations} \menuConfig {. {Show Users} {send(parent(), "output", "WHO");} . {Clear sketch pad (not yet)} . {\\} . {Help} {send("www", "show", "http://berkeley.ora.com/proj/viola/vw/groupTalk.html");} } \maxWidth {100} \gapH {2} \gapV {4} \border {3} \ \class {hpane} \name {inset_talk.name} \parent {inset_talk} \children {inset_talk.name.label inset_talk.name.content} \script { switch (arg[0]) { case "output": return send(parent(), arg[0], arg[1]); break; } usual(); } \maxHeight {20} \gapH {4} \gapV {2} \ \class {txtLabel} \name {inset_talk.name.label} \parent {inset_talk.name} \font {normal} \maxWidth {100} \label {Your name:} \paneConfig {westToWest} \gapH {4} \maxHeight {18} \ \class {txtEdit} \name {inset_talk.name.content} \parent {inset_talk.name} \font {normal} \script { switch (arg[0]) { case "keyPress": if (key() == '\r') { print(">>>>", currentLine(), "<<\n"); send(parent(), "output", concat("NAME=", currentLine())); return; } break; } usual(); } \gapH {4} \ \class {txtLabel} \name {inset_talk.sketchLabel} \parent {inset_talk} \label {Sketch field:} \paneConfig {westToWest} \font {normal} \gapH {4} \maxHeight {18} \ \class {field} \name {inset_talk.fd} \parent {inset_talk} \font {normal} \script { /* print(">>>> tf: arg[0]=", arg[0], "<<\n"); print(">>>> tf: arg[1]=", arg[1], "<<\n"); */ switch (arg[0]) { case "mouseMove": if (penDownP) { x0 = x1; y0 = y1; x1 = arg[1]; y1 = arg[2]; drawLine(x0, y0, x1, y1); send(parent(), "output", concat("LINE ", x0, ' ', y0, ' ', x1, ' ', y1)); } return; break; case "buttonPress": penDownP = 1; x0 = mouseX(); y0 = mouseY(); x1 = x0; y1 = y0; break; case "buttonRelease": penDownP = 0; break; case "showLine": tt = arg[1]; nx0 = nthWord(tt, 2); ny0 = nthWord(tt, 3); nx1 = nthWord(tt, 4); ny1 = nthWord(tt, 5); /* print(">>>> line: nx0=", nx0, " ny0=", ny0, " nx1=", nx1, " ny1=", ny1, "<<<<<<<<<<<\n"); */ drawLine(nx0, ny0, nx1, ny1); return; break; } usual(); } \gapH {4} \gapV {2} \border {6} \ \class {txtLabel} \name {inset_talk.talkOut} \parent {inset_talk} \label {Talk out field:} \paneConfig {westToWest} \font {normal} \gapH {4} \maxHeight {18} \ \class {txtDisp} \name {inset_talk.tf} \parent {inset_talk} \font {normal} \script { switch (arg[0]) { case "buttonPress": return; break; case "showText": /* print(">>>> insert: ", arg[1], "<<\n");*/ insert(arg[1]); insert('\n'); return; break; } usual(); } \border {3} \gapH {4} \gapV {2} \ \class {txtEdit} \name {inset_talk.entry} \parent {inset_talk} \font {normal} \script { switch (arg[0]) { case "keyPress": if (key() == '\r') { print(">>>>", currentLine(), "<<\n"); send(parent(), "output", concat("SAY ", currentLine())); } break; } usual(); } \maxHeight {50} \gapH {4} \gapV {4} \ \class {socket} \name {inset_talk.com} \parent {inset_talk} \script { switch (arg[0]) { case "input": ss = input(); /* print(">>>> input={", ss, "}\n");*/ cmd = nthWord(ss, 0); /* print(">>>> cmd={", cmd, "}\n");*/ if (cmd == "SAID") { send(parent(), "showText", nthChar(ss, 5, 999)); } else if (cmd == "LINE") { send(parent(), "showLine", nthChar(ss, 5, 999)); } else if (cmd == "USRS") { send(parent(), "showText", concat("USERS: ", nthChar(ss, 5, 999))); } return; break; case "output": /* print(">>>> output'ing={", arg[1], "}\n");*/ output(arg[1]); return; break; case "connect": print(">>>> connecting to host={", arg[1], "}\n"); print(">>>> connecting to port={", arg[2], "}\n"); set("host", arg[1]); set("port", arg[2]); set("outDelimStr", "\r\n"); set("inDelimStr1", '\n'); startClient(); return; break; case "init": usual(); port = 8802; host = "pebble.ebay.gnn.com"; send(self(), "connect", host, port); return; break; case "buttonRelease": send(self(), "connect", host, port); set("BGColor", "red"); render(); return; break; } usual(); } \maxHeight {3} \gapH {2} \