home *** CD-ROM | disk | FTP | other *** search
- /*
- * lemedit.c - object manipulation
- *
- * copyright (c) by Alan W. Paeth, 1987. All rights reserved.
- */
-
- #include "lem.h"
-
- moveselect(x, y)
- {
- int i;
- /*
- * set flag and record last movement for undo
- */
- unx = x;
- uny = y;
- undo = UNDOMOVE;
- /*
- * do the move
- */
- if (!anysel) return;
- forobjects
- {
- if (Osel)
- {
- objectop(i, SEL, DEL);
- objmove(i, x, y);
- objectop(i, DEL, SEL);
- }
- }
- }
-
- tugunselect(xs, ys, xe, ye)
- {
- int i;
- /*
- * set flag and record last movement for undo
- */
- unx = xs;
- uny = ys;
- unxe = xe;
- unye = ye;
- undo = UNDOTUG;
- /*
- * do the tug
- */
- if (anysel) return;
- forobjects
- {
- if (Oundel && objcantug(i, xs, ys))
- {
- objectop(i, UNDEL, DEL);
- objtug(i, xs, ys, xe, ye);
- objectop(i, DEL, UNDEL);
- }
- }
- }
-
- copyattr(j, i)
- {
- objs[j]->stat = Ostat;
- objs[j]->type = Otype;
- objs[j]->x0 = Oxs;
- objs[j]->y0 = Oys;
- objs[j]->x1 = Oxe;
- objs[j]->y1 = Oye;
- objs[j]->align = Oalign;
- objs[j]->emph = Oemph;
- objs[j]->size = Osize;
- objs[j]->group = Ogroup;
- if (Otext) objs[j]->text = salloc(Otext);
- }
-
- copysel()
- {
- int i, j, g, dx, dy;
- if (!anysel) return;
- dx = tickflag ? tx : DEFCOPYWID;
- dy = tickflag ? ty : DEFCOPYWID;
- g = uniquegroup();
- forobjects
- {
- if (Osel)
- {
- j = objalloc(Otype);
- copyattr(j, i);
- objs[j]->x0 = Oxs+dx;
- objs[j]->y0 = Oys+dy;
- if (Otype != TEXT)
- {
- objs[j]->x1 = Oxe+dx;
- objs[j]->y1 = Oye+dy;
- }
- objs[j]->group = g;
- objs[j]->stat = DEL;
- objectop(i, SEL, UNDEL);
- objectop(j, DEL, UNDEL);
- }
- }
- if (markobj) markupdate(markx+dx, marky+dy);
- }
-