home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-12-04 | 2.1 KB | 92 lines | [TEXT/MPS ] |
- /*
- File: icm4.h
- Contains: Resource Functions
- Written by: DTS and QT Engineering
- Copyright: © 1992-1994 by Apple Computer, Inc., all rights reserved.
- Change History (most recent first):
- <1> 12/4/94 khs changed the format of the file to the new look and feel
- To Do:
- */
-
-
- // INCLUDE FILES
- #include "icm.h"
-
-
- // FUNCTIONS
- void MakeMyResource(StandardFileReply fileReply,
- ImageDescriptionHandle description)
- {
- OSErr error;
- short rfRef;
- Handle sequResource;
-
- FSpCreateResFile(&fileReply.sfFile, 'SEQM', 'SEQU', fileReply.sfScript);
-
- error = ResError();
- if (error != dupFNErr)
- CheckError(error, "\pFSpCreateResFile");
-
- rfRef = FSpOpenResFile(&fileReply.sfFile, fsRdWrPerm);
- CheckError(ResError(), "\pFSpOpenResFile");
-
- SetResLoad(false);
- sequResource = Get1Resource('SEQU', 128);
- if (sequResource != nil)
- {
- RemoveResource(sequResource);
- }
- SetResLoad(true);
- sequResource = (Handle)description;
- error = HandToHand(&sequResource);
- CheckError(error, "\pHandToHand");
-
- AddResource(sequResource, 'SEQU', 128, "\p");
- CheckError(ResError(), "\pAddResource");
- UpdateResFile(rfRef);
- CheckError(ResError(), "\pUpdateResFile");
-
- CloseResFile(rfRef);
- }
-
-
- void SequenceSave(void)
- {
- long filePos;
- StandardFileReply fileReply;
- short dfRef = 0;
- OSErr error;
- ImageDescriptionHandle description = nil;
-
- StandardPutFile("\p", "\pSequence File", &fileReply);
- if (fileReply.sfGood)
- {
- if (!(fileReply.sfReplacing))
- {
- error = FSpCreate(&fileReply.sfFile, 'SEQM', 'SEQU', fileReply.sfScript);
- CheckError(error, "\pFSpCreate");
- }
- error = FSpOpenDF(&fileReply.sfFile, fsWrPerm, &dfRef);
- CheckError(error, "\pFSpOpenDF");
-
- error = SetFPos(dfRef, fsFromStart, 0);
- CheckError(error, "\pSetFPos");
-
- CompressSequence(&dfRef, &description);
- error = GetFPos(dfRef, &filePos);
- CheckError(error, "\pGetFPos");
-
- error = SetEOF(dfRef, filePos);
- CheckError(error, "\pSetEOF");
-
- FlushVol(nil, fileReply.sfFile.vRefNum);
- FSClose(dfRef);
- dfRef = 0;
- MakeMyResource(fileReply, description);
- if (description != nil)
- DisposeHandle((Handle)description);
- }
- }
-
-
-