home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Carousel
/
CAROUSEL.cdr
/
mactosh
/
lang
/
skel_azt.sha
/
resize.c
< prev
next >
Wrap
C/C++ Source or Header
|
1986-07-08
|
2KB
|
81 lines
/*
* resize.c -- handle a mouse click and drag in the grow box of this
* window
*/
#include <quickdraw.h>
#include <control.h>
#include <textedit.h>
#include <window.h>
#include "def.h"
void
resize(i, pt)
int i; /* index of window pointer */
Point pt; /* location of mouse down in grow box */
{
extern Rect grafr;
extern TEHandle hTE;
extern ControlHandle hscroll[NWINDOWS];
extern Rect r;
extern Point tlp[NWINDOWS];
extern ControlHandle vscroll[NWINDOWS];
extern Rect wgrowr;
extern WindowPtr wp[NWINDOWS];
Point newpt;
long newsize;
Point oldpt;
newsize = GrowWindow(wp[i], pass(pt), &wgrowr);
BlockMove(&newsize, &newpt, (long)sizeof(Point));
if (!newpt.v && !newpt.h) /* no change in window size */
return;
/* invalidate old scrollbar areas before SizeWindow */
BlockMove(&wp[i]->portRect, &r, (long)sizeof(Rect));
r.left = r.right - 16;
InvalRect(&r);
BlockMove(&wp[i]->portRect, &r, (long)sizeof(Rect));
r.top = r.bottom - 16;
InvalRect(&r);
/* width */
SizeWindow (wp[i], (short)(newsize & 0xFFFF),
/* height */
(short)((newsize >> 16) & 0xFFFF), TRUE);
/* invalidate new scrollbar areas after SizeWindow */
BlockMove(&wp[i]->portRect, &r, (long)sizeof(Rect));
r.left = r.right - 16;
InvalRect(&r);
BlockMove(&wp[i]->portRect, &r, (long)sizeof(Rect));
r.top = r.bottom - 16;
InvalRect(&r);
BlockMove(&wp[i]->portRect, &r, (long)sizeof(Rect));
r.bottom -= 15;
r.right -= 15;
if (i == 1 && hTE) {
(*hTE)->viewRect.left = r.left;
(*hTE)->viewRect.top = r.top;
(*hTE)->viewRect.right = r.right - 1;
(*hTE)->viewRect.bottom = r.bottom - 1;
}
else if (i == 0) {
/* if the window has gone beyond the bottom edge, or beyond
* the right edge, of the picture, scroll so that the
* picture comes to the edge of the window
*/
if ((tlp[0].h + r.right - 16) > grafr.right)
SetCtlValue(hscroll[0], grafr.right - r.right + r.left);
if ((tlp[0].v + r.top) > grafr.bottom)
SetCtlValue(vscroll[0], grafr.bottom - r.bottom + r.top);
};
checkscroll(i);
drawscroll(i);
} /* end of resize */