<> <> <> DIRECTORY Convert USING [RopeFromInt], Graph USING [Entity, EntityGroup, EntityList, NestedEntities, NestedEntitiesList, Text, Texts, Viewer], GraphPrivate USING [CallWithLock, EntityGroupList, GraphHandle, GraphProc, RemoveEntity, RemoveText, ShowEntity, ShowText], GraphUtil USING [HandleNotNil], TiogaOps USING [Break, InsertRope, LastChild, Lock, Nest, Ref, SelectPoint, SetLooks, SubtractLooks, Unlock, UnNest, ViewerDoc], TiogaButtons USING [CreateButton, CreateButtonFromNode, CreateViewer, TiogaButton, TiogaButtonProc], ViewerTools USING [SetContents]; GraphTable: CEDAR PROGRAM IMPORTS Convert, GraphPrivate, GraphUtil, TiogaOps, TiogaButtons, ViewerTools EXPORTS GraphPrivate = { OPEN Graph, GraphPrivate; GraphButtonData: TYPE = REF GraphButtonDataRec; GraphButtonDataRec: TYPE = RECORD[ handle: GraphHandle _ NIL, ref: REF ANY _ NIL ]; MakeTable: PUBLIC PROC [handle: GraphHandle, lastHeight: INTEGER] = { <> IF GraphUtil.HandleNotNil[handle] THEN { <> b: TiogaButtons.TiogaButton; handle.controller.table _ TiogaButtons.CreateViewer[ info: [ wy: handle.controller.panelHeight, ww: 2000, wh: 1000, menu: NIL, parent: handle.controller.viewer, scrollable: TRUE, border: FALSE, caption: FALSE ]]; <> <> b _ TiogaButtons.CreateButton[viewer: handle.controller.table, rope: ""]; b _ TiogaButtons.CreateButton[viewer: handle.controller.table, rope: "Texts:", looks: "lb"]; TiogaOps.SelectPoint[handle.controller.table, b.endLoc]; TiogaOps.Break[]; TiogaOps.Nest[]; TextsTable[handle, b.endLoc.node]; TiogaOps.UnNest[]; b _ TiogaButtons.CreateButton[viewer: handle.controller.table, rope: "Curves:", looks: "lb"]; TiogaOps.SelectPoint[handle.controller.table, b.endLoc]; TiogaOps.Break[]; TiogaOps.Nest[]; FOR egl: EntityGroupList _ handle.entityGroupList, egl.rest UNTIL egl = NIL DO NELTable[handle, egl.first.ys, b.endLoc.node]; ENDLOOP; }; }; -- MakeTable TextsTable: PROC [handle: GraphHandle, parent: TiogaOps.Ref] = { button: TiogaButtons.TiogaButton; FOR ts: Texts _ handle.allTexts, ts.rest UNTIL ts = NIL DO t: Text _ ts.first; -- error if nil. TiogaOps.InsertRope[ IF t.text = NIL THEN Convert.RopeFromInt[t.id] ELSE t.text]; button _ TiogaButtons.CreateButtonFromNode[ node: TiogaOps.LastChild[parent], start: , end: , proc: TextButtonProc, clientData: NEW[GraphButtonDataRec _ [handle, t]] ]; TiogaOps.SelectPoint[handle.controller.table, button.endLoc]; TiogaOps.Break[]; ENDLOOP; }; -- TextsTable <<>> EntityListTable: PROC [handle: GraphHandle, entityList: EntityList, parent: TiogaOps.Ref] = { button: TiogaButtons.TiogaButton; FOR el: EntityList _ entityList, el.rest UNTIL el = NIL DO entity: Entity _ el.first; -- error if nil. TiogaOps.InsertRope[ IF entity.name = NIL THEN Convert.RopeFromInt[entity.id] ELSE entity.name]; button _ TiogaButtons.CreateButtonFromNode[ node: TiogaOps.LastChild[parent], start: , end: , proc: EntityButtonProc, clientData: NEW[GraphButtonDataRec _ [handle, entity]] ]; TiogaOps.SelectPoint[handle.controller.table, button.endLoc]; TiogaOps.Break[]; ENDLOOP; }; -- EntityListTable NELTable: PROC [handle: GraphHandle, nestedEntityList: NestedEntitiesList _ NIL, parent: TiogaOps.Ref] = { FOR nel: NestedEntitiesList _ nestedEntityList, nel.rest UNTIL nel = NIL DO ne: NestedEntities _ nel.first; IF ne # NIL THEN { lastChild: TiogaOps.Ref; button: TiogaButtons.TiogaButton; TiogaOps.SetLooks["b", caret]; TiogaOps.InsertRope[IF ne.name = NIL THEN "=>" ELSE ne.name]; TiogaOps.SubtractLooks["b", caret]; lastChild _ TiogaOps.LastChild[parent]; button _ TiogaButtons.CreateButtonFromNode[ node: lastChild, start: , end: , proc: NestedEntitiesButtonProc, clientData: NEW[GraphButtonDataRec _ [handle, ne]] ]; TiogaOps.SelectPoint[handle.controller.table, button.endLoc]; TiogaOps.Break[]; TiogaOps.Nest[]; EntityListTable[handle, ne.entityList, lastChild]; NELTable[handle, ne.children, lastChild]; TiogaOps.UnNest[]; }; ENDLOOP; }; -- NELTable EntityGroupButtonProc: TiogaButtons.TiogaButtonProc = { -- NOOP for now <> <> <> <> <> <