home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 January / macformat-020.iso / Shareware City / Developers / apps.to.go / DTS.Lib / TUndoPartObj.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-05-17  |  2.6 KB  |  110 lines  |  [TEXT/MPS ]

  1. /*
  2. ** Apple Macintosh Developer Technical Support
  3. **
  4. ** Program:     DTS.Lib
  5. ** File:        TUndoPartObj.c
  6. ** Written by:  Eric Soldan
  7. **
  8. ** Copyright © 1992 Apple Computer, Inc.
  9. ** All rights reserved.
  10. */
  11.  
  12. /* You may incorporate this sample code into your applications without
  13. ** restriction, though the sample code has been provided "AS IS" and the
  14. ** responsibility for its operation is 100% yours.  However, what you are
  15. ** not permitted to do is to redistribute the source as "DSC Sample Code"
  16. ** after having made changes. If you're going to re-distribute the source,
  17. ** we require that you make it clear in the source that the code was
  18. ** descended from Apple Sample Code, but that you've made changes. */
  19.  
  20. #ifndef __OSEVENTS__
  21. #include <OSEvents.h>
  22. #endif
  23.  
  24. #ifndef __OSUTILS__
  25. #include <OSUtils.h>
  26. #endif
  27.  
  28. #ifndef __QUICKDRAW__
  29. #include <Quickdraw.h>
  30. #endif
  31.  
  32. //#ifndef __STRING__
  33. //#include <String.h>
  34. //#endif
  35.  
  36. #ifndef __TREEOBJ__
  37. #include "TreeObj.h"
  38. #endif
  39.  
  40. #ifndef __UTILITIES__
  41. #include "Utilities.h"
  42. #endif
  43.  
  44.  
  45.  
  46. #pragma segment TreeObj
  47. long    TUndoPartObj(TreeObjHndl hndl, short message, long data)
  48. {
  49.     short    fileRefNum;
  50.     char    *cptr;
  51.  
  52.     switch (message) {
  53.         case CONVERTMESSAGE:
  54.             switch (data) {
  55.                 case CONVERTTOID:
  56.                     Hndl2ID(&mDerefUndoPart(hndl)->shndl);
  57.                     Hndl2ID(&mDerefUndoPart(hndl)->dhndl);
  58.                     break;
  59.                 case CONVERTTOHNDL:
  60.                     ID2Hndl(hndl, &mDerefUndoPart(hndl)->shndl);
  61.                     ID2Hndl(hndl, &mDerefUndoPart(hndl)->dhndl);
  62.                     break;
  63.             }
  64.             break;
  65.  
  66.         case FREADMESSAGE:
  67.             fileRefNum = data;
  68.             return(ReadTreeObjData(hndl, fileRefNum));
  69.             break;
  70.  
  71.         case FWRITEMESSAGE:
  72.             fileRefNum = data;
  73.             return(WriteTreeObjData(hndl, fileRefNum));
  74.             break;
  75.  
  76.         case VHMESSAGE:
  77.             cptr = ((VHFormatDataPtr)data)->data;
  78.             ccatchr   (cptr, 13, 2);
  79.             ccat      (cptr, "$10: TUndoPartObj:");
  80.             ccatchr   (cptr, 13, 1);
  81.             ccat      (cptr, "  $00: actionType = ");
  82.             ccatdec   (cptr, mDerefUndoPart(hndl)->actionType);
  83.             ccatchr   (cptr, 13, 1);
  84.             ccat      (cptr, "  $02: shndl      = $");
  85.             ccatpadhex(cptr, '0', 8, 8, (long)mDerefUndoPart(hndl)->shndl);
  86.             ccatchr   (cptr, 13, 1);
  87.             ccat      (cptr, "  $06: scnum      = ");
  88.             ccatdec   (cptr, mDerefUndoPart(hndl)->scnum);
  89.             ccatchr   (cptr, 13, 1);
  90.             ccat      (cptr, "  $08: dhndl      = $");
  91.             ccatpadhex(cptr, '0', 8, 8, (long)mDerefUndoPart(hndl)->dhndl);
  92.             ccatchr   (cptr, 13, 1);
  93.             ccat      (cptr, "  $0C: dcnum      = ");
  94.             ccatdec   (cptr, mDerefUndoPart(hndl)->dcnum);
  95.             ccatchr   (cptr, 13, 1);
  96.             ccat      (cptr, "  $0E: deepCopy   = ");
  97.             ccatdec   (cptr, mDerefUndoPart(hndl)->deepCopy);
  98.             return(true);
  99.             break;
  100.  
  101.         default:
  102.             break;
  103.     }
  104.  
  105.     return(noErr);
  106. }
  107.  
  108.  
  109.  
  110.