DIRECTORY Tioga USING [Node, Location, Place], ViewerClasses USING [MouseButton, ViewerRec, Viewer], Rope USING [ROPE]; TiogaButtons: CEDAR DEFINITIONS ~ BEGIN ROPE: TYPE ~ Rope.ROPE; TiogaButton: TYPE = REF TiogaButtonRec; TiogaButtonRec: TYPE = RECORD [ startLoc: Tioga.Location, endLoc: Tioga.Location, proc: TiogaButtonProc, clientData: REF ANY, fork: BOOLEAN ]; TiogaButtonList: TYPE = LIST OF TiogaButton; TiogaButtonProc: TYPE = PROC [button: TiogaButton, clientData: REF ANY ¬ NIL, mouseButton: ViewerClasses.MouseButton ¬ red, shift, control: BOOL ¬ FALSE]; CreateViewer: PROC [info: ViewerClasses.ViewerRec] RETURNS [v: ViewerClasses.Viewer]; LoadViewer: PROC [viewer: ViewerClasses.Viewer, fileName: ROPE]; CreateButton: PROC [viewer: ViewerClasses.Viewer, rope: ROPE ¬ NIL, format: ROPE ¬ NIL, looks: ROPE ¬ NIL, proc: TiogaButtonProc ¬ NIL, clientData: REF ANY ¬ NIL, fork: BOOLEAN ¬ TRUE] RETURNS [button: TiogaButton]; WrongViewerClass: ERROR; CreateButtonFromNode: PROC [node: Tioga.Node, start: INT ¬ 0, end: INT ¬ INT.LAST, proc: TiogaButtonProc ¬ NIL, clientData: REF ANY ¬ NIL, fork: BOOLEAN ¬ TRUE] RETURNS [button: TiogaButton]; CreateButtonForEachNode: PROC [viewer: ViewerClasses.Viewer, firstLevelOnly: BOOL ¬ FALSE, subtreeAsButton: BOOL ¬ TRUE, proc: TiogaButtonProc ¬ NIL, clientData: REF ANY ¬ NIL, fork: BOOLEAN ¬ TRUE]; CreateButtonAtNode: PROC[ viewer: ViewerClasses.Viewer, oldButton: TiogaButton ¬ NIL, where: Tioga.Place ¬ before, rope: ROPE ¬ NIL, format: ROPE ¬ NIL, looks: ROPE ¬ NIL, proc: TiogaButtonProc ¬ NIL, clientData: REF ANY ¬ NIL, fork: BOOLEAN ¬ TRUE ] RETURNS [button: TiogaButton]; AppendToButton: PROC [button: TiogaButton, rope: ROPE ¬ NIL, looks: ROPE ¬ NIL, proc: TiogaButtonProc ¬ NIL, clientData: REF ANY ¬ NIL, fork: BOOLEAN ¬ TRUE] RETURNS [TiogaButton]; DeleteButton: PROC [button: TiogaButton]; FindTiogaButton: PROC [this: ViewerClasses.Viewer, loc: Tioga.Location] RETURNS [button: TiogaButton]; GetRope: PROC [button: TiogaButton] RETURNS [rope: ROPE]; SetStyleFromRope: PROC [v: ViewerClasses.Viewer, styleRope: ROPE]; ChangeButtonLooks: PUBLIC PROC [button: TiogaButton, addLooks, removeLooks: ROPE ¬ NIL]; MarkViewerNotEdited: PROC [root: Tioga.Node]; EnumerateTiogaButtons: PROC [ v: ViewerClasses.Viewer, Test: PROC [TiogaButton] RETURNS [BOOL], start: Tioga.Location ¬ [NIL, 0], end: Tioga.Location ¬ [NIL, INT.LAST] ] RETURNS [BOOL]; IsTiogaButtons: PROC [ViewerClasses.Viewer] RETURNS [BOOL]; IsEntireNode: PROC [TiogaButton] RETURNS [BOOL]; State: TYPE = { buttoning, editing }; StateButton: PROC [v: ViewerClasses.Viewer, show: BOOL ¬ TRUE]; SetState: PROC [v: ViewerClasses.Viewer, val: State]; GetState: PROC [v: ViewerClasses.Viewer] RETURNS [State]; WasModifiedProc: TYPE = PROC [v: ViewerClasses.Viewer]; RegisterModifiedProc: PROC [v: ViewerClasses.Viewer, proc: WasModifiedProc]; IsViewerEdited: PROC [root: Tioga.Node] RETURNS [edited: BOOL]; END. N TiogaButtons.mesa Copyright Σ 1984, 1985, 1991, 1992 Xerox Corporation. All rights reserved. Created by Rick Beach, May 2, 1985 2:32:00 pm PDT Hal Murray, December 22, 1986 10:58:48 am PST Willie-Sue, January 23, 1987 3:54:24 pm PST Willie-s, December 20, 1991 1:31 pm PST Doug Wyatt, January 30, 1992 5:04 pm PST Michael Plass, March 10, 1992 4:04 pm PST TiogaOps types are used in the interface so that clients may freely use the TiogaOps interface to modify the contents of a TiogaButtons document. Invariant for TiogaButtons: startLoc.node = endLoc.node button is the TiogaButton that was hit with Create TiogaButtons from supplied information. ... creates a $TiogaButtons class viewer. A top-level viewer will have Tioga menus displayed but will not be editable. ... loads an existing document into a TiogaButtons viewer ... creates a button as the last child of the document in viewer. (Client must provide nesting through TiogaOps) If proc is NIL then the node is created and a button record returned, but no button property will be applied to the node. This is useful for providing labels, spacing between buttons, or special formatting. ... creates a button from the node and the offsets provided. If the start and end offsets are defaulted then the button refers to the node itself. If proc is NIL then the a button record returned, but no button property will be applied to the node. Why bother? ... creates a TiogaButton for each node found in the TiogaButtons viewer ... appends the formatted rope to an existing button and creates a new button for the appended text. If proc is NIL then the rope is appended and a button record returned, but no button property will be applied to the node. This is useful for providing labels, spacing between buttons, or special formatting. Note that the format is set only when you create a node. A curious feature of appending to a button created with proc nonNIL: that button will be for the entire node and will subsume any appended buttons. This might be useful for providing a target that will refer to the entire node contents. The feedback looks neat! ... deletes the button. If the button is an entire node, it simply vanishes. If the button is only part of a node, then the other buttons are adjusted to compensate for the deleted text. Clients might find it necessary to manufacture their own button records via NEW[TiogaButtonRec] for some purposes. ... returns the button at that location in the viewer, or NIL ... provides the text of the button. Can be used in place of clientData for many purposes. ... sets a local style for the viewer via the StyleDef property ... change the looks for the button starting at the start offset ... marks all the viewers displaying this document as not edited WrongViewerClass raised if v isn't a TiogaButtons viewer. Returns TRUE to stop the enumeration. default value means begin of whole document. default value means end of whole document. Result is TRUE iff Test returned TRUE. ... called to show (TRUE) or hide (FALSE) the button on the viewer which allows the user to toggle between editing the underlying document and buttoning. Initially, the button is hidden for upward compatibility. Does nothing if the viewer is not a top level viewer (can't have it's own buttons). ... called to set the state of the viewer directly. ... called to get the state of the viewer. ... called by TiogaButtons to allow the client to redo the buttons upon reentering the buttoning state or after some non-user document edit, like with an active docuement, while in "button mode". All previously created buttons are removed before this call is made. ... called to register a procedure to be called in the event of a change to the document. To "unregister" the procedure, register NIL as the proc. ... returns whether the edited bit of the document (viewer) is set. Κ;•NewlineDelimiter –(cedarcode) style™code™Kšœ Οeœ@™KK™1K™-K™+K™'K™(K™)K™—šΟk ˜ Kšœžœ˜$Kšœžœ"˜5Kšœžœžœ˜—K˜šΟn œžœž œž˜'K˜Kšžœžœžœ˜K™K™‘K˜Kšœ žœžœ˜'šœžœžœ˜K˜K˜K˜Kšœ žœžœ˜Kšœž˜ K˜K™7K˜—K˜Kšœžœžœžœ ˜,šœžœžœ#žœžœžœ@žœžœ˜šK™I——head™.šŸ œžœ!žœ˜UK™)K™LK™—šŸ œžœ*žœ˜@K™9K™—šŸ œžœ&žœžœ žœžœ žœžœžœžœžœžœžœžœžœ˜Χ™AK™.—Kšœ žœΑ™ΟK˜Kšœžœ˜K˜—šŸœžœžœ žœžœžœžœžœžœžœžœžœžœ˜ΏK™“Kšœ žœd™rK™—šŸœžœ0žœžœžœžœžœžœžœžœžœžœ˜ΗK™HK™—šŸœžœ9žœ%žœžœ žœžœ žœžœžœžœžœžœžœžœ˜ϊšžœ˜K˜——šŸœžœžœžœ žœžœžœžœžœžœžœžœžœ˜΄K™dKšœ žœό™ŠKšœ@žœΔ™‡K™—šŸ œžœ˜)K™K™4K™mKšœLžœ#™rK™—šŸœžœ3žœ˜fKšœ:ž™=K™—šŸœžœžœžœ˜9K™ZK™—šŸœžœ&žœ˜BK™?K™—š Ÿœžœžœ.žœžœ˜XK™@K™—šŸœžœ˜-K™@K™—šŸœž˜˜˜K™9—šŸœžœžœžœ˜(K™%—šœžœ˜!K™,—šœžœžœžœ˜%K™*—K˜—šžœžœ˜K™&K™——šŸœžœžœžœ˜;K˜—šŸ œžœžœžœ˜0K˜—šœžœ˜%K˜—šŸ œžœ!žœžœ˜?Kšœžœ žœ™©K™—šŸœžœ'˜5K™3K™—šŸœžœžœ ˜9K™*K™—šœžœžœ˜7K™‰K˜—šŸœžœ2˜LKšœƒžœ ™“K˜—šŸœžœžœ žœ˜?K™CK˜—K˜—Kšžœ˜—…— ‚