DIRECTORY Commander USING [CommandProc, Handle, Register], Convert USING [RopeFromInt], FS USING [ComponentPositions, ExpandName], IO, LoganBerry USING [AttributeType, AttributeValue, Entry, Error, Open, OpenDB, ReadEntry], LoganBerryBrowser USING [CreateTool, DBInfo, DBInfoRec, DetailsProc, HistoryProc, ReadEntryForm, Tool, ToolBody, StopProc, BrowseProc, UpdateProc, DeleteProc, UnDeleteProc], LoganBerryBrowserExtras USING [AdminOpsProc, DisplayProc, PrintEntryAsButton, RegisterDisplayProc], LoganQuery USING [AttributePatterns], Menus USING [AppendMenuEntry, ClickProc, CreateEntry, CreateMenu, Menu, MenuLine], Rope USING [Concat, ROPE], TiogaButtons USING [TiogaButtonProc], VoiceRope USING [DescribeRope, IntervalSpecs, Length, Play, Record, Stop, VoiceRope, VoiceRopeInterval]; VoiceBrowserImpl: CEDAR PROGRAM IMPORTS Commander, Convert, FS, IO, LoganBerry, LoganBerryBrowser, LoganBerryBrowserExtras, Menus, Rope, VoiceRope ~ BEGIN ROPE: TYPE = Rope.ROPE; STREAM: TYPE = IO.STREAM; BrowserTool: TYPE ~ LoganBerryBrowser.Tool; vr: VoiceRope.VoiceRope _ NEW[VoiceRope.VoiceRopeInterval _ [ropeID: NIL, start: 0, length: LAST[INT]]]; RecordProc: Menus.ClickProc = { tool: BrowserTool _ NARROW[clientData]; entry: LoganBerry.Entry; newvr: VoiceRope.VoiceRope _ VoiceRope.Record[]; entry _ LoganBerry.ReadEntry[db: tool.databases.first.db, key: $VRID, value: newvr.ropeID].entry; IF entry=NIL THEN entry _ LIST[[$WARNING, "Voice rope not recorded in this database."]]; LoganBerryBrowserExtras.PrintEntryAsButton[entry: entry, tool: tool, proc: PlayButton, clientData: newvr.ropeID]; }; PlayProc: Menus.ClickProc = { tool: BrowserTool _ NARROW[clientData]; form: LoganQuery.AttributePatterns _ LoganBerryBrowser.ReadEntryForm[tool].form; vr.ropeID _ GetFormValue[form, $VRID]; VoiceRope.Play[voiceRope: vr]; }; StopProc: Menus.ClickProc = { tool: BrowserTool _ NARROW[clientData]; VoiceRope.Stop[]; }; LengthProc: Menus.ClickProc = { tool: BrowserTool _ NARROW[clientData]; form: LoganQuery.AttributePatterns _ LoganBerryBrowser.ReadEntryForm[tool].form; len: INT; vr.ropeID _ GetFormValue[form, $VRID]; len _ VoiceRope.Length[vr: vr]; LoganBerryBrowserExtras.PrintEntryAsButton[entry: LIST[[$VRID, vr.ropeID], [$Length, Convert.RopeFromInt[len]]], tool: tool, proc: PlayButton, clientData: vr.ropeID]; }; DescribeProc: Menus.ClickProc = { tool: BrowserTool _ NARROW[clientData]; form: LoganQuery.AttributePatterns _ LoganBerryBrowser.ReadEntryForm[tool].form; entry: LoganBerry.Entry; noise: VoiceRope.IntervalSpecs; vr.ropeID _ GetFormValue[form, $VRID]; noise _ VoiceRope.DescribeRope[vr: vr]; entry _ LIST[[$VRID, vr.ropeID]]; FOR i: VoiceRope.IntervalSpecs _ noise, i.rest WHILE i#NIL DO entry _ CONS[[$start, Convert.RopeFromInt[i.first.start]], entry]; entry _ CONS[[$length, Convert.RopeFromInt[i.first.length]], entry]; ENDLOOP; entry _ ReverseEntry[entry]; LoganBerryBrowserExtras.PrintEntryAsButton[entry: entry, tool: tool, proc: PlayButton, clientData: vr.ropeID]; }; GetAttributeValue: PROC [entry: LoganBerry.Entry, type: LoganBerry.AttributeType] RETURNS [LoganBerry.AttributeValue] ~ { FOR e: LoganBerry.Entry _ entry, e.rest WHILE e # NIL DO IF e.first.type = type THEN RETURN[e.first.value]; ENDLOOP; RETURN[NIL]; }; GetFormValue: PROC [form: LoganQuery.AttributePatterns, type: LoganBerry.AttributeType] RETURNS [LoganBerry.AttributeValue] ~ { FOR e: LoganQuery.AttributePatterns _ form, e.rest WHILE e # NIL DO IF e.first.attr.type = type THEN RETURN[e.first.attr.value]; ENDLOOP; RETURN[NIL]; }; ReverseEntry: PROC [entry: LoganBerry.Entry] RETURNS [LoganBerry.Entry] = { l1, l2, l3: LoganBerry.Entry _ NIL; IF entry = NIL THEN RETURN[NIL]; l3 _ entry; UNTIL (l1 _ l3) = NIL DO l3 _ l3.rest; l1.rest _ l2; l2 _ l1; ENDLOOP; RETURN[l2]; }; PlayButton: TiogaButtons.TiogaButtonProc = { vr.ropeID _ NARROW[clientData]; IF vr.ropeID=NIL THEN RETURN; VoiceRope.Play[voiceRope: vr]; }; MakePlayButton: LoganBerryBrowserExtras.DisplayProc = { LoganBerryBrowserExtras.PrintEntryAsButton[entry, tool, PlayButton, GetAttributeValue[entry, $VRID]]; }; MakeMainMenu: PROC [tool: LoganBerryBrowser.Tool] RETURNS [menu: Menus.Menu] ~ { AppendMenu: PROC[menu: Menus.Menu, name: ROPE, proc: Menus.ClickProc, line: Menus.MenuLine _ 0, guarded: BOOL _ FALSE] = { Menus.AppendMenuEntry[ menu: menu, entry: Menus.CreateEntry[name: name, proc: proc, clientData: tool, guarded: guarded], line: line ]; }; menu _ Menus.CreateMenu[]; AppendMenu[menu, "STOP!", LoganBerryBrowser.StopProc]; AppendMenu[menu, "Browse", LoganBerryBrowser.BrowseProc]; AppendMenu[menu, "Update", LoganBerryBrowser.UpdateProc]; AppendMenu[menu, "Delete", LoganBerryBrowser.DeleteProc, 0, TRUE]; AppendMenu[menu, "UnDelete", LoganBerryBrowser.UnDeleteProc, 0, TRUE]; AppendMenu[menu, "History", LoganBerryBrowser.HistoryProc]; AppendMenu[menu, "Details", LoganBerryBrowser.DetailsProc]; AppendMenu[menu, "VoiceOps", LoganBerryBrowserExtras.AdminOpsProc]; AppendMenu[menu, "Record", RecordProc, 1]; AppendMenu[menu, "Play", PlayProc, 1]; AppendMenu[menu, "Stop", StopProc, 1]; AppendMenu[menu, "Length", LengthProc, 1]; AppendMenu[menu, "Describe", DescribeProc, 1]; }; MakeBrowserTool: Commander.CommandProc = { ENABLE LoganBerry.Error => { IO.PutF[cmd.err, "Error: %g - %g\n", IO.atom[ec], IO.rope[explanation]]; GOTO End; }; Open: PROC [dbname: ROPE] RETURNS [db: LoganBerry.OpenDB] ~ { cp: FS.ComponentPositions; fullDBName: ROPE; [fullDBName, cp] _ FS.ExpandName[dbname]; IF cp.ext.length = 0 AND cp.ver.length = 0 THEN fullDBName _ Rope.Concat[fullDBName, ".df"]; db _ LoganBerry.Open[dbName: fullDBName]; }; dbname: ROPE; tool: LoganBerryBrowser.Tool _ NEW[LoganBerryBrowser.ToolBody]; argStream: IO.STREAM _ IO.RIS[cmd.commandLine]; DO dbname _ IO.GetTokenRope[argStream, IO.IDProc ! IO.EndOfStream => EXIT].token; tool.databases _ CONS[NEW[LoganBerryBrowser.DBInfoRec _ [db: Open[dbname]]], tool.databases]; ENDLOOP; IF tool.databases = NIL THEN RETURN[result: NIL, msg: "No database name supplied.\n"]; tool.name _ Rope.Concat["Voice Browser: ", dbname]; tool.menu _ MakeMainMenu[tool]; tool.innerFlavor _ $TiogaButtons; LoganBerryBrowserExtras.RegisterDisplayProc[proc: MakePlayButton, tool: tool]; LoganBerryBrowser.CreateTool[tool: tool]; EXITS End => RETURN; }; Commander.Register[key: "VoiceBrowser", proc: MakeBrowserTool, doc: "Create a voice rope browser.\n usage: VoiceBrowser ..." ]; END. hVoiceBrowserImpl.mesa Copyright Σ 1987 by Xerox Corporation. All rights reserved. Doug Terry, July 28, 1987 4:43:14 pm PDT A modified LoganBerry browser that allows one to play voice ropes using Tioga buttons. [parent: ViewerClasses.Viewer, clientData: REF ANY _ NIL, mouseButton: ViewerClasses.MouseButton _ red, shift: BOOL _ FALSE, control: BOOL _ FALSE] query voice rope just recorded [parent: ViewerClasses.Viewer, clientData: REF ANY _ NIL, mouseButton: ViewerClasses.MouseButton _ red, shift: BOOL _ FALSE, control: BOOL _ FALSE] [parent: ViewerClasses.Viewer, clientData: REF ANY _ NIL, mouseButton: ViewerClasses.MouseButton _ red, shift: BOOL _ FALSE, control: BOOL _ FALSE] [parent: ViewerClasses.Viewer, clientData: REF ANY _ NIL, mouseButton: ViewerClasses.MouseButton _ red, shift: BOOL _ FALSE, control: BOOL _ FALSE] [parent: ViewerClasses.Viewer, clientData: REF ANY _ NIL, mouseButton: ViewerClasses.MouseButton _ red, shift: BOOL _ FALSE, control: BOOL _ FALSE] Destructively reverses the order of the entry's attributes. Taken from LispImpl.DReverse. [button: TiogaButtons.TiogaButton, clientData: REF ANY _ NIL, mouseButton: ViewerClasses.MouseButton _ red, shift: BOOL _ FALSE, control: BOOL _ FALSE] [entry: LoganBerry.Entry, tool: LoganBerryBrowser.Tool] --second line-- [cmd: Commander.Handle] RETURNS [result: REF ANY _ NIL, msg: ROPE _ NIL] Κ Ϊ˜codešœ™Kšœ<™˜>JšœR˜R——K˜Kšœ˜—…—*Z