DIRECTORY GGGraphicsButton, GGLines, GGModelTypes, GGInterfaceTypes, GGShapes, GGUserInput, Imager, Rope, TIPUser, ViewerClasses, ViewerOps; GGGraphicsButtonImpl: CEDAR PROGRAM IMPORTS GGLines, GGShapes, GGUserInput, Imager, TIPUser, ViewerOps EXPORTS GGGraphicsButton = BEGIN Viewer: TYPE = ViewerClasses.Viewer; GargoyleData: TYPE = GGInterfaceTypes.GargoyleData; GraphicsState: TYPE = REF GraphicsStateObj; GraphicsStateObj: TYPE = GGGraphicsButton.GraphicsStateObj; Line: TYPE = GGModelTypes.Line; Point: TYPE = GGModelTypes.Point; GraphicsButtonPaint: PROC [self: Viewer, context: Imager.Context, whatChanged: REF ANY, clear: BOOL] RETURNS [quit: BOOL _ FALSE] = { graphicsState: GraphicsState; IF whatChanged = NIL THEN { --we are being called by Window Manager graphicsState _ NARROW[self.data]; Painter[graphicsState]; } ELSE { graphicsState _ NARROW[whatChanged]; DrawButton[context, graphicsState]; }; }; Painter: PUBLIC PROC [graphicsState: GraphicsState] = { ViewerOps.PaintViewer[ viewer: graphicsState.button, hint: client, whatChanged: graphicsState, clearClient: TRUE]; }; -- end of Painter DrawButton: PROC [dc: Imager.Context, graphicsState: GraphicsState] = { linePoint, caretPoint: Point; line: Line; linePoint _ [0.0, 0.0]; caretPoint _ [-graphicsState.value, 0.0]; line _ GGLines.LineFromPointAndVector[linePoint, [0.0, 1.0]]; Imager.TranslateT[dc, [graphicsState.button.ww/2.0, graphicsState.button.wh/2.0]]; GGShapes.DrawLine[dc, line]; GGShapes.DrawCaret[dc, caretPoint]; }; BuildGraphicsButton: PUBLIC PROC [viewer: ViewerClasses.Viewer, x,y,w,h: INTEGER, name: Rope.ROPE, initValue: REAL, clientData: REF ANY, atom: ATOM] RETURNS [nextX: INTEGER] = { gargoyleData: GargoyleData _ NARROW[clientData]; stateInfo: GraphicsState; stateInfo _ NEW[GraphicsStateObj]; stateInfo.button _ ViewerOps.CreateViewer[ flavor: $GraphicsButton, info: [ parent: viewer, wx: x, wy: y, ww: w, wh: h, data: stateInfo, scrollable: FALSE ] ]; stateInfo.value _ initValue; stateInfo.clientData _ clientData; stateInfo.atom _ atom; gargoyleData.hitTest.gravityExtentButton _ stateInfo; GGUserInput.GeneralDispatch[LIST[stateInfo.atom, $InitialValue], gargoyleData]; nextX _ x + w; }; -- end of BuildGraphicsButton GetValue: PUBLIC PROC [graphicsState: GraphicsState] RETURNS [value: REAL] = { value _ graphicsState.value; }; SetButtonValueAndPaint: PUBLIC PROC [graphicsState: GraphicsState, value: REAL] = { graphicsState.value _ value; Painter[graphicsState]; }; InputNotify: PROC [self: ViewerClasses.Viewer, input: LIST OF REF ANY] = { atom: ATOM; graphicsState: GraphicsState _ NARROW[self.data]; gargoyleData: GargoyleData _ NARROW[graphicsState.clientData]; atom _ NARROW[input.first]; SELECT atom FROM $BugUp => GGUserInput.GeneralDispatch[LIST[graphicsState.atom, $ValueUp], gargoyleData]; $BugDown => GGUserInput.GeneralDispatch[LIST[graphicsState.atom, $ValueDown], gargoyleData]; ENDCASE => ERROR; }; Init: PROC = { graphicsButtonClass: ViewerClasses.ViewerClass; graphicsButtonClass _ NEW[ViewerClasses.ViewerClassRec _ [ paint: GraphicsButtonPaint, notify: InputNotify, tipTable: TIPUser.InstantiateNewTIPTable["GraphicsButton.TIP"], cursor: bullseye ]]; ViewerOps.RegisterViewerClass[$GraphicsButton, graphicsButtonClass]; }; Init[]; END. GGGraphicsButtonImpl.mesa Copyright c 1985 by Xerox Corporation. All rights reserved. Last edited by Bier on August 17, 1985 1:09:03 am PDT Contents: Procedures dealing selecting and deselecting objects, including both selection actions and selection feedback. Êþ˜head1™Icodešœ Ïmœ1™Jšœžœ˜Jšžœž˜JšœX˜XJšœ\˜\Jšžœžœ˜J˜J˜—šŸœžœ˜Mšœ/˜/Mšœ˜Mšœ˜šžœ!˜$Mšœ˜Mšœ˜Mšœ?˜?M˜Mšœ˜—Mšœ˜MšœD˜DMšœ˜M˜—Mšœ˜J™Jšžœ˜J˜J˜J˜—…— Òà