<<>> <> <> <> <> <> <> <> <<>> DIRECTORY EBTypes, EmbeddedButtons, Rope, ScreenCoordsTypes, TIPTypes, ViewerClasses; EBEditors: CEDAR DEFINITIONS = BEGIN ActiveButton: TYPE = EBTypes.ActiveButton; ActiveDoc: TYPE = EBTypes.ActiveDoc; Event: TYPE = EBTypes.Event; ButtonInfo: TYPE = EBTypes.ButtonInfo; EachButtonProc: TYPE = EmbeddedButtons.EachButtonProc; ROPE: TYPE = Rope.ROPE; Viewer: TYPE = ViewerClasses.Viewer; <> <<(1) associate a data structure, called the ButtonData property with each object that is to have button behavior, and store a textual representation of the ButtonData property when the document is stored on disk.>> <<(2) pass input events to the HandleEvent routine, if the mouse is over a button object.>> <<(3) implement the routines described in ActiveDocClass below, and allocate an ActiveDoc record for each document that is to be active, using the CreateActiveDoc routine.>> <> <> <<>> <> <<>> CreateActiveDoc: PROC [theDoc: REF, docClass: ActiveDocClass] RETURNS [theActiveDoc: ActiveDoc]; <> FeedbackToEditor: PROC [feedback: REF, buttonInfo: ButtonInfo] RETURNS [REF]; <> <<>> ActionToEditor: PROC [action: LIST OF REF, buttonInfo: ButtonInfo, feedbackEvent: LIST OF REF]; < ApplyLook EndButton) or ((BeginButton) (> FillColorFromSelectedName) (EndButton)). Evaluate the <> expressions and repeatedly call EBEditors.FeedbackToEditor on each list of atoms. In our first example, FeedbackToEditor should be called once. In our second example, three times.>> <<>> ActiveDocClass: TYPE = REF ActiveDocClassObj; ActiveDocClassObj: TYPE = RECORD [ name: ATOM, getRef: GetRefProc, setRef: SetRefProc, mapRef: MapRefProc, feedback: FeedbackProc, inButton: InButtonProc, getText: GetTextProc, getDocName: GetDocNameProc, lookupActiveDoc: LookUpActiveDocProc ]; GetRefProc: TYPE = PROC [key: ATOM, button: ActiveButton, doc: ActiveDoc] RETURNS [ref: REF]; <> <<>> SetRefProc: TYPE = PROC [key: ATOM, button: ActiveButton, doc: ActiveDoc, ref: REF, edited: BOOL]; <> MapRefProc: TYPE = PROC [doc: ActiveDoc, mapProc: EachButtonProc] RETURNS [aborted: BOOL ¬ FALSE]; <> FeedbackProc: TYPE = PROC [button: ActiveButton, doc: ActiveDoc, feedback: REF] RETURNS [REF]; <> <> <<>> InButtonProc: TYPE = PROC [button: ActiveButton, doc: ActiveDoc, x, y: INTEGER] RETURNS [BOOL]; <> <<>> GetTextProc: TYPE = PROC [button: ActiveButton, doc: ActiveDoc] RETURNS [text: ROPE]; <> <<>> GetDocNameProc: TYPE = PROC [doc: ActiveDoc] RETURNS [name: ROPE]; <> <<>> LookUpActiveDocProc: TYPE = PROC [viewer: Viewer] RETURNS [doc: ActiveDoc]; <> <<>> <<>> <> <<>> GetEvent: PROC [input: LIST OF REF] RETURNS [Event]; <> ValidEvent: PROC [Event] RETURNS [BOOL]; <> MouseAction: PROC [Event] RETURNS [BOOL]; <> MouseAllUp: PROC [Event] RETURNS [BOOL]; <> MousePosition: TYPE ~ ScreenCoordsTypes.TIPScreenCoordsRec; MouseCoords: PROC [Event] RETURNS [MousePosition]; <> HandleEvent: PROC [event: Event, button: ActiveButton, doc: ActiveDoc]; <> <> <> <<>> ParseEvent: PROC [TIPTypes.TIPTable, Event] RETURNS [LIST OF REF]; <> ButtonDataFromRope: PROC [rope: ROPE, instantiateNow: BOOL ¬ FALSE, button: ActiveButton ¬ NIL, doc: ActiveDoc ¬ NIL] RETURNS [val: REF]; <> RopeFromButtonData: PROC [val: REF] RETURNS [rope: ROPE]; <> <<>> END.