DIRECTORY TextNode USING [Ref], TiogaOps USING [Location, Ref], TiogaFileOps USING [Ref], ViewerClasses USING [MouseButton, ViewerRec, Viewer], Rope USING [ROPE]; TiogaButtons: CEDAR DEFINITIONS = BEGIN ROPE: TYPE ~ Rope.ROPE; TiogaButton: TYPE = REF TiogaButtonRec; TiogaButtonRec: TYPE = RECORD [ startLoc: TiogaOps.Location, endLoc: TiogaOps.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: TiogaOps.Ref, 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]; 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: TiogaOps.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: TiogaOps.Ref]; TextNodeRef: PROC [ref: REF] RETURNS [TextNode.Ref]; TiogaOpsRef: PROC [ref: REF] RETURNS [TiogaOps.Ref]; TiogaFileOpsRef: PROC [ref: REF] RETURNS [TiogaFileOps.Ref]; END. ΈTiogaButtons.Mesa Copyright c 1984, 1985 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 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 Type Conversion Routines (for the client and the implementation) Κι˜code™Kšœ Οmœ4™?K™1K™-K™+—K™šΟk ˜ Kšœ žœ˜Kšœ žœ˜Kšœ žœ˜Kšœžœ"˜5Kšœžœžœ˜—K˜KšΠln œžœž ˜šœž˜K˜Kšžœžœžœ˜K™K™‘K˜Kšœ žœžœ˜'šœžœžœ˜K˜K˜K˜Kšœ žœžœ˜Kšœžœ˜K™7K˜—K˜Kšœžœžœžœ ˜,šœžœžœ#žœžœžœ@žœžœ˜šKšœI™I——head™.šΟn œžœ!žœ˜UK™)K™LK™—š  œžœ*žœ˜@K™9K™—š  œžœ&žœžœ žœžœ žœžœžœžœžœžœžœžœžœ˜Χ™AK™.—Kšœ žœΑ™ΟK˜Kšœžœ˜K˜—š œžœžœ žœžœžœžœžœžœžœžœžœžœ˜ΑK™“Kšœ žœd™rK™—š œžœ0žœžœžœžœžœžœžœžœžœžœ˜ΗKšœH™HK™—š œžœžœžœ žœžœžœžœžœžœžœžœžœ˜΄K™dKšœ žœό™ŠKšœ@žœΔ™‡K™—š  œžœ˜)Kšœ™Kšœ4™4K™mKšœLžœ#™rK™—š œžœ6žœ˜iKšœ:ž™=K™—š œžœžœžœ˜9K™ZK™—š œžœ&žœ˜BKšœ?™?K™—š  œžœžœ.žœžœ˜XKšœ@™@K™—š œžœ˜/Kšœ@™@——™@š  œžœžœžœ˜4K˜—š  œžœžœžœ˜4K˜—š œžœžœžœ˜