home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / C and C++ / Libraries / BlobMgr / Library Folder / ZTransaction.c < prev   
Encoding:
C/C++ Source or Header  |  1994-02-21  |  1.6 KB  |  80 lines  |  [TEXT/KAHL]

  1. /* -------------------------------------------------------------------- */
  2. /*                Blob Transaction Routines - with zooming                */
  3. /* -------------------------------------------------------------------- */
  4.  
  5.  
  6. # include    "BlobMgr.h"
  7.  
  8.  
  9. /*
  10.  * Same as UnglueGlob(), except that a rectangle is zoomed
  11.  * from the destination blob back to the source blob.
  12.  */
  13.  
  14. pascal void
  15. ZUnglueGlob (BlobHandle b)
  16. {
  17. BlobHandle    g;
  18. Rect        r1, r2;
  19.  
  20.     g = (**b).glob;
  21.     if (g != nil)            /* skip if don't really have glued blob */
  22.     {
  23.         (**b).glob = nil;
  24.         DrawBlob (b, inDragBlob);
  25.         r1 = BDragBox (b);
  26.         r2 = BDragBox (g);
  27.         BMgrZoomRect (&r1, &r2);
  28.         DecBlobGlue (g);    /* dec use count and undim if necessary */
  29.     }
  30. }
  31.  
  32.  
  33. pascal void
  34. ZUnglueGlobSet (BlobSetHandle bSet)
  35. {
  36.     BlobLoopProc1 (&ZUnglueGlob, bSet);
  37. }
  38.  
  39.  
  40. /*
  41.  * Same as GlueGlob(), but zooms the donor to the receptor first
  42.  */
  43.  
  44. pascal void
  45. ZGlueGlob (BlobHandle d, BlobHandle r)
  46. {
  47. Rect    r1, r2;
  48.  
  49.     r1 = BDragBox (d);
  50.     r2 = BDragBox (r);
  51.     BMgrZoomRect (&r1, &r2);
  52.     GlueGlob (d, r);
  53. }
  54.  
  55.  
  56. /*
  57.  * Same as DupGlob(), but zooms from the first receptor to the second
  58.  * before duplicating.
  59.  *
  60.  * This really should use the drag region of the first receptor's glob,
  61.  * mapped to the shape and position of the receptor, rather than the
  62.  * receptor's drag region - since it's the glob that's being transferred.
  63.  * But that requires mapping (and scaling when it's put in).
  64.  */
  65.  
  66. pascal void
  67. ZDupGlob (BlobHandle r1, BlobHandle r2)
  68. {
  69. Rect    rect1, rect2;
  70.  
  71.     if (BGlob (r1) != nil)
  72.     {
  73.         rect1 = BDragBox (r1);
  74.         rect2 = BDragBox (r2);
  75.         BMgrZoomRect (&rect1, &rect2);
  76.         DupGlob (r1, r2);
  77.     }
  78. }
  79.  
  80.