home *** CD-ROM | disk | FTP | other *** search
- /*
- * lemselect.c - object selection and proximity testing
- *
- * copyright (c) by Alan W. Paeth, 1987. All rights reserved.
- */
-
- #include "lem.h"
-
- cycleselect()
- {
- if (markobj)
- {
- if (objs[markobj]->stat == UNDEL) any(markobj, SELECT);
- else if (objs[markobj]->stat == SEL) any(markobj, DESELECT);
- }
- }
-
- rectselect(x0, y0, x1, y1)
- {
- int i, mode, xl, yl, xh, yh;
- xl = MIN(x0, x1);
- yl = MIN(y0, y1);
- xh = MAX(x0, x1);
- yh = MAX(y0, y1);
- mode = (y0 < y1) ? DESELECT : SELECT;
- forobjects
- {
- if (objinrect(i, xl, yl, xh, yh)) any(i, mode);
- }
- }
-
- objnearany(x, y)
- {
- int i;
- if (i = objnear(x, y, UNDEL)) return(i);
- return(objnear(x, y, SEL));
- }
-
- objnear(x, y, stat)
- {
- int i;
- forobjsrev /* reverse order search - most recent appears first */
- {
- if (Ostat == stat)
- {
- if (objnearpt(i, x, y)) return(i);
- }
- }
- return(0);
- }
-