DIRECTORY CtBasic, CtMap, KeyTypes, Imager, ImagerSample, Rope, SF, ViewerClasses; CtViewer: CEDAR DEFINITIONS ~ BEGIN IntegerPair: TYPE ~ CtBasic.IntegerPair; SampleMap: TYPE ~ CtBasic.SampleMap; SampleMaps: TYPE ~ CtBasic.SampleMaps; Cmap: TYPE ~ CtMap.Cmap; Context: TYPE ~ Imager.Context; Vec: TYPE ~ ImagerSample.Vec; ROPE: TYPE ~ Rope.ROPE; Box: TYPE ~ SF.Box; Viewer: TYPE ~ ViewerClasses.Viewer; Origin: TYPE ~ {upperLeft, lowerLeft}; currentViewer: Viewer; ViewerProc: TYPE ~ PROC [ viewer: Viewer, maps: SampleMaps, context: Context, clientData: REF ANY ¬ NIL] RETURNS [affectedRegion: Box ¬ ImagerSample.maxBox]; DoWithViewer: PROC [viewer: Viewer, action: ViewerProc, clientData: REF ANY ¬ NIL]; DoWithNamedViewer: PROC [ name: ROPE ¬ "ColorTrix", action: ViewerProc, clientData: REF ANY ¬ NIL, column: ViewerClasses.Column ¬ left, openHeight: NAT ¬ 300, paint, top, closeOthers: BOOL ¬ FALSE] RETURNS [Viewer]; GetViewer: PROC [ name: ROPE, column: ViewerClasses.Column ¬ left, openHeight: NAT ¬ 300, paint, top, closeOthers: BOOL ¬ FALSE] RETURNS [Viewer]; Debug: PROC [set: BOOL]; GetBuffer: PROC [viewer: Viewer] RETURNS [SampleMaps]; PutBuffer: PROC [viewer: Viewer, maps: SampleMaps, affectedRegion: Box]; GetSave: PROC [viewer: Viewer] RETURNS [SampleMaps]; PutSave: PROC [viewer: Viewer, save: SampleMaps]; BoundingBoxProc: TYPE ~ PROC [box: Box, clientData: REF ANY ¬ NIL] RETURNS [continue: BOOL ¬ TRUE]; EnableBoundingBox: PROC [ viewer: Viewer, action: BoundingBoxProc ¬ NIL, clientData: REF ANY ¬ NIL]; DisableBoundingBox: PROC [viewer: Viewer] RETURNS [Box]; GetBoundingBox: PROC [ viewer: Viewer, start: Vec, context: Context ¬ NIL, origin: Origin ¬ lowerLeft] RETURNS [Box]; OrderBox: PROC [box: Box] RETURNS [Box]; XOR: PROC [context: Context, box: Box]; MouseButton: TYPE ~ {none, left, middle, right}; -- which mouse button MouseState: TYPE ~ {none, down, held, up}; -- state of pressed button Mouse: TYPE ~ RECORD [ -- mouse information pos: IntegerPair ¬ [], -- screen coordinates state: MouseState ¬ none, -- up, down or held button: MouseButton ¬ none, -- left, middle or right control: BOOL ¬ FALSE, -- if control key held shift: BOOL ¬ FALSE -- if shift key held ]; MouseProc: TYPE ~ PROC [ viewer: Viewer, mouse: Mouse, clientData: REF ANY]; PollProc: TYPE ~ PROC [pos: IntegerPair] RETURNS [continue: BOOL ¬ TRUE]; RegisterMouse: PROC [ viewer: Viewer, mouse: MouseProc, clientData: REF ANY ¬ NIL, origin: Origin ¬ upperLeft]; UnregisterMouse: PROC [viewer: Viewer, mouse: MouseProc]; GetMousePos: PROC [viewer: Viewer, origin: Origin ¬ upperLeft] RETURNS [IntegerPair]; KeyDown: PROC [key: KeyTypes.KeySym] RETURNS [BOOL]; MouseAllUp: PROC RETURNS [BOOL]; MouseInViewer: PROC [viewer: Viewer] RETURNS [BOOL]; ChangeOrigin: PROC [pos: IntegerPair, viewer: Viewer, old, new: Origin] RETURNS [IntegerPair]; DoWhileMouseDown: PROC [viewer: Viewer, action: PollProc, origin: Origin ¬ upperLeft]; GetColormap: PUBLIC PROC [viewer: Viewer] RETURNS [Cmap]; PutColormap: PUBLIC PROC [viewer: Viewer, cmap: Cmap]; END. Θ CtViewer.mesa Copyright Σ 1990, 1992 by Xerox Corporation. All rights reserved. Bloomenthal, December 2, 1992 8:51 pm PST Types viewer and sample map origins are usually at upper left; context origin are usually at lower left. CtViewer operations do not use the viewer.data field. Viewer Image Operations Most recently accessed ColorTrix class viewer. May be a nested procedure. This proc called from within a PaintProc; do not call ViewerOps.PaintViewer. Only one ViewerProc should be called for a viewer at a time (viewer locking not assured). ViewerProc called immediately upon call to DoWithViewer or DoWithNamedViewer. affectedRegion is in terms of maps' coordinates; the origin of maps is at the upper left. Apply action to viewer; no op if viewer is iconic. See cautions about ViewerProc, above. As DoWithViewer except viewer is found via the given name. If the named viewer does not exist, it is created. If not paint, the created viewer will be iconic. If paint, the created viewer will be opened in the given column, either at top or bottom, and possibly closing other viewers in the given column. When opened, the viewer will attempt to be openHeight high. See cautions about ViewerProc, above. Return the named viewer. If the named viewer does not exist, it is created. If not paint, the created viewer will be iconic. If paint, the created viewer will be opened in the given column, either at top or bottom, and possibly closing other viewers in the given column. When opened, the viewer will attempt to be openHeight high. If set true, uncaught errors will not be caught during a CtProc. Buffering Return the backing sample map(s) for this viewer, possibly NIL. Buffer the union of the affectedRegion with previously affected region of maps. This is automatically called within DoWithViewer. Get the save buffer (that part of the backing sample map(s) most recently overwritten). Set the save buffer. Bounding Box User interactions with a bounding box: upon initial mouse down, the origin of the bounding box is fixed and the opposite corner follows the mouse. Subsequent mouse downs will change the location of a corner, edge, or entire box, depending upon proximity to corner, edge, or center of the box. Future mouse events in viewer control a bounding box; other client mouse procs suspended. As a "saftety valve," this mode is disabled upon some fixed number of mouse ups. If action is non-nil, it's called for each future mouse event; action must not be nested. Do not expect this to work if called from within a MouseProc. Disable bounding box interaction for this viewer; return the bounding box. This needn't be called to disable (EnableBoundingBox.action can return FALSE). Given a starting point and current mouse state down, draw a bounding box until mouse up. If context is NIL, one will be created via a call to PaintProc. Order box such that box.min.s < box.max.s and box.min.f < box.max.f. Produce a bounding, xor'd box (6 pixel width outline) on the context. User Interaction Register the MouseProc with the user event notifier for viewer. MouseProc must not be a nested procedure! viewer is presumed to be a Ct class viewer. clientData is passed to the mouseProc. mouse.pos is relative to the given origin. Unregister the MouseProc. Return the current mouse position with respect to the viewer coordinates. x IN [0..viewer.ww]; y IN [0..viewer.wh]. return value is relative to the given origin. Poll the given key (mouse or keyboard). Are the left, middle and right mouse buttons up? Return true if the mouse is presently in the given viewer. Convert the mouse position to be with respect to the new origin. Repeatedly poll the mouse and perform action while the mouse is down in the viewer. The standard notify mechanism for viewer is disabled during this call. action is called with pos relative to the given origin. Colormap Get the colormap associated with the viewer. Associate cmap with viewer; future mouse-downs in viewer will set the display to use cmap. Κξ•NewlineDelimiter –"cedarcode" style™™ Jšœ Οeœ6™BJ™)J™—JšΟk œ7žœ˜RJ™JšΠblœžœž ˜Jšœž˜head–16.0 24 .div 1 1 textColoršΟl™Jšœ žœ˜)Jšœ žœ˜%Jšœ žœ˜'Jšœžœ˜Jšœ žœ˜!Jšœžœ˜ Jšžœžœžœ˜Jšœžœžœ˜šœžœ˜&J˜—šœ žœ˜(J™?J™0J˜—J™5—–16.0 24 .div 1 1 textColorš ™šœ˜J™.J˜—šœ žœžœ˜Jšœ˜Jšœ˜J˜Jšœ žœžœžœ˜Jšžœ-˜4JšΟb™Jšœ*‘!œ™LJ™YJ™MJ™YJ˜—š Οn œžœ2žœžœžœ˜SJ™2Jš‘%™%J˜—š’œžœ˜Jšœžœ˜Jšœ˜Jšœ žœžœžœ˜J˜$Jšœ žœ˜Jšœžœžœ˜&Jšžœ ˜J™:J™2J™0J™@J™PJ™;Jš‘%™%J™—š’ œžœ˜Jšœžœ˜ J˜$Jšœ žœ˜Jšœžœžœ˜&Jšžœ ˜J™LJ™0J™@J™PJ™;J™—š’œžœžœ˜J™@——–16.0 24 .div 1 1 textColorš  ™ š’ œžœžœ˜6Jšœ;Οsœ™?J™—š’ œžœ9˜HJ™OJ™1J™—š’œžœžœ˜4JšœW™WJ™—š’œžœ$˜1Jšœ™——–16.0 24 .div 1 1 textColorš  ™ J™ZJ™[J™[™J˜—š œžœžœžœžœžœ˜BJšœžœ žœžœ˜'J˜—š’œžœ˜Jšœ˜Jšœžœ˜Jšœ žœžœžœ˜J™YJ™PJ™YJ™=J™—š’œžœžœ˜8J™JJ™NJ™—š’œžœ˜Jšœ˜Jšœ ˜ Jšœžœ˜J˜Jšžœ˜J™XJšœ£œ.™?Jšœ™—š’œžœ žœ˜(J™DJ™—š’œžœ˜'J™E——–16.0 24 .div 1 1 textColorš ™Jšœ žœ Οc˜FJšœ žœ€˜GJ˜šœ žœžœ€˜2Jšœ!€˜6Jšœ"€˜5Jšœ"€˜:Jšœ žœžœ€˜5Jšœžœžœ€˜1Jšœ˜J˜—šœ žœžœ˜Jšœ˜Jšœ˜Jšœžœžœ˜J˜—š œ žœžœžœ žœžœ˜KJ˜—š’ œžœ˜Jšœ˜Jšœ˜Jšœ žœžœžœ˜J˜J™?Jš‘)™)J™+Jšœ&™&J™*J˜—š’œžœ$˜9Jšœ™J™—š’ œžœ.žœ˜UJ™IJšœ£œ£œ™)J™-J™—š’œžœžœžœ˜4J™'J™—š’ œžœžœžœ˜ J™0J™—š’ œžœžœžœ˜4J™:J™—š’ œžœ5˜GJšžœ˜J™@J™—š’œžœ@˜VJ™SJ™FJ™8——–16.0 24 .div 1 1 textColorš ™š’ œžœžœžœ˜9J™,J˜—š’ œžœžœ˜6J™ZJ™——Jšžœ˜—…— T#