(cedar-imports "TreeGrapherViewer" "TreeGrapher" "ViewerOps") (cedar-directory "Ascii" "ViewerClasses") (cedar-require "Install TreeGrapherViewer") (define-ref-type "ViewerClasses" "Viewer") (define-ref-type "TreeGrapher" "Node") (define-ref-type "TreeGrapherViewer" "ViewerData") (define-ref-type "Scheme" "Symbol") (define-proc (make-tree-grapher) "Make a new tree grapher handle" result _ TreeGrapherViewer.NewViewerData[]; ) (define-proc (make-tree-grapher-node grapher content format fill-sizes client-data children) "Make a new tree-grapher-node (not hooked in)" data: TreeGrapherViewer.ViewerData ~ TheViewerData[grapher]; textFormat: TreeGrapherViewer.TextFormat ~ TreeGrapherViewer.FindFormat[data, TheSymbol[format]]; head: LIST OF ROPE ~ LIST[NIL]; last: LIST OF ROPE _ head; node: TreeGrapher.Node; WITH content SELECT FROM string: String => { last _ last.rest _ LIST[RopeFromString[string]] }; pair: Pair => { FOR tail: Any _ pair, Cdr[tail] UNTIL tail = NIL DO last _ last.rest _ LIST[RopeFromString[TheString[Car[tail]]]]; ENDLOOP; }; ENDCASE => Complain[content, "not a string or list of strings"]; node _ TreeGrapherViewer.NodeFromText[lines: head.rest, textFormat: textFormat, fillSizes: TheREALS[fillSizes], clientData: clientData]; FOR tail: Any _ children, Cdr[tail] UNTIL tail = NIL DO node.children _ CONS[TheNode[Car[tail]], node.children]; ENDLOOP; result _ node; ) (define-proc (make-tree-grapher-viewer name grapher) "Make a tree-grapher viewer" data: TreeGrapherViewer.ViewerData ~ TheViewerData[grapher]; rope: ROPE ~ RopeFromString[TheString[name]]; TreeGrapher.DoLayout[data.tree, data.lp]; data.origin _ [1.0-data.tree.layout.treeBox.xmin, 1.0-data.tree.layout.treeBox.ymin]; result _ ViewerOps.CreateViewer[flavor: $TreeGrapher, info: [name: rope, hscrollable: TRUE, data: data]]; ) (define-proc (tree-grapher-set! viewer grapher) "Set a grapher into a viewer" data: TreeGrapherViewer.ViewerData ~ TheViewerData[grapher]; v: ViewerClasses.Viewer ~ TheViewer[viewer]; TreeGrapher.DoLayout[data.tree, data.lp]; ViewerOps.SetViewer[v, data, TRUE, $ViewerData]; ) ROPE: TYPE ~ Rope.ROPE; TheREALS: PROC [any: Any] RETURNS [ans: LIST OF REAL _ NIL] ~ { last: LIST OF REAL _ NIL; FOR tail: Any _ any, Cdr[tail] UNTIL tail = NIL DO new: LIST OF REAL ~ LIST[TheREAL[Car[tail]]]; IF ans = NIL THEN ans _ last _ new ELSE last _ last.rest _ new; ENDLOOP; }; p TreeGrapherViewer.mx Copyright Σ 1990, 1991 by Xerox Corporation. All rights reserved. Michael Plass, July 13, 1990 5:17 pm PDT Documentation Put documentation here Cedar Primitives add strings to DIRECTORY and IMPORT clauses add strings to DIRECTORY clause only add lines to the generated require file Defines TheFoo procedure for narrowing a "Foo" Defines TheFoo procedure for narrowing a "Foo" Defines TheFoo procedure for narrowing a "Foo" Defines TheFoo procedure for narrowing a "Foo" Defines a primitive procedure that takes the specified arguments. Parenthesized argument names are optional. Scheme Code Κ9•NewlineDelimiter –(cedarcode) style™codešœ™Kšœ Οeœ7™BK™(Ischeme™Ihead2™ IdefaultšΟtœž™M™šœΟn œ/˜=Nšœ+™+—šœŸœ˜)Nšœ$™$—šœŸ œ˜+Nšœ'™'—šœŸœ˜*N™.—šœŸœ˜&N™.—šœŸœ"˜2N™.—šœŸœ˜#N™.—šœŸ œ˜ N™mNšœ ˜ Kšœ+˜+Nšœ˜—šœŸ œP˜\Nšœ.˜.Icedaršœ<˜Kš œ˜—Kšœ˜—Kš œ9˜@—Ošœˆ˜ˆš œ! œ œ ˜7Kšœ œ$˜8Kš œ˜—Ošœ˜Nšœ˜—šœŸ œ(˜4Nšœ˜Ošœ<˜