DIRECTORY Containers USING [Create], Icons USING [IconFlavor, NewIconFromFile], Graph USING [ControllerRec, GraphHandle, GraphProc, Viewer], GraphCleanUp USING [CleanUpHandle], GraphOps USING [Lock, Unlock], GraphPrivate USING [ControllerMenus, MakeSpec, MakeTable, MakeXYValues], GraphUtil USING [HandleFromViewer, HandleNotNil], Rope USING [Concat], ViewerEvents USING [EventProc, RegisterEventProc], ViewerOps USING [AddProp, FetchProp, OpenIcon, TopViewer]; GraphController: CEDAR PROGRAM IMPORTS Containers, Icons, GraphCleanUp, GraphOps, GraphPrivate, GraphUtil, Rope, ViewerEvents, ViewerOps EXPORTS GraphPrivate = { OPEN Graph, GraphOps, GraphPrivate; controllerIcon: Icons.IconFlavor _ Icons.NewIconFromFile["Graph.icons", 1]; ShowController: PUBLIC GraphProc = { IF GraphUtil.HandleNotNil[handle] THEN { OPEN handle; IF controller = NIL THEN NewController[handle] ELSE { IF controller.viewer.iconic THEN ViewerOps.OpenIcon[icon: controller.viewer, bottom: FALSE] ELSE ViewerOps.TopViewer[controller.viewer]; }; }; }; -- ShowController NewController: GraphProc = { OPEN handle; controller _ NEW[ControllerRec _ []]; controller.viewer _ Containers.Create[ info: [ name: graph.fileName.Concat[" Controller"], file: graph.fileName, iconic: TRUE, icon: controllerIcon, menu: (controller.menu _ ControllerMenus[]), column: left, scrollable: FALSE], paint: FALSE]; ViewerOps.AddProp[controller.viewer, $GraphController, handle]; MakeSpec[handle, 0, 0]; MakeXYValues[handle, 1000, 0]; MakeTable[handle, 1000, 0]; controller.specVisible _ TRUE; ViewerOps.OpenIcon[icon: controller.viewer]; }; -- NewController IsController: PUBLIC PROC [viewer: Viewer] RETURNS [BOOL] = { IF viewer = NIL THEN RETURN[FALSE]; RETURN[ViewerOps.FetchProp[viewer, $GraphController] # NIL]; }; -- IsController ControllerBeforeDestroy: ViewerEvents.EventProc = { handle: GraphHandle _ GraphUtil.HandleFromViewer[viewer]; IF handle # NIL THEN IF event = destroy AND IsController[viewer] AND before THEN { Lock[handle]; IF handle.controller # NIL THEN handle.controller^ _ []; handle.controller _ NIL; Unlock[handle]; }; }; -- ControllerBeforeDestroy ControllerAfterDestroy: ViewerEvents.EventProc = { handle: GraphHandle _ GraphUtil.HandleFromViewer[viewer]; IF handle # NIL THEN IF event=destroy AND IsController[viewer] AND NOT before THEN { Lock[handle]; IF handle.chart.viewer = NIL THEN handle _ GraphCleanUp.CleanUpHandle[handle, TRUE] ELSE Unlock[handle]; }; }; -- ControllerAfterDestroy Init: PROC [] = { [] _ ViewerEvents.RegisterEventProc[ proc: ControllerBeforeDestroy, event: destroy, before: TRUE]; [] _ ViewerEvents.RegisterEventProc[ proc: ControllerAfterDestroy, event: destroy, before: FALSE]; }; Init[]; }. CHANGE LOG. SChen, created at October 9, 1985 6:09:36 pm PDT. :File: GraphController.mesa, Copyright c 1985 by Xerox Corporation. All rights reserved. Last Edited by: Sweetsun Chen, November 16, 1985 11:22:28 pm PST TiogaMenuOps USING [Normalize], TiogaOps USING [Jump, ViewerDoc], (constant) variables public procedures Show up controller. Create it if it doesn't exist. MakeRule[handle]; ViewerOps.SetOpenHeight[controller.viewer, 1000]; ViewerOps.PaintViewer[controller.viewer, all]; to be added: GraphSearch.mesa Next: ActionProc = {}; -- Next Find: ActionProc = {}; -- Find TableOpen: ViewerEvents.EventProc = { handle: GraphHandle _ NARROW[ViewerOps.FetchProp[viewer, $GraphTable]]; IF handle # NIL THEN IF event = open AND NOT before THEN handle.waitingController _ FALSE; }; -- TableOpen [] _ ViewerEvents.RegisterEventProc[ proc: TableOpen, event: open, before: FALSE]; Ê%˜Jšœ&Ïmœ1™Xšœ™Jšœ0™0J™—šÏk ˜ Jšœ žœ ˜Jšœžœ˜*Jšœžœ1˜