<> <> <> <<>> <> <<>> 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 ANY _ NIL, mouseButton: Menus.MouseButton _ red, shift: BOOL _ FALSE, control: BOOL _ FALSE]>> vrID: Rope.ROPE = NARROW[clientData]; VoiceRope.Play[voiceRope: VoiceRope.VoiceRope[id: vrID]]; }; VoicePlayButton: LoganBerryBrowser.DisplayProc = { <<[entry: LoganBerry.Entry, output: ViewerClasses.Viewer, clientData: REF ANY _ NIL] RETURNS [continue: BOOL _ TRUE]>> 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.STREAM _ IO.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 " ]; END. <> <> <<>>