home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-06-08 | 4.8 KB | 162 lines | [TEXT/PJMM] |
- {****************************************************}
- {}
- { CSATPane.p }
- {}
- { Panorama class for use with the Sprite Animation Toolkit. This basically }
- { calls SATCustomInit to set up the animation area, and implements it in a }
- { panorama. }
- {}
- { The bounds of the panorama are the rectangle specified to SAT. The other }
- { parameters are as per SAT. We ignore the options for centering the drawing }
- { area and filling the screen, since these are handled by the window class and }
- { the decorator class (if used). }
- {}
- { Important: Only one instance of this class should exist. This is where SAT }
- { thinks that its drawing area is. }
- {}
- {****************************************************}
-
-
- unit CSATPane;
-
- interface
-
- uses
- TCL, SATTCLIntf;
-
- implementation
-
-
- {****************************************************}
- {}
- { ISATPane }
- {}
- { Initialize a SAT Pane class, and SAT. The drawing area for SAT specifies }
- { the bounds of the panorama. }
- {}
- {****************************************************}
-
- procedure CSATPane.ISATPane (anEnclosure: CView;
- aSupervisor: CBureaucrat;
- aWidth, aHeight, aHEncl, aVEncl: Integer;
- aHSizing, aVSizing: SizingOption;
- aPICTColor, aPICTBW: Integer;
- aSATRect: Rect;
- aUseMenuBar, aDither4bit, aBeSmart: Boolean);
-
- var
- theLongRect: LongRect;
-
- begin { ISATPane }
- IPanorama(anEnclosure, aSupervisor, aWidth, aHeight, aHEncl, aVEncl, aHSizing, aVSizing);
-
- { Remember, a panorama pane is a window into the contents. }
-
- QDToLongRect(aSATRect, theLongRect);
- OffsetLongRect(theLongRect, -theLongRect.left, -theLongRect.top);
- SetBounds(theLongRect);
-
- SATCustomInit(aPICTColor, aPICTBW, aSATRect, WindowPtr(GetMacPort), nil, aUseMenuBar, FALSE, FALSE, aDither4bit, aBeSmart);
- end; { ISATPane }
-
-
- {****************************************************}
- {}
- { Draw }
- {}
- { TCL wants to draw the SAT pane. So draw it, as described in the manual. }
- { We don't use SATRedraw because we don't want the black bars. }
- {}
- {****************************************************}
-
- procedure CSATPane.Draw (var area: Rect);
-
- begin
- { It may be worth putting in a call to SATDepthChangeTest here, if there is }
- { a good way to use this information. }
-
- { Note that area is supplied in frame coordinates, and hence SAT coordinates. }
-
- CopyBits(gSAT.offScreen.port^.portbits, gSAT.wind.port^.portbits, area, area, srcCopy, nil);
- end;
-
-
- {****************************************************}
- {}
- { DoSATRun }
- {}
- { Call SATRun for one frame of animation, with the given fast parameter. }
- {}
- { SAT expects that its onscreen drawing area (the frame of the SAT Pane) }
- { is valid. However, we can't just call ValidRect with the frame, because }
- { there may be a updateEvt pending for the window. }
- {}
- { The cunning bit of subterfuge implemented here is to copy the update }
- { region of the window into a temporary region, validate the frame for }
- { SATRun, and then copy the region back so that the window's Update }
- { method can work as normal. }
- {}
- {****************************************************}
-
- procedure CSATPane.DoSATRun (fast: Boolean);
-
- var
- theQDRect: Rect;
- theWindowPeek: WindowPeek;
-
- begin { DoSATRun }
- theWindowPeek := WindowPeek(GetWindow.GetMacPort);
-
- CopyRgn(theWindowPeek^.updateRgn, gUtilRgn);
-
- FrameToQDR(frame, theQDRect);
- ValidRect(theQDRect);
-
- SATRun(fast);
-
- CopyRgn(gUtilRgn, theWindowPeek^.updateRgn);
-
- SetEmptyRgn(gUtilRgn);
- end; { DoSATRun }
-
-
- {****************************************************}
- {}
- { DoSATRun2 }
- {}
- { Call SATRun2 for one frame of animation, with the given fast parameter. }
- {}
- { SAT expects that its onscreen drawing area (the frame of the SAT Pane) }
- { is valid. However, we can't just call ValidRect with the frame, because }
- { there may be a updateEvt pending for the window. }
- {}
- { The cunning bit of subterfuge implemented here is to copy the update }
- { region of the window into a temporary region, validate the frame for }
- { SATRun, and then copy the region back so that the window's Update }
- { method can work as normal. }
- {}
- {****************************************************}
-
- procedure CSATPane.DoSATRun2 (fast: Boolean);
-
- var
- theQDRect: Rect;
- theWindowPeek: WindowPeek;
-
- begin { DoSATRun }
- theWindowPeek := WindowPeek(GetWindow.GetMacPort);
-
- CopyRgn(theWindowPeek^.updateRgn, gUtilRgn);
-
- FrameToQDR(frame, theQDRect);
- ValidRect(theQDRect);
-
- SATRun2(fast);
-
- CopyRgn(gUtilRgn, theWindowPeek^.updateRgn);
-
- SetEmptyRgn(gUtilRgn);
- end; { DoSATRun }
-
-
- end. { CSATPane }