DIRECTORY Buttons USING [Button, ButtonProc], Imager USING [Font], Menus USING [MenuEntry, MenuProc, MouseButton], Rope USING [ROPE], ViewerClasses USING [Viewer, ViewerRec]; MBQueue: CEDAR DEFINITIONS = BEGIN Queue: TYPE = REF QueueObj; QueueObj: TYPE; Create: PROC [pushModel: BOOL ¬ TRUE] RETURNS [Queue]; CreateMenuEntry: PROC [ q: Queue, name: Rope.ROPE, proc: Menus.MenuProc, clientData: REF ¬ NIL, documentation: REF ¬ NIL, guarded: BOOL ¬ FALSE, immediate: BOOL ¬ FALSE ] RETURNS [Menus.MenuEntry]; CreateButton: PROC [ q: Queue, info: ViewerClasses.ViewerRec ¬ [], proc: Buttons.ButtonProc, clientData: REF ¬ NIL, font: Imager.Font ¬ NIL, documentation: REF ¬ NIL, guarded: BOOL ¬ FALSE, paint: BOOL ¬ TRUE, immediate: BOOL ¬ FALSE ] RETURNS [Buttons.Button]; QueueClientAction: PROC [q: Queue, proc: PROC [REF], data: REF, immediate: BOOL ¬ FALSE]; Action: TYPE = RECORD [ SELECT type: * FROM client => [ proc: PROC [REF], data: REF ], user => [ proc: Menus.MenuProc, parent: ViewerClasses.Viewer, clientData: REF, mouseButton: Menus.MouseButton, shift, control: BOOL ] ENDCASE ]; DequeueAction: PROC [q: Queue] RETURNS [Action]; Flush: PROC [q: Queue, abort: BOOL ¬ FALSE]; FlushWithCallback: PROC [q: Queue, proc: PROC [Action] ¬ NIL, abort: BOOL ¬ FALSE]; END.  MBQueue.mesa Copyright Σ 1985, 1986, 1987, 1991 by Xerox Corporation. All rights reserved. Created by: Cattell and Haugeland on October 21, 1982 9:11 am Doug Wyatt, January 20, 1987 3:25:07 am PST Russ Atkinson (RRA) January 20, 1987 3:07:11 am PST Provides Menu items and Buttons that are automatically serialized. Creates a queue, a context in which mouse buttons are serialized. All menu item and mouse button procs defined in the context of this queue will be strictly serialized, i.e. the procs will be called in the order that the user clicked, and each proc will completely finish execution before the next one starts. If pushModel = FALSE, then actions are to be removed from the queue by a client process, using DequeueAction (below), rather than by this package. The client process should be prepared to handle ABORTED. Similar to Menus.CreateEntry, except for the q and immediate arguments. Defines a menu item that is interpreted in the context of q. If immediate, then the queue entry is placed on the front of the queue, rather than the tail. Similar to Buttons.Create, except for the q and immediate arguments. Defines a button that is interpreted in the context of q. If immediate, then the queue entry is placed on the front of the queue, rather than the tail. Allows client to queue actions other than the menu item clicks and button clicks, which are user-initiated. The client's proc will be called after any user clicks before the call, and before any user clicks after the call. If immediate, then the event is placed on the front of the queue, rather than the tail. Waits for an action to appear, then returns it. Called only for "pull model" queues. Flushes all pending button presses and menu selections in the context of q. This procedure can be called, e.g., when some illegal actions suggests the user is confused an further mouse-ahead should be ignored. If abort and the Queue was created with pushModel = TRUE, then the notifier will be aborted. Like Flush, but applies proc to each action being flushed. Κ–(cedarcode) style•NewlineDelimiter ™codešœ ™ Kšœ ΟeœC™NKšœ=™=K™+K™3—K˜KšœB™B™šΟk ˜ Kšœžœ˜#Kšœžœ˜Kšœžœ$˜/Kšœžœžœ˜Kšœžœ˜(——K˜šΡblnœžœž œž˜"K˜Kšœžœžœ ˜Kšœ žœ˜K˜š Οnœžœ žœžœžœ ˜6KšœT™TKšœY™YKšœZ™ZKšœ,™,KšœX™XKšœ9™9Kšœ9™9K˜—K˜š œžœžœ$žœžœžœžœ žœžœ žœžœžœ˜ΕKš œ-Οzœ‘ œG‘œ‘ œQ™δK˜—K˜š  œžœWžœžœžœžœžœ žœžœ žœžœ žœžœžœ˜…Kš œ*‘œ‘ œD‘œ‘ œQ™ήK˜—K˜š œžœžœžœ žœ žœžœ˜YKšœδ‘ œK™ΈK˜—šœžœžœ˜šžœ žœ˜˜ Kšœžœžœ˜Kšœž˜ Kšœ˜—˜ K˜Kšœ*žœ˜.Kšœ0ž˜4Kšœ˜—Kšž˜—˜K˜——š  œžœ žœ ˜0Kšœ/™/Kšœ$™$K˜—š œžœžœžœ˜,Kšœ°™°K˜—š  œžœžœ žœ žœžœ˜SK™:K˜—K˜—Kšžœ˜—…— $