MacIncludes.h

/*
**  File:       MacIncludes.h
**
**  Contains:   This file contains all of the Mac includes that one needs
**
**  Version:    SimpleText 1.4 or later
**
** Copyright 1993-1999 Apple Computer. All rights reserved.
**
**  You may incorporate this sample code into your applications without
**  restriction, though the sample code has been provided "AS IS" and the
**  responsibility for its operation is 100% yours.  However, what you are
**  not permitted to do is to redistribute the source as "DSC Sample Code"
**  after having made changes. If you're going to re-distribute the source,
**  we require that you make it clear in the source that the code was
**  descended from Apple Sample Code, but that you've made changes.
 
*/
 
 
#ifndef __MACINCLUDES__
#define __MACINCLUDES__
 
#ifndef BUILDING_FOR_SYSTEM7
#define BUILDING_FOR_SYSTEM7 1
#endif
 
#include <StdArg.h>
#include <Limits.h>
#include <Types.h>
#include <Resources.h>
#include <QuickDraw.h>
#include <Fonts.h>
#include <Events.h>
#include <Windows.h>
#include <Menus.h>
#include <TextEdit.h>
#include <Dialogs.h>
#include <ToolUtils.h>
#include <Memory.h>
#include <SegLoad.h>
#include <Files.h>
#include <OSUtils.h>
#include <Traps.h>  
#include <Script.h>
#include <ColorPicker.h>
#include <FixMath.h>
#include <Packages.h>
#include <Math.h>
#include <Palettes.h>
#include <QDOffscreen.h>
#include <DeskBus.h>
#include <StdLib.h>
#include <StdArg.h>
#include <Strings.h>
#include <StdIO.h>
#include <Sound.h>
#include <Errors.h>
#include <AppleEvents.h>
#include <DiskInit.h>
#include <Retrace.h>
#include <Folders.h>
#include <Lists.h>
#include <CTBUtilities.h>
#include <Gestalt.h>
#include <Finder.h>
#include <Scrap.h>
#include <Devices.h>
#include <Video.h>
#include <Aliases.h>
#include <SoundInput.h>
#include <Movies.h>
#include <Printing.h>
#include <Balloons.h>
#include <MixedMode.h>
#include <Drag.h>
#include <TSMTE.h>
#include <AppleGuide.h>
#include <Speech.h>
#include <Icons.h>
#include <LowMem.h>
#include <CodeFragments.h>
#include <TextUtils.h>
 
// Balloons.h
#define kDefaultBalloonVariant  2
 
/*
// Fonts.h
#if !GENERATINGPOWERPC
    pascal short GetDefFontSize(void)
    = {0x3EB8,0x0BA8,0x6604,0x3EBC,0x000C};
#endif
*/
 
// For looking at all of our windows, not just the visible ones.
#define LMGetFirstWindow() (* (WindowRef*) 0x9D6)
 
// No glue for this either, sigh.
#define TESetClickLoop(L,H) ((**(H)).clickLoop = (L))
 
// defines I like to use all of the time
extern void _DataInit();        // part of Runtime library
 
#define TopLeft(aRect)  (* (Point *) &(aRect).top)
#define BotRight(aRect) (* (Point *) &(aRect).bottom)
 
#define RectWidth(aRect) ((aRect).right - (aRect).left)
#define RectHeight(aRect) ((aRect).bottom - (aRect).top)
 
#define Max(X, Y) ( ((X)>(Y)) ? (X) : (Y) )
#define Min(X, Y) (  ((X)>(Y)) ? (Y) : (X) )
 
#define Pin(VALUE, MIN, MAX) ( ((VALUE) < (MIN)) ? (MIN) : ( ((VALUE) > (MAX)) ? (MAX) : (VALUE) ) )
 
#define nrequire(CONDITION, LABEL) if (true) {if ((CONDITION)) goto LABEL; }
#define require(CONDITION, LABEL) if (true) {if (!(CONDITION)) goto LABEL; }
 
// The Pascal equivalent of strcpy, takes two Pascal string pointers
#define PSTRCPY(P1, P2) BlockMove(P2, P1, P2[0]+1)
 
// Concatante one character C onto the string S 
#define CHARCAT(S, C)   S[(S[0]+1)] = C; S[0]++;
 
/* The Pascal equivalent of strcat, takes two Pascal string pointers */
#define PSTRCAT(P1, P2)                         \
    BlockMove(&P2[1], &P1[(P1[0]+1)], P2[0]);   \
    P1[0] += P2[0];
 
#if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION < 0x300)
#define CheckMenuItem(menu, item, checked) CheckItem(menu, item, checked)
#endif
 
#endif /* __MACINCLUDES__ */