ColorTrixMisc.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Bloomenthal, February 13, 1987 0:04:38 am PST
DIRECTORY ColorTrixBasics, ColorTrixMap, Imager, Rope;
ColorTrixMisc: CEDAR DEFINITIONS
~ BEGIN
Color Trix Mouse Watching
Cmap:     TYPE ~ ColorTrixMap.Cmap;
PixelMapMisc:  TYPE ~ ColorTrixBasics.PixelMapMisc;
MouseState:   TYPE ~ {down, held, up};
MouseButton:  TYPE ~ {left, middle, right};
MouseInfo:   TYPE ~ RECORD [
        pm: PixelMapMisc,
        cmap: Cmap,
        x, y: INTEGER,
        state: MouseState,
        button: MouseButton];
MouseProc:   TYPE ~ PROC [mouse: MouseInfo, data: REF ANY];
      Called whenever mouse is down over the color display.
ChangeProc:   TYPE ~ PROC [pmMisc: PixelMapMisc, cmap: Cmap, data: REF ANY];
      Called whenever the color display changes state.
ClientRecord:   TYPE ~ RECORD [
mouseProc:     MouseProc ← NIL,
changeProc:     ChangeProc ← NIL,
data:       REF ANYNIL];
RegisterClient: PUBLIC PROC [clientRecord: ClientRecord, start: BOOLTRUE];
Register a clientRecord with the ColorDisplayWatcher.
If start is TRUE, will start ColorDisplayWatcher if it isn't already started.
UnRegisterClient: PUBLIC PROC [clientRecord: ClientRecord];
Unregister the clientRecord. If clientRecord is the last remaining registered ClientRecord,
the ColorDisplayWatcher will be stopped.
UnRegisterAllClients: PUBLIC PROC;
Unregister all registered clientRecords and stop the ColorDisplayWatcher.
StartColorDisplayWatcher: PUBLIC PROC;
Start the Color Display watcher.
Whenever the color display state changes, all registered changeProcs will be called.
Whenever the mouse is down on the color display, all registered mouseProcs will be called.
StopColorDisplayWatcher: PUBLIC PROC;
Stop the ColorDisplayWatcher.
Color Trix Text
Color:  TYPE ~ Imager.Color;
Context: TYPE ~ Imager.Context;
ROPE:  TYPE ~ Rope.ROPE;
PrintTiogaSelection: PUBLIC PROC [
x, y: NAT, color: Color ← NIL, context: Context ← NIL, screenStyle: BOOLFALSE]
RETURNS [ROPE];
Print the current tioga selection at the given location with the given Imager color.
x and y are with respect to the upper left of the color display.
If color is NIL, use the context's current color unless context is NIL, then use $Black.
Providing a context only saves the need to reacquire the color display.
If screenStyle FALSE, use printStyle.
PrintRope: PUBLIC PROC [rope: ROPE, x, y: NAT, color: Color ← NIL, context: Context ← NIL];
As PrintTiogaSelection except simply print the given rope.
END.