home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / Libraries / SAT 2.3.7 / TCL and demo / SAT-TCL / CSATPane.p < prev    next >
Encoding:
Text File  |  1995-12-18  |  2.7 KB  |  93 lines  |  [TEXT/PJMM]

  1. {****************************************************}
  2. {}
  3. {        CSATPane.p                                                                                                                                                                                                        }
  4. {}
  5. {        Methods for the director class by which the THINK Class Library can be    used         }
  6. {        with the Sprite Animation Toolkit.                                                                                                                                     }
  7. {}
  8. {****************************************************}
  9.  
  10.  
  11. unit CSATPane;
  12.  
  13. interface
  14.  
  15.     uses
  16.         TCL, SATTCLIntf;
  17.  
  18. implementation
  19.  
  20.  
  21. {****************************************************}
  22. {}
  23. {        ISATPane                                                                                                                                                                                                                }
  24. {}
  25. {        Initializes the SAT pane class, and SAT. The drawing area for SAT specifies        }
  26. {        the bounds of the panorama.                                                                                                                                                         }
  27. {}
  28. {****************************************************}
  29.  
  30.     procedure CSATPane.ISATPane (anEnclosure: CView; aSupervisor: CBureaucrat; aWidth, aHeight, aHEncl, aVEncl: Integer; aHSizing, aVSizing: SizingOption; aPICTColor, aPICTBW: Integer; aSATRect: Rect; aUseMenuBar, aDither4bit, aBeSmart: Boolean);
  31.  
  32.         var
  33.             theLongRect: LongRect;
  34.  
  35.     begin { ISATPane }
  36.         IPanorama(anEnclosure, aSupervisor, aWidth, aHeight, aHEncl, aVEncl, aHSizing, aVSizing);
  37.  
  38.         { Remember, a panorama pane is a window into the contents. }
  39.  
  40.         QDToLongRect(aSATRect, theLongRect);
  41.         OffsetLongRect(theLongRect, -theLongRect.left, -theLongRect.top);
  42.         SetBounds(theLongRect);
  43.  
  44.         SATCustomInit(aPICTColor, aPICTBW, aSATRect, WindowPtr(GetMacPort), nil, aUseMenuBar, FALSE, FALSE, aDither4bit, aBeSmart);
  45.     end; { ISATPane }
  46.  
  47.  
  48. {****************************************************}
  49. {}
  50. {        Draw                                                                                                                                                                                                                            }
  51. {}
  52. {        TCL wants to draw the SAT pane. So draw it, as described in the manual. We        }
  53. {        don't use SATRedraw because we don't want the black bars.                                                            }
  54. {}
  55. {****************************************************}
  56.  
  57.     procedure CSATPane.Draw (var area: Rect);
  58.  
  59.     begin
  60.         CopyBits(gSAT.offScreen.port^.portbits, gSAT.wind.port^.portbits, area, area, srcCopy, nil);
  61.     end;
  62.  
  63.  
  64. {****************************************************}
  65. {}
  66. {        PrepareForSATRun                                                                                                                                                                                    }
  67. {}
  68. {        When SATRun occurs, the pane is redrawn. However the ports may not be                }
  69. {        valid. We could just call Refresh, but there is an annoying flicker when the             }
  70. {        window's Update method is used. This achieves the same effect, but without        }
  71. {        the flicker.                                                                                                                                                                                                            }
  72. {}
  73. {****************************************************}
  74.  
  75.     procedure CSATPane.PrepareForSATRun;
  76.  
  77.         var
  78.             savePort: GrafPtr;
  79.  
  80.     begin { PrepareForSATRun }
  81.         Refresh;
  82.  
  83.         GetPort(savePort);
  84.         SetPort(GetMacPort);
  85.  
  86.         BeginUpdate(GetMacPort);
  87.         EndUpdate(GetMacPort);
  88.  
  89.         SetPort(savePort);
  90.     end; { PrepareForSATRun }
  91.  
  92.  
  93. end. { CSATPane }