DIRECTORY Menus USING [MenuProc], TextNode USING [Ref], TiogaOps USING [Location, Offset, Ref], TiogaFileOps USING [Ref], ViewerClasses USING [ViewerRec, Viewer], Rope USING [ROPE]; TiogaButtons: CEDAR DEFINITIONS = { ROPE: TYPE ~ Rope.ROPE; TiogaButton: TYPE = REF TiogaButtonRec; TiogaButtonRec: TYPE = RECORD [ startLoc: TiogaOps.Location, endLoc: TiogaOps.Location, proc: TiogaButtonProc, clientData: REF ANY, fork: BOOLEAN]; NodeItself: TiogaOps.Offset ~ -1; TiogaButtonAtom: ATOM ~ $TiogaButtonList; -- here mainly for documentation TiogaButtonsAtom: ATOM ~ $TiogaButtons; -- compiler won't let you import atoms! TiogaButtonList: TYPE = LIST OF TiogaButton; TiogaButtonProc: TYPE = Menus.MenuProc; 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: TiogaOps.Ref, start: TiogaOps.Offset _ 0, end: TiogaOps.Offset _ LAST[TiogaOps.Offset], 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]; GetRope: PROC [button: TiogaButton] RETURNS [rope: ROPE]; SetStyleFromRope: PROC [v: ViewerClasses.Viewer, styleRope: ROPE]; TextNodeRef: PROC [node: TiogaOps.Ref] RETURNS [TextNode.Ref] ~ TRUSTED INLINE { RETURN [LOOPHOLE[node]] }; TiogaOpsRef: PROC [node: TextNode.Ref] RETURNS [TiogaOps.Ref] ~ TRUSTED INLINE { RETURN [LOOPHOLE[node]] }; TiogaFileOpsRef: PROC [node: TiogaOps.Ref] RETURNS [TiogaFileOps.Ref] ~ TRUSTED INLINE { RETURN [LOOPHOLE[node]] }; TiogaOpsRefFromFileOps: PROC [node: TiogaFileOps.Ref] RETURNS [TiogaOps.Ref] ~ TRUSTED INLINE { RETURN [LOOPHOLE[node]] }; }. ¾TiogaButtons.Mesa Copyright c1984 Xerox Corporation. All rights reserved. Created by Rick Beach, August 31, 1984 1:59:36 pm PDT 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 MenuProc: TYPE = PROC [parent: REF ANY, clientData: REF ANY _ NIL, mouseButton: Menus.MouseButton _ red, shift, control: BOOL _ FALSE] ; parent will be a TiogaButton. WARNING: expecting to use existing Buttons.ButtonProcs or Menus.ClickProcs without concern for the TYPE of parent will result in NARROW faults. Create TiogaButtons from supplied information. Creates a $TiogaButtons class viewer. A top-level viewer will have Tioga menus displayed. Load an existing document into a TiogaButtons viewer Checks that viewer is a $TiogaButtons class 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. Checks that node is within a $TiogaButtons viewer. Creates a button from the node and the offsets provided. If the start, 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? Append the formatted rope to button. 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. Character properties would be a wonderful feature of Tioga, sigh... Clients might find it necessary to manufacture their own button records via NEW[TiogaButtonRec] for some purposes. Provides the text of the button. Can be used in place of clientData for many purposes. This crock is necessary because TiogaOps.PutProp uses too low an abstraction for adding properties to a node. Type conversion routines supplied for the convenience of the client and the implementation. Êݘ™Jšœ Ïmœ-™8J™5J™—šÏk ˜ Jšœžœ ˜Jšœ žœ˜Jšœ žœ˜'Jšœ žœ˜Jšœžœ˜(Jšœžœžœ˜J˜—šÏn œžœž œ˜#J˜Jšžœžœžœ˜—˜J™‘J˜JšŸ œžœžœ˜'šŸœžœžœ˜J˜J˜J˜Jšœ žœžœ˜Jšœžœ˜J™7J˜—Jšœ!˜!J˜JšŸœžœÏc ˜KJšŸœžœ '˜QJšŸœžœžœžœ ˜,J˜šŸœžœ˜'šŸœžœžœ žœžœžœžœžœ™BJšœ6žœžœ™E—J™®—J˜J˜—J™.J™šŸ œžœ!žœ˜UJ™%J™3J™—šŸ œžœ*žœ˜@J™4J™—šŸ œžœ&žœžœ žœžœ žœžœžœžœžœžœžœžœžœ˜×J™3™=J™.—Jšœ žœÁ™ÏJ˜JšŸœžœ˜J˜—šŸœžœIžœ+žœžœžœžœžœžœžœ˜æJ™2J™ŒJšœ žœd™rJ™J˜—šŸœžœžœžœ žœžœžœžœžœžœžœžœžœ˜´J™$Jšœ žœü™ŠJ™‡J™—šŸ œžœ˜)Jšœ™Jšœ4™4J™²J™rJ™—šŸœžœžœžœ˜9J™VJ™—šŸœžœ&žœ˜BJ™mJ™—J™J™[J™š Ÿ œžœžœžœžœ˜PJšžœžœ ˜J˜—šŸ œžœžœžœ˜PJšžœžœ ˜J˜—š Ÿœžœžœžœžœ˜XJšžœžœ ˜J˜—š Ÿœžœžœžœžœ˜_Jšžœžœ ˜J˜—J˜Jšœ˜—…—j