home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.mactech.com 2010
/
ftp.mactech.com.tar
/
ftp.mactech.com
/
online
/
source
/
c
/
compilers
/
Tickle-4.0.sit.hqx
/
Tickle-4.0
/
src
/
windows.c
< prev
next >
Wrap
Text File
|
1993-10-25
|
3KB
|
128 lines
#pragma segment Windows
#include <types.h>
#include <quickdraw.h>
#include <windows.h>
#include <dialogs.h>
/* *************************** FOCUS / DEBUG Stuff ***************** */
#define gFStacklimit 20
#define aStackUnder 500
#define aStackOver 501
static GrafPtr gFStack[gFStacklimit+1]; /* FOCUS stack, array of saveport pointers */
static int gFStackindex; /* The array index to the currently focused port */
/* *************************** BlowUp/Down Constants ***************** */
#define numExpand 15
#define numSteps 20
BlowUpWindow(wRect, startRect)
Rect *wRect, *startRect;
{
Rect myrect, midrect, oldrect;
int i, dh, dv, dleft, dtop, dright, dbottom, sV, sH, wH, wV;
GrafPtr blowport;
GetWMgrPort(&blowport);
focus(blowport);
PenMode(patXor);
wH = wRect->right - wRect->left;
sH = startRect->right - startRect->left;
wV = wRect->bottom - wRect->top;
sV = startRect->bottom - startRect->top;
if (wH > 16)
midrect.left = wRect->left + ((wH >> 1) - 8);
else midrect.left = wRect->left;
if (wV > 16)
midrect.top = wRect->top + ((wV >> 1) - 8);
else midrect.left = wRect->left;
midrect.bottom = midrect.top + 16;
midrect.right = midrect.left + 16;
dleft = (midrect.left - startRect->left) / numSteps;
dtop = (midrect.top - startRect->top) / numSteps;
dright = (midrect.right - startRect->right) / numSteps;
dbottom = (midrect.bottom - startRect->bottom) / numSteps;
myrect = *startRect; FrameRect(&myrect);
for(i=numSteps; i; i--) {
oldrect = myrect;
myrect.left += dleft; myrect.top += dtop;
myrect.right += dright; myrect.bottom += dbottom;
FrameRect(&myrect); FrameRect(&oldrect);
}
dh = -(((wH - 16) >> 1) / numExpand);
dv = -(((wV - 16) >> 1) / numExpand);
for(i=numExpand; i; i--) {
oldrect = myrect;
InsetRect(&myrect, dh, dv);
FrameRect(&myrect); FrameRect(&oldrect);
}
FrameRect(&myrect);
PenNormal();
unfocus();
}
BlowDownWindow(wRect, endRect)
Rect *wRect, *endRect;
{
Rect myrect, oldrect;
int i, dh, dv, dleft, dtop, dright, dbottom, sV, sH, wH, wV;
GrafPtr blowport;
GetWMgrPort(&blowport);
focus(blowport);
PenMode(patXor);
wH = wRect->right - wRect->left;
sH = endRect->right - endRect->left;
wV = wRect->bottom - wRect->top;
sV = endRect->bottom - endRect->top;
dh = ((wH - 16) >> 1) / numExpand;
dv = ((wV - 16) >> 1) / numExpand;
myrect = *wRect; FrameRect(&myrect);
for(i=numExpand; i; i--) {
oldrect = myrect;
InsetRect(&myrect, dh, dv);
FrameRect(&myrect); FrameRect(&oldrect);
}
dleft = (endRect->left - myrect.left) / numSteps;
dtop = (endRect->top - myrect.top) / numSteps;
dright = (endRect->right - myrect.right) / numSteps;
dbottom = (endRect->bottom - myrect.bottom) / numSteps;
for(i=numSteps; i; i--) {
oldrect = myrect;
myrect.left += dleft; myrect.top += dtop;
myrect.right += dright; myrect.bottom += dbottom;
FrameRect(&myrect); FrameRect(&oldrect);
}
FrameRect(&myrect);
PenNormal();
unfocus();
}
InitFocus()
{
gFStackindex = 0;
}
focus(focport)
GrafPtr focport;
{
gFStackindex++;
#if DEBUG > 0
if (gFStackindex > gFStacklimit)
{ Alert(aStackOver, NULL); gFStackindex--; }
#endif
GetPort(&gFStack[gFStackindex]);
SetPort(focport); SetOrigin(0,0);
ClipRect(&focport->portRect);
}
unfocus()
{
gFStackindex--;
#if DEBUG > 0
if (gFStackindex < 0)
{ Alert(aStackUnder, NULL); gFStackindex++; }
#endif
SetPort(gFStack[gFStackindex]);
}