-- TJaMGraphicsViewer.mesa -- Last change by Bill Paxton, July 8, 1982 8:43 am -- Last change by McGregor, June 15, 1982 10:05 am DIRECTORY JaMGraphics, Graphics, InputFocus USING [CaptureButtons, ReleaseButtons], Real USING [RoundI], TJaMGraphics, TJaMGraphicsPrivate, JaMOps USING [defaultFrame], JaMTypeScript USING [DoAtom, DoButton], TIPUser USING [TIPScreenCoords], UserTerminal USING [BlinkDisplay], ViewerClasses USING [Viewer]; TJaMGraphicsViewer: MONITOR LOCKS info USING info:TJaMGraphicsPrivate.Info IMPORTS Graphics, Real, JaMTypeScript, JaMOps, TJaMGraphicsPrivate, UserTerminal, InputFocus EXPORTS JaMGraphics, TJaMGraphics, TJaMGraphicsPrivate = BEGIN OPEN TJaMGraphicsPrivate; Update: PUBLIC PROCEDURE[] = { SIGNAL NotImplemented; }; NotImplemented: PUBLIC SIGNAL = CODE; ViewerMouse: PUBLIC PROCEDURE[frame: Frame, click: BOOLEAN] RETURNS[x,y: INTEGER] = { rx, ry: REAL; [rx, ry] _ RealViewerMouse[frame, click]; x _ Real.RoundI[x]; y _ Real.RoundI[y] }; RealViewerMouse: PUBLIC PROCEDURE[frame: Frame, click: BOOLEAN] RETURNS[x,y: REAL] = { info: Info _ GetInfo[frame]; IF info=NIL THEN RETURN [0,0]; IF click THEN [x,y] _ GetBug[info] ELSE [x,y] _ GetPlace[info]; }; GetBug: ENTRY PROC [info: Info] RETURNS[x,y: REAL] = { OPEN info; ENABLE UNWIND => NULL; bugflag _ FALSE; UNTIL viewer.destroyed OR bugflag DO WAIT bugged ENDLOOP; IF viewer.destroyed THEN x _ y _ 0 ELSE { x _ bugX; y _ bugY; bugflag _ FALSE }; }; SetBug: PUBLIC ENTRY PROC [info: Info, x,y: REAL] = { OPEN info; ENABLE UNWIND => NULL; bugflag _ TRUE; bugX _ x; bugY _ y; NOTIFY bugged }; GetPlace: ENTRY PROC [info: Info] RETURNS[x,y: REAL] = { OPEN info; ENABLE UNWIND => NULL; mouseflag _ FALSE; UNTIL viewer.destroyed OR mouseflag DO WAIT mouse ENDLOOP; IF viewer.destroyed THEN x _ y _ 0 ELSE { x _ mouseX; y _ mouseY; mouseflag _ FALSE }; }; SetPlace: PUBLIC ENTRY PROC [info: Info, x,y: REAL] = { OPEN info; ENABLE UNWIND => NULL; mouseflag _ TRUE; mouseX _ x; mouseY _ y; NOTIFY mouse; }; Mouse: PUBLIC PROCEDURE[click: BOOLEAN] RETURNS[x,y: INTEGER] = { [x,y] _ ViewerMouse[JaMOps.defaultFrame,click]; }; InputNotify: PUBLIC PROCEDURE [self: ViewerClasses.Viewer, input: LIST OF REF ANY] = { Do: PROC [button: ATOM] = { JaMTypeScript.DoButton[NARROW[self.data,Info].typescript,button,mx,my] }; ReleaseButtons: PROC = { info: Info _ NARROW[self.data]; IF ~info.capturedButtons THEN RETURN; InputFocus.ReleaseButtons[]; info.capturedButtons _ FALSE }; AdjustCoords: PROC = { info: Info _ NARROW[self.data]; IF ~info.capturedButtons THEN -- get screen coordinates [x, y] _ Graphics.UserToWorld[info.initdc, mx, my] ELSE { x _ mx; y _ my }; -- already in screen coordinates [x, y] _ Graphics.WorldToUser[info.dc, x, y] -- convert using current dc }; mx, my: INTEGER; x, y: REAL; Place: PROC = { SetPlace[NARROW[self.data,Info],x,y] }; FOR l: LIST OF REF ANY _ input, l.rest UNTIL l = NIL DO WITH l.first SELECT FROM z: ATOM => SELECT z FROM $RedDown, $CtrlRedDown, $ShiftRedDown, $CtrlShiftRedDown => { SetBug[NARROW[self.data,Info],x,y]; Place[]; Do[z] }; $YellowDown, $CtrlYellowDown, $ShiftYellowDown, $CtrlShiftYellowDown, $BlueDown, $CtrlBlueDown, $ShiftBlueDown, $CtrlShiftBlueDown, $Track, $CtrlTrack, $ShiftTrack, $CtrlShiftTrack => Do[z]; $RedUp, $CtrlRedUp, $ShiftRedUp, $CtrlShiftRedUp, $YellowUp, $CtrlYellowUp, $ShiftYellowUp, $CtrlShiftYellowUp, $BlueUp, $CtrlBlueUp, $ShiftBlueUp, $CtrlShiftBlueUp => { Do[z]; ReleaseButtons[] }; $Place => Place[]; ENDCASE => JaMTypeScript.DoAtom[NARROW[self.data,Info].typescript,z]; z: TIPUser.TIPScreenCoords => { [mx, ----, my] _ z^; AdjustCoords[] }; ENDCASE => UserTerminal.BlinkDisplay; ENDLOOP; }; END... Κ΅– "Mesa" style˜IprocšΎΟc„œΟk œ)žœ*žœ;žœ!žœžœ#žœ!žœ"žœžœžœ!žœYžœ4žœžœΟnœžœž œ7žœŸ œžœž œžœžœžœžœ[Ÿœžœž œžœžœžœ'žœžœžœžœ žœžœžœŸœžœžœžœžœžœ žœžœžœžœžœžœ žœžœžœžœžœ žœ!žœ Ÿœžœžœžœžœžœ žœžœžœžœžœ Ÿœžœžœžœžœžœ žœžœžœžœžœžœ žœžœžœžœžœ žœ'žœ Ÿœžœžœžœžœžœ žœžœžœžœžœŸœžœž œžœžœžœ>Ÿ œžœž œ%žœžœžœžœŸœžœ žœ!žœ/Ÿœžœžœžœžœžœ;žœŸ œžœžœžœžœœ6žœ!œ.œžœ žœŸœžœžœžœžœžœžœžœžœžœžœžœ žœžœ žœžœžœKžœΥžœžœKœ$žœ#žœžœ˜Ž—…—Λ