home *** CD-ROM | disk | FTP | other *** search
- /*
- * lemattr.c - change object attributes (and reset global defaults)
- *
- * copyright (c) by Alan W. Paeth, 1987. All rights reserved.
- */
-
- #include "lem.h"
-
- remake(newtype)
- {
- int i;
- gtype = newtype;
- forobjects
- {
- if (Osel && (Otype != newtype) && (Otype != TEXT))
- {
- objectop(i, SEL, DEL);
- Otype = newtype;
- objectop(i, DEL, SEL);
- }
- }
- }
-
- setattr(ch)
- char ch;
- {
- switch(UC(ch))
- {
- case 'B': gemph = EMPHBOLD; break;
- case 'I': gemph = EMPHITAL; break;
- case 'N': gemph = EMPHNONE; break;
- case 'L': galign = ALIGNLEFT; break;
- case 'R': galign = ALIGNRGHT; break;
- case 'C': galign = ALIGNCENT; break;
- case '0': gsize = 1; galign = ALIGNCENT; gemph = EMPHNONE; break;
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': gsize = ch-'0'; break;
- default: return(0); /* invalid char - fail */
- }
- return(1); /* good char */
- }
- /*
- * rewrite all objects with these attributes
- */
-
- forceattr()
- {
- int i, salign, semph, ssize;
- char ch;
- ch = getstroke();
- if (setattr(ch)) /* set global attributes */
- {
- salign = galign; /* save new global attributes */
- semph = gemph;
- ssize = gsize;
- forobjects
- {
- if (Osel)
- {
- objectop(i, SEL, DEL); /* get object */
- galign = Oalign; /* set matching global attribs, */
- gemph = Oemph;
- gsize = Osize;
- setattr(ch); /* reset some new attribute(s) */
- Oalign = galign; /* write back */
- Oemph = gemph;
- Osize = gsize;
- objresize(i); /* in case this changes geometry */
- objectop(i, DEL, SEL);
- }
- }
- galign = salign; /* reset to new global attributes */
- gemph = semph;
- gsize = ssize;
- }
- }
-