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 }; -- EntityGroupButtonProc NestedEntitiesButtonProc: TiogaButtons.TiogaButtonProc = { -- noop for now. }; -- NestedEntitiesButtonProc EntityButtonProc: TiogaButtons.TiogaButtonProc = { data: GraphButtonData _ NARROW[clientData]; proc: GraphProc = { entity: Entity _ NARROW[data.ref]; SELECT mouseButton FROM red => { ViewerTools.SetContents[handle.controller.entityId, Convert.RopeFromInt[entity.id]]; ShowEntity[handle, entity]; }; blue => RemoveEntity[handle, entity]; ENDCASE; }; CallWithLock[data.handle, proc]; }; -- EntityButtonProc TextButtonProc: TiogaButtons.TiogaButtonProc = { data: GraphButtonData _ NARROW[clientData]; proc: GraphProc = { t: Text _ NARROW[data.ref]; SELECT mouseButton FROM red => { ViewerTools.SetContents[handle.controller.textId, Convert.RopeFromInt[t.id]]; ShowText[handle, t]; }; blue => RemoveText[handle, t]; ENDCASE; }; CallWithLock[data.handle, proc]; }; -- EntityButtonProc AddTextButton: PUBLIC PROC [handle: GraphHandle _ NIL, text: Text _ NIL] RETURNS [b: TiogaButtons.TiogaButton _ NIL] = { IF GraphUtil.HandleNotNil[handle] AND text # NIL THEN { root: TiogaOps.Ref _ TiogaOps.ViewerDoc[handle.controller.table]; TiogaOps.Lock[root]; TiogaOps.SelectPoint[handle.controller.table, [TiogaOps.LastChild[handle.controller.textsParent], -1]]; TiogaOps.Break[]; TiogaOps.InsertRope[ IF text.text = NIL THEN Convert.RopeFromInt[text.id] ELSE text.text]; [] _ TiogaButtons.CreateButtonFromNode[ node: TiogaOps.LastChild[handle.controller.textsParent], start: , end: , proc: TextButtonProc, clientData: NEW[GraphButtonDataRec _ [handle, text]] ]; TiogaOps.Unlock[root]; }; }; -- AddTextButton AddEntityButton: PUBLIC PROC [handle: GraphHandle _ NIL, entity: Entity _ NIL] RETURNS [b: TiogaButtons.TiogaButton _ NIL] = { IF GraphUtil.HandleNotNil[handle] AND entity # NIL THEN { root: TiogaOps.Ref _ TiogaOps.ViewerDoc[handle.controller.table]; group: EntityGroup _ entity.group; TiogaOps.Lock[root]; TiogaOps.SelectPoint[handle.controller.table, [TiogaOps.LastChild[group.node], -1]]; TiogaOps.Break[]; TiogaOps.Nest[]; TiogaOps.InsertRope[ IF entity.name = NIL THEN Convert.RopeFromInt[entity.id] ELSE entity.name]; [] _ TiogaButtons.CreateButtonFromNode[ node: TiogaOps.LastChild[group.node], start: , end: , proc: EntityButtonProc, clientData: NEW[GraphButtonDataRec _ [handle, entity]] ]; TiogaOps.Unlock[root]; }; }; -- AddEntityButton }. LOG. SChen, created at October 9, 1985 6:57:10 pm PDT. .GraphTable.mesa, Copyright c 1985 by Xerox Corporation. All rights reserved. Last Edited by: Sweetsun Chen, October 22, 1985 5:05:11 pm PDT called by NewController, which should have made sure the following not nil: handle, handle.controller, etc. LockedMakeTable: PROC [root: TiogaOps.Ref] = {TopLevelTable[handle, root]}; TiogaOps.CallWithLocks[LockedMakeTable, TiogaOps.ViewerDoc[viewer]]; TopLevelTable[handle, TiogaOps.ViewerDoc[viewer]]; handle: GraphHandle _ NARROW[ViewerOps.FetchProp[parent, $GraphController]]; group: EntityGroup _ NARROW[clientData]; some checking might be necessary. SetIntField[controller.groupId, group.id]; Control[handle, resume, $Group]; SELECT moustButton FROM red => IF control THEN Control[handle, display, $Group]; blue => IF control THEN Control[handle, remove, $Group]; ENDCASE; called when user sets a new entity on panel. AddGroupButtons: PROC[handle: GraphHandle _ NIL, entityGroup: EntityGroup _ NIL] = { firstGroup: EntityGroup _ handle.entityGroupList.first; TiogaOps.SelectPoint[viewer, group.button.startLoc]; TiogaOps.InsertRope[Rope.Concat["Entity group # ", Convert.RopeFromInt[entityGroup.id]]]; TiogaOps.SelectPoint[viewer, b.endLoc]; TiogaOps.Break[]; TiogaOps.Nest[]; FOR el: EntityList _ entityGroup.entityList, el.rest UNTIL el = NIL DO }; -- AddGroupButtons ΚA˜JšœΟmœ1™Mšœ™Icode™.—šΟk ˜ Jšœžœ˜Jšœžœ\˜gJšœ žœi˜{Jšœ žœ˜Jšœ žœr˜€Jšœ žœR˜dJšœ žœ˜ —J˜šœ žœž˜JšžœE˜MJšžœžœ˜2—J˜Jšœžœžœ˜/šœžœžœ˜"Jšœžœ˜Jšœžœžœž˜J˜—J˜šΟn œžœžœ#žœ˜EJšœk™kšžœ žœ˜(JšŸœžœ6™KJšœ˜šœ4˜4šœ˜Jšœ6˜6Jšœžœ˜ Jšœ!˜!Jšœ žœ˜Jšœžœ˜Jšœ ž˜Jšœ˜——J™DJšœ2™2JšœI˜IJšœ\˜\Jšœ8˜8J˜˜J˜"—J˜J˜Jšœ]˜]Jšœ8˜8J˜J˜šžœ9žœžœž˜NJ˜.Jšžœ˜—J˜—JšœΟc ˜J˜šŸ œžœ0˜@J˜!šžœ&žœžœž˜:Jšœ ˜$šœ˜Jšžœ žœžœžœ ˜<—šœ+˜+Jšœ!˜!Jšœ˜Jšœ˜Jšœ žœ"˜1Jšœ˜—Jšœ=˜=J˜Jšžœ˜—Jšœ  ˜—J™šŸœžœH˜]J˜!šžœ&žœžœž˜:Jšœ ˜+šœ˜Jšžœžœžœ žœ˜K—šœ+˜+Jšœ!˜!Jšœ˜Jšœ˜Jšœ žœ'˜6Jšœ˜—Jšœ=˜=J˜Jšžœ˜—Jšœ ˜J˜—šŸœžœ>žœ˜jšžœ6žœžœž˜KJ˜šžœžœžœ˜Jšœ˜J˜!Jšœ˜Jš œžœ žœžœžœ ˜=Jšœ#˜#Jšœ'˜'J˜šœ+˜+Jšœ˜Jšœ˜Jšœ˜Jšœ žœ#˜2Jšœ˜—Jšœ=˜=J˜J˜J˜Jšœ2˜2Jšœ)˜)J˜J˜J˜—Jšžœ˜—Jšœ  ˜J˜—šœ8 ˜GJšœžœ0™Lšœžœ ™(Jšœ!™!—Jšœ*™*Jšœ ™ šžœ ž™Jšœžœ žœ"™8Jšœžœ žœ!™8Jšžœ™—Jšœ ˜—J˜šœ; ˜KJšœ ˜—J˜šœ2˜2Jšœžœ ˜+˜Jšœžœ ˜"šžœ ž˜šœ˜JšœT˜TJšœ˜J˜—Jšœ%˜%Jšžœ˜—J˜—Jšœ ˜ Jšœ ˜—J˜šœ0˜0Jšœžœ ˜+˜Jšœ žœ ˜šžœ ž˜šœ˜JšœM˜MJšœ˜J˜—Jšœ˜Jšžœ˜—J˜—Jšœ ˜ Jšœ ˜—J˜—šŸ œžœžœžœžœžœ žœ˜xšžœ žœžœžœ˜7JšœA˜AJ˜šœ-˜-Jšœ9˜9—J˜šœ˜Jšžœ žœžœžœ ˜E—šœ'˜'JšœH˜HJšœ˜Jšœ žœ%˜4Jšœ˜—J˜J˜—Jšœ ˜—J™šŸœžœžœžœžœžœ žœ˜~Jšœ,™,šžœ žœ žœžœ˜9JšœA˜AJšœ"˜"J˜šœ-˜-Jšœ&˜&—J˜J˜šœ˜Jšžœžœžœ žœ˜K—šœ'˜'Jšœ5˜5Jšœ˜Jšœ žœ'˜6Jšœ˜—J˜J˜—Jšœ ˜—˜šŸœžœžœžœ™TJšœ7™7Jšœ4™4JšœY™YJšœ'™'J™J™Jšžœ2žœžœž™FJšœ ™——J™J˜J˜šžœ˜J˜1——…—%w