DIRECTORY ViewerClasses USING [Viewer]; ViewerEvents: CEDAR DEFINITIONS = BEGIN EventProc: TYPE = PROC [viewer: ViewerClasses.Viewer, event: ViewerEvent, before: BOOL] RETURNS[abort: BOOL _ FALSE] ; ViewerEvent: TYPE = {save, edit, destroy, create, close, open, grow, changeColumn, setInputFocus, killInputFocus} ; EventRegistration: TYPE = REF ; RegisterEventProc: PROC [proc: EventProc, event: ViewerEvent, filter: REF ANY _ NIL, before: BOOL _ TRUE] RETURNS [EventRegistration] ; UnRegisterEventProc: PROC [proc: EventRegistration, event: ViewerEvent] ; ProcessEvent: PRIVATE PROC [event: ViewerEvent, viewer: ViewerClasses.Viewer, before: BOOL] RETURNS[abort: BOOL] ; END. ζViewerEvents.mesa; Written by S. McGregor Edited by McGregor on July 21, 1983 10:45 am Last Edited by: Maxwell, January 11, 1983 12:26 pm Last Edited by: Wyatt, October 26, 1983 4:29 pm abort will abort the event and the remaining EventProcs This interface, while fairly easy to use, requires some understanding of the viewer tree and paint locking mechanisms. All of the calls to client code occur outside of the locking mechanism. To be absolutely safe, the client should lock the appropriate resources and retest the initial condition. Consult a Viewer's wizard for more information. There are two calls for each event: before anything happens and after everything (including the painting) is complete. The first call of a create occurs after the ViewerRec is NEW'ed but before the parameters are checked. Parameters can be changed if desired. Register a procedure that can be called before or after the specified event occurs. The filter can be a particular Viewer, a ViewerFlavor, a ViewerClass, or NIL. When before is TRUE the EventProc can abort the event. A client that wishes to unregister the procedure at some point should save the EventRegistration returned. Note: many of the EventProcs are called from within the Viewer tree write lock. If you try to perform a ViewerOps function that requires the write lock from within your EventProc then you will deadlock. Some of the events may also have acquired the paint lock. If you are concerned about deadlocks or if you plan to do anything time-consuming in an EventProc, consider forking a separate process to avoid degrading system performance. Unregister an EventProc registered via RegisterEventProc. Window manager internal use only. Called once before and once after each event. Κr– "cedar" style˜JšΟc)™)Jš,™,J™2J™/J™šΟk ˜ Jšœžœ ˜J˜—Jšœž˜Jšœž˜J˜šΟn œžœžœ<žœ˜WJšžœžœžœ˜Jš8™8—J˜JšΫ™ΫJ˜šœ žœ˜J˜_Jšœ±žœQ™…J˜—Jšœžœžœ˜J˜šŸœžœ'˜>Jš œžœžœžœ žœžœžœ˜IJšœžžœžœΖ™ύJ˜—šŸœžœ0˜IJš9™9J˜—šŸ œžœžœ<žœ˜[Jšžœžœ˜JšP™PJ˜—Jšžœ˜J˜J˜—…—²