GGRefresh.mesa
Copyright Ó 1988 by Xerox Corporation. All rights reserved.
Contents: All painting actions in Gargoyle are called thru this interface.
Pier, April 14, 1992 4:15 pm PDT
Bier, March 19, 1992 12:12 pm PST
Doug Wyatt, June 24, 1988 6:01:58 pm PDT
DIRECTORY
GGCoreTypes, GGInterfaceTypes, GGModelTypes, GGSegmentTypes, Imager;
GGRefresh: CEDAR DEFINITIONS = BEGIN
BoundBox: TYPE = GGModelTypes.BoundBox;
FeatureData: TYPE = GGInterfaceTypes.FeatureData;
GGData: TYPE = GGInterfaceTypes.GGData;
Sandwich: TYPE = REF SandwichObj;
SandwichObj: TYPE; -- opaque so GGRefresh doesn't depend on BufferedRefresh
SelectionClass: TYPE = GGSegmentTypes.SelectionClass;
Slice: TYPE = GGModelTypes.Slice;
SliceDescriptor: TYPE = GGModelTypes.SliceDescriptor;
PaintProc: TYPE = PROC [ggData: GGData, request: REF ← NIL, bounds: BoundBox, clientData: REF ← NIL];
Turning Refresh on and off
DisableRefresh:
PROC [ggData: GGData];
Temporarily disable refresh.
EnableRefresh:
PROC [ggData: GGData];
Reenable refresh and update those screen areas that have changed since DisableRefresh was called.
Building and Updating the Sandwich
CreateSandwich:
PROC []
RETURNS [sandwich: Sandwich];
Build a data structure representing all of the layers used to compose each frame
SetScreen:
PROC [ggData: GGData, cw, ch:
INTEGER, screen: Imager.Context];
Establish a new screen area.
Drawing the Latest Frame
ActionAreaPaint:
PROC [screen: Imager.Context, whatHasChanged:
ATOM, ggData: GGData, handleViewerAbort:
BOOL];
whatHasChanged is an atom describing what needs to be repainted ($PaintEntireScene, $SelectionChanged, $FinishedDragging, $CaretMoved, ...). A pointer to the particular object to be repainted will be stored in ggData for now.
We envision a scheme where ActionAreaPaint may actually queue up painting jobs and attempt optimizations on the queue.
If handleViewerAbort is TRUE, this procedure enables and handles viewer aborts during painting; otherwise, it just paints (presumably SlackProcess will handle the aborts).
RepaintArea:
PROC [screen: Imager.Context, ggData: GGData, whatHasChanged:
ATOM, bounds: BoundBox];
Like GGRefresh.ActionAreaPaint, but paints all of the area described by bounds, even if some of this area doesn't need to be painted. If bounds.infinite, repaint the whole action area. If bounds.null then repaint just what needs to be repainted.
SetStartBox:
PROC [ggData: GGData, dragInProgress:
BOOL, caret, anchor, selectedParts, movingParts, selectedCPs, hotCPs, attractor, alignments:
BOOL ←
FALSE];
We are beginning an operation that will require refreshing. Be sure to update the screen region inside "box". This call is a prerequisite to GGWindow.RestoreScreenAndInvariants for many operations.
EnlargeStartBox:
PROC [ggData: GGData, by, andBy: BoundBox];
Modifies the box set in SetStartBox.
NullStartBox:
PROC [ggData: GGData];
Sets the start box to the empty box.
GetABox:
PROC [ggData: GGData, dragInProgress:
BOOL, caret, anchor, selectedParts, movingParts, selectedCPs, hotCPs, attractor, alignments:
BOOL ←
FALSE, into: BoundBox]
RETURNS [box: BoundBox];
if into is NIL, new box is returned ELSE into is filled in and also returned as box
GetPaintBox:
PROC [ggData: GGData, paintAction:
ATOM, into: BoundBox];
Computes a paint bounding box based on the paintAction, places the result in into^.
PaintInParent:
PROC [ggData: GGData, paintAction:
ATOM];
Called by GGWindowImpl.RestoreScreenAndInvariants whenever scene update should be done. Computes a bounding box and then requests the parent to paint it.
RegisterPaintProc:
PROC [ggData: GGData, paintProc: PaintProc, clientData:
REF ←
NIL];
Associate the given PaintProc and clientData with this GGData. This routine will be called by GGWindow.RestoreScreenAndInvariants
The PaintProc will have to call these routines in MMM:
ParentPaintRequestProc: TYPE = PROC [parent: Editor, child: Editor, request: REF ← NIL, bounds: BoundRect ← BoxTypes.infiniteRect];
ParentPaintNotifyProc: TYPE = PROC [parent: Editor, requestor: Editor];
For example:
paintRequest ← NEW[PaintRequestObj ← [$PaintScene, self, NIL, noAction, otherLocn]];
MMMProtocol.ParentPaintRequest[self.parent, self, paintRequest,
Boxes.Intersection[userStatePrivate.dragBounds, self.bounds]];
where MMMProtocol.ParentPaintRequest calls parent.class.paintNotify after putting the request in child.paintRequests.
The PaintProc will have to call this routine in Gargoyle:
ViewerOps.PaintViewer[ viewer: ggData.controls.actionArea, hint: client,
whatChanged: ggData, clearClient: FALSE];
Moving Objects Between Planes During Dragging
MoveToOverlay:
PROC [sliceD: SliceDescriptor, ggData: GGData];
This entity is now on the overlay plane (for dragging or rubberbanding). If a Traj or Sequence is passed, the whole outline to which they belong will be moved.
MoveToBackground:
PROC [sliceD: SliceDescriptor, ggData: GGData];
This entity is now on the background (normal plane), staying put.
MoveAllSelectedToOverlay: PROC [ggData: GGData, selectClass: SelectionClass];
MoveOverlayToBackground: PROC [ggData: GGData];
EmptyOverlay: PROC [ggData: GGData] RETURNS [BOOL];
Updating the Background (stationary objects)
RepairBackgroundInBoundBox: PROC [ggData: GGData, bBox: BoundBox,
eraseFirst: BOOL ← TRUE, overObject: Slice ← NIL];
InvalidateBackground: PROC [ggData: GGData];
Updating the Foreground (alignment objects)
NoteNewForeground: PROC [ggData: GGData, alignObjects: LIST OF FeatureData];
UpdateForeground:
PROC [ggData: GGData, eraseFirst:
BOOL ←
FALSE];
Remake the foreground bitmap, but don't draw it onto the screen.
InvalidateForeground: PROC [ggData: GGData];
SaveForeground: PROC [ggData: GGData];
RestoreForeground: PROC [ggData: GGData];
Drawing Entities
PaintEntireScene:
PROC [screen: Imager.Context, ggData: GGData, buffer:
BOOL ←
TRUE];
If buffer is FALSE, the scene parts will be drawn on the screen, one by one in back to front order. Otherwise, they are drawn all at once.
InterpressEntireScene: PROC [dc: Imager.Context, ggData: GGData];
SnapShot:
PROC [dc: Imager.Context, ggData: GGData];
Like InterpressEntireScene except it only works while a mouse action is in progress. For action shots.
END.