VoiceBrowserControl.mesa
Copyright © 1986 by Xerox Corporation. All rights reserved.
Doug Terry, January 21, 1987 7:12:06 pm PST
Tailors a LoganBerry browser for browsing and playing voice ropes. The browser should work on both the voice rope and interest databases.
DIRECTORY
Atom USING [GetPName],
Commander USING [CommandProc, Register],
IO USING [EndOfStream, GetTokenRope, IDProc, PutF, atom, rope, RIS, STREAM],
LoganBerry USING [AttributeType, AttributeValue, Entry, Error, Open, OpenDB],
LoganBerryBrowser USING [CreateTool, DisplayProc],
Rope USING [Cat, ROPE],
TiogaButtons USING [CreateButton, TiogaButtonProc],
VoiceRope USING [Play, VoiceRope];
VoiceBrowserControl: CEDAR PROGRAM
IMPORTS Atom, Commander, IO, LoganBerry, LoganBerryBrowser, Rope, TiogaButtons, VoiceRope
~ BEGIN
VoicePlayProc: TiogaButtons.TiogaButtonProc = {
[parent: REF ANY, clientData: REF ANYNIL, mouseButton: Menus.MouseButton ← red, shift: BOOLFALSE, control: BOOLFALSE]
vrID: Rope.ROPE = NARROW[clientData];
VoiceRope.Play[voiceRope: VoiceRope.VoiceRope[id: vrID]];
};
VoicePlayButton: LoganBerryBrowser.DisplayProc = {
[entry: LoganBerry.Entry, output: ViewerClasses.Viewer, clientData: REF ANYNIL] RETURNS [continue: BOOLTRUE]
vrID: Rope.ROPE;
contents: Rope.ROPE ← NIL;
FOR e: LoganBerry.Entry ← entry, e.rest UNTIL e = NIL DO
contents ← Rope.Cat[contents, Atom.GetPName[e.first.type], ": ", e.first.value, "\n"];
IF e.first.type = $VRID THEN vrID ← e.first.value;
ENDLOOP;
[] ← TiogaButtons.CreateButton[viewer: output, rope: contents, format: "body", proc: VoicePlayProc, clientData: vrID];
};
MakeBrowserTool: Commander.CommandProc = {
[cmd: Commander.Handle] RETURNS [result: REF ANY ← NIL, msg: ROPE ← NIL]
ENABLE LoganBerry.Error => {
IO.PutF[cmd.err, "Error: %g - %g\n", IO.atom[ec], IO.rope[explanation]];
GOTO End;
};
dbname: Rope.ROPE;
argStream: IO.STREAMIO.RIS[cmd.commandLine];
dbname ← IO.GetTokenRope[argStream, IO.IDProc ! IO.EndOfStream => {msg ← "No database name supplied.\n"; GOTO End}].token;
LoganBerryBrowser.CreateTool[db: LoganBerry.Open[dbName: dbname], outputFlavor: $TiogaButtons, proc: VoicePlayButton];
EXITS
End => RETURN;
};
Commander.Register[key: "VoiceBrowser", proc: MakeBrowserTool,
doc: "Create a tool for browsing and playing voice ropes.\n Usage: VoiceBrowser <dbname>" ];
END.
Doug Terry, January 21, 1987 7:12:06 pm PST
changes to: DIRECTORY, VoiceBrowserControl, IMPORTS, ~, VoicePlayProc, VoicePlayButton, MakeBrowserTool, END