home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Carousel
/
CAROUSEL.cdr
/
mactosh
/
code
/
p_fracap.sit
/
MFracAppPalette.p
< prev
next >
Wrap
Text File
|
1988-08-17
|
4KB
|
117 lines
{------------------------------------------------------------
#
# Apple Macintosh Developer Technical Support
#
# MacApp Color QuickDraw Palette Fractal Sample Application
#
# FracAppPalette
#
# FracAppPalette.p - Pascal Source
#
# Copyright ⌐ 1988 Apple Computer, Inc.
# All rights reserved.
#
# Versions: 1.0 8/88
#
# Components: MFracAppPalette.p August 1, 1988
# UFracAppPalette.p August 1, 1988
# UFracAppPalette.inc1.p August 1, 1988
# FracAppPalette.r August 1, 1988
# FracAppPalette.make August 1, 1988
#
# The FracAppPalette program is a version of the FracApp program that is
# set up to be as compatible as possible. To this end it uses the Palette
# Manager to set up the color environment. It does not support color table
# animation. It demonstrates how to use the Palette Manager for standard
# color use. It shows how to create and use an offscreen gDevice w/ Port
# for special color useage, as well as how to CopyBits that data up to the
# screen to handle update events. PICT files are read and written, using the
# quickdraw bottlenecks to minimize the use of memory.
# Written in MacApp Object Pascal code.
# Compatibility rating = 0, no known risks.
#
# The program is a complete Macintosh application written in Object
# Pascal using MacApp. It supports multiple windows, calculations in the
# background under MultiFinder, use of the Palette Manager, reading and
# writing of PICT files using the bottlenecks, and shows how to calculate
# the Mandelbrot set.
#
# There is a resource file that is necessary as well, to define the Menus, Window,
# Dialog, Color table, and Palette resources used in the program.
#
------------------------------------------------------------}
{FracAppPalette:
copyright 1988 by Bob. All rights reserved.
February 1, 1988.
Written by Bo3b Johnson of Developer Technical Support. }
PROGRAM FracAppPalette;
USES
{$LOAD MacIntf.LOAD}
MemTypes, QuickDraw, OSIntf, ToolIntf, PackIntf,
{$LOAD UMacApp.LOAD}
UObject, UList, UMacApp,
{$LOAD UBobLips.LOAD}
PaletteMgr, UPrinting,
{$LOAD}
UFracAppPalette;
VAR
{The application object:}
gFracAppApplication: TFracAppApplication;
error: Integer;
FUNCTION ForceEnvirons(minimumSystemVersion: INTEGER;
minimumProcessor: INTEGER; needsFPU: BOOLEAN;
needsColorQD: BOOLEAN;
minimumATDrvrVersNum: INTEGER): BOOLEAN;
VAR
error: OSErr;
theWorld: SysEnvRec;
BEGIN
error := SysEnvirons(1,theWorld);
WITH theWorld DO
ForceEnvirons := (systemVersion >= minimumSystemVersion) AND
(processor >= minimumProcessor) AND (needsFPU >=
hasFPU) AND (needsColorQD >= hasColorQD) AND
(atDrvrVersNum >= minimumATDrvrVersNum);
END;
{ Strange but true, you cannot compile this file with the 881 flag turned on,
or you will not be able to test for an 881 in the environment before you
crash, making it unacceptable for older machines. }
BEGIN
{Initialize the Toolbox, making 8 calls to MoreMasters:}
InitToolbox(8);
{ The first thing we have to do is ensure that we can run in this environment.
We must do a ForceEnvirons to avoid crashing needlessly on machines where
we have no color or 881. The minimum system is 4.2 since we need the more
robust Palette Manager. We don╒t use 020 code, but we require an FPU. We
also require colorQD. If we don╒t have the stuff we need, we will alert and
leave. }
IF NOT ForceEnvirons($0420, envDontCare, TRUE, TRUE, envDontCare) THEN
Failure (kWrongMachine, 0);
{Initialize the UPrinting unit:}
InitPrinting;
{Allocate a new TFracAppApplication object:}
New(gFracAppApplication);
{Initialize that new object:}
gFracAppApplication.IFracAppApplication(kFileType);
{Run the application. When it's done, exit.}
gFracAppApplication.Run;
END.