DIRECTORY IO USING[STREAM], MBQueue USING[Queue], Rope USING[ROPE], StackCirio USING[Stack], ViewerClasses USING[Viewer]; CirioButtons: CEDAR DEFINITIONS = BEGIN Viewer: TYPE ~ ViewerClasses.Viewer; ViewerControl: TYPE = REF ViewerControlBody; ViewerControlBody: TYPE = MONITORED RECORD[ destroyStarted: BOOLEAN, okToDestroy: BOOLEAN, self: Viewer, script: Viewer, in: IO.STREAM, -- viewer typescript out: IO.STREAM, -- writes onto the viewer typescript mbQueue: MBQueue.Queue, nextButtonAction: LIST OF ButtonAction, lastButtonAction: LIST OF ButtonAction, formatPrompt: PROC [counter: INT, clientData: REF ANY] RETURNS [Rope.ROPE], interpretTextLine: PROC[line: Rope.ROPE, reports: IO.STREAM, clientData: REF ANY] RETURNS[Rope.ROPE], shutDown: PROC[clientData: REF ANY, reports: IO.STREAM], clientData: REF ANY ]; ButtonAction: TYPE = REF ButtonActionBody; ButtonActionBody: TYPE = RECORD[ action: PROC[ButtonAction], data: REF ANY, ignoreDestroyStarted: BOOLEAN ¬ FALSE]; CreateViewer: PROC [ name: Rope.ROPE, scriptY: CARD, formatPrompt: PROC [counter: INT, clientData: REF ANY] RETURNS [Rope.ROPE], interpretTextLine: PROC[line: Rope.ROPE, reports: IO.STREAM, clientData: REF ANY] RETURNS[Rope.ROPE], shutDown: PROC[clientData: REF ANY, reports: IO.STREAM], clientData: REF ANY] RETURNS[ViewerControl]; MainActionProc: PROC[control: ViewerControl]; InstallWalkStackButton: PROC[bs: ButtonSet, stack: StackCirio.Stack, threadIndexText: Rope.ROPE, frameIndexLabel: Viewer]; InstallShowFrameButton: PROC[bs: ButtonSet, stack: StackCirio.Stack]; InstallSourcePositionButton: PROC[bs: ButtonSet, stack: StackCirio.Stack]; InstallSourceLanguageButton: PROC[bs: ButtonSet, stack: StackCirio.Stack]; ButtonSet: TYPE = REF ButtonSetBody; ButtonSetBody: TYPE = RECORD[ container: Viewer, vc: ViewerControl, validFlag: BOOLEAN, x, y: CARD, colX: CARD, lineH: CARD, fixedWidth: CARD ¬ 0]; ButtonSize: TYPE = RECORD[w, h: CARD]; CreateButtonSet: PROC[container: Viewer, vc: ViewerControl, x, y: CARD, colX: CARD, lineH: CARD, fixedWidth: CARD ¬ 0] RETURNS[ButtonSet]; KillButtonSet: PROC[bs: ButtonSet, paint: BOOLEAN ¬ TRUE] RETURNS[ButtonSet]; NewLine: PROC[bs: ButtonSet]; MoveToY: PROC[bs: ButtonSet, y: CARD]; -- resets x to colX SkipY: PROC[bs: ButtonSet, h: CARD]; MoveToX: PROC[bs: ButtonSet, x: CARD]; SkipX: PROC[bs: ButtonSet, w: CARD]; GetButtonSize: PROC[name: Rope.ROPE] RETURNS[ButtonSize]; InstallCommandButton: PROC [ bs: ButtonSet, name: Rope.ROPE, border: BOOL ¬ FALSE, guarded: BOOL ¬ FALSE, clientData1: REF ANY, choices: ChoiceList ¬ NIL, proc1: PROC[button: Viewer, vc: ViewerControl, key, clientData1: REF ANY] RETURNS[clientData2: REF ANY] ¬ NIL, proc2: PROC[button: Viewer, vc: ViewerControl, key, clientData1, clientData2: REF ANY]] RETURNS[Viewer]; ChoiceList: TYPE = LIST OF Choice; Choice: TYPE = RECORD [key: REF ANY, doc: Rope.ROPE]; InstallLabelButton: PROC[bs: ButtonSet, name: Rope.ROPE] RETURNS[Viewer]; InstallRule: PROC[bs: ButtonSet]; END.. Θ CirioButtons.mesa Copyright Σ 1990, 1992 by Xerox Corporation. All rights reserved. Sturgis, January 19, 1990 2:43:23 pm PST Last tweaked by Mike Spreitzer on August 29, 1990 10:30:46 am PDT Cirio uses a rather baroque button mechanism. Because many buttons appear in more than one tool, we provide an interface to a collection of these buttons. Each of these buttons is accessed from a ButtonProc. This button proc expects a REF ANY data item. We include a specification for that data item. each button requires access to general control information This routine is to be forked. It is to run outside the mbQueue. There is to be exactly one of these per tool instance. (i.e., one per Viewer). Stack debug buttons (threadIndexText will be NIL for a pop up debugger.) Button installation procedures new buttons will be created with container as their parent Starts True. Set to False during subsequent destruction of the buttons. When false, most buttons should act as no-ops. x and y will change as buttons are added this will destroy the containing viewer. Hence, the containing viewer should be a subviewer of the main viewer. always returns NIL, for clearing a variable If proc1 is non-nil, then it gets called at (approx) button click time. proc2 will be called later, after all previously queued actions have been completed. If proc1 was nil, then clientData2 in proc2 will be nil, otherwise it will be the result of proc1. It is expected that proc1 will perform no significant action. The purpose of proc1 is to record any significant visible information that may change before proc2 runs. For example, proc1 might record the contents of a current selection. Few command buttons will require a proc1. Κ°–(cedarcode) style•NewlineDelimiter ™codešœ™Kšœ Οeœ7™BKšœ(™(K™A—K˜šΟk ˜ Kšžœžœžœ˜Kšœžœ˜Kšœžœžœ˜Kšœ žœ˜Kšœžœ ˜—K˜K˜K˜šΟn œžœž œ˜"Kšž˜K˜Kšœžœ˜$K˜K™°™K™:K™Kšœžœžœ˜,šœžœž œžœ˜+Kšœžœ˜Kšœ žœ˜Kšœ ˜ Kšœ˜KšœžœžœΟc˜#Kšœžœžœ $˜4Kšœ˜Kšœžœžœ˜'Kšœžœžœ˜'Kš œžœ žœžœžœžœžœ˜KKšœžœ žœ žœžœžœžœžœžœ˜eKš œ žœ žœžœ žœžœ˜8Kšœ žœž˜K˜—K˜Kšœžœžœ˜*šœžœžœ˜ Kšœžœ˜Kšœžœžœ˜Kšœžœžœ˜'—K˜šŸ œž˜šœ˜Kšœ žœ˜Kšœ žœ˜Kš œžœ žœžœžœžœžœ˜KKšœžœ žœ žœžœžœžœžœžœ˜eKš œ žœ žœžœ žœžœ˜8Kšœ žœžœ˜—Kšžœ˜—K˜šŸœžœ˜-K™‘——K™™K™K™šŸœžœ?žœ˜zKšœ4™4—K˜KšŸœžœ)˜EK˜KšŸΠbnœžœ)˜JK˜KšŸ‘œžœ)˜JK˜K˜——™™K˜Kšœ žœžœ˜$šœžœžœ˜šœ˜Kšœ:™:—K˜šœ žœ˜K™x—Kšœžœ˜ Kšœžœ˜ Kšœžœ˜ Kšœ žœ˜K˜K™(K˜—K˜Kšœ žœžœžœ˜&K˜KšŸœžœ-žœžœ žœžœžœ ˜‹K˜š Ÿ œžœžœžœžœ ˜MK™(K™FK™+—K˜KšŸœžœ˜K˜KšŸœžœžœ ˜:KšŸœžœžœ˜$K˜KšŸœžœžœ˜&KšŸœžœžœ˜$K˜KšŸ œžœ žœžœ ˜9K˜šŸœžœ˜Kšœ˜Kš œ žœ žœžœ žœžœ˜=Kšœ žœžœ˜Kšœžœ˜Kšœžœ6žœžœžœžœžœžœ˜nKšœžœCžœžœ˜Wšžœ ˜K™K™νK™)—K˜Kšœ žœžœžœ˜"Kš œžœžœžœžœ žœ˜5—K˜KšŸœžœžœžœ ˜IK˜KšŸ œžœ˜!K˜—K˜Kšžœ˜——…— Ό4