home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume10 / lemming / part02 / lemop.c < prev    next >
Encoding:
C/C++ Source or Header  |  1987-08-05  |  1.1 KB  |  59 lines

  1. /*
  2.  * lemop.c - operate on objects (and update the display)
  3.  *
  4.  * copyright (c) by Alan W. Paeth, 1987. All rights reserved.
  5.  */
  6.  
  7. #include "lem.h"
  8.  
  9. objectop(i, instatus, outstatus)
  10.     {
  11.     int col;
  12.     if (i && (Ostat == instatus))
  13.     {
  14.     if ( instatus == SEL) anysel--;
  15.     if (outstatus == SEL) anysel++;
  16.     Ostat = outstatus;
  17.     switch(Ostat)
  18.         {
  19.         case DEL:   col = ERASECOL; break;
  20.         case UNDEL: col = DRAWCOL; break;
  21.         case SEL:   col = SELECTCOL; break;
  22.         }
  23.     objdraw(i, col);
  24.     if (Odel && (i == markobj)) markobj = 0;
  25.     changes |= ( (instatus == DEL) || (outstatus == DEL) );
  26.     if ( instatus == DEL)
  27.     return(1);
  28.     }
  29.     return(0);
  30.     }
  31.  
  32. any(i, opcode)
  33.     {
  34.     if (Ogroup) all(opcode, Ogroup);
  35.     else
  36.     switch(opcode)
  37.     {
  38.     case SELECT:   objectop(i, UNDEL, SEL); break;
  39.     case DESELECT: objectop(i, SEL, UNDEL); break;
  40.     case DELETE:   objectop(i, SEL, DEL);  break;
  41.     case UNDELETE: objectop(i, DEL, SEL);  break;
  42.     }
  43.     }
  44.  
  45. all(opcode, group)
  46.     {
  47.     int i, saveg;
  48.     forobjects
  49.     {
  50.     if (!group || Ogroup == group)
  51.         {
  52.         saveg = Ogroup;
  53.         Ogroup = 0;
  54.         any(i, opcode);
  55.         Ogroup = saveg;
  56.         }
  57.     }
  58.     }
  59.