Scrap Manager - IIgs Toolbox Reference Index Housekeeping Routines ScrapBootInit ScrapStartUp ScrapShutDown ScrapVersion ScrapReset ScrapStatus Scrap Routines UnloadScrap LoadScrap ZeroScrap PutScrap GetScrap Scrap Information Routines GetIndScrap GetScrapCount GetScrapState GetScrapHandle GetScrapSize GetScrapPath SetScrapPath Clipboard Routines ShowClipboard Constants Error Codes _________________________________________________________________ $0116 ScrapBootInit Initializes the Scrap Manager; called only by the Tool Locator when the Scrap Manager is loaded. Warning An application must never make this call. Parameters There are no input or output parameters. Errors None C You shouldn't call this function. _________________________________________________________________ $0216 ScrapStartUp Starts up the Scrap Manager; you must call this before using any other Scrap Manager calls. Parameters There are no input or output parameters. Errors None C extern pascal void ScrapStartUp(void) _________________________________________________________________ $0316 ScrapShutDown Shuts down the Scrap Manager; if you called ScrapStartUp, you must call this before your program exits. Parameters There are no input or output parameters. Errors None C extern pascal void ScrapShutDown(void) _________________________________________________________________ $0416 ScrapVersion Returns the version number of the Scrap Manager. Parameters Input: wordspace Word -- Space for result Output: versionInfo Word -- Version number of the Scrap Manager. Errors None C extern pascal Word ScrapVersion(void) _________________________________________________________________ $0516 ScrapReset Resets the Scrap Manager. The Tool Locator calls this when the system is reset; you should never issue this call. Warning An application must never make this call. Parameters There are no input or output parameters. Errors None C You shouldn't call this function. _________________________________________________________________ $0616 ScrapStatus Indicates whether or not the Scrap Manager is active. Parameters Input: wordspace Word -- Space for result Output: status Word -- TRUE if the Scrap Manager is active, FALSE if not. Errors None C extern pascal Word ScrapStatus(void) _________________________________________________________________ $1416 GetIndScrap Lets you get information about all scraps without knowing what their type is in advance (GetScrap and GetScrapHandle require a scrap type as input). To get information about all the scraps available, make repeated calls to GetIndScrap with increasing index values until it returns an error, thereby indicating you've scanned all the scraps. Parameters Input: index Word -- Which scrap to get bufferPtr Long -- Pointer to buffer to receive information Errors $1610 badScrapType No scrap of given type found. C extern pascal void GetIndScrap(Word index, Pointer bufferPtr) index Specifies which scrap to get. The first scrap has an index of 1. bufferPtr Pointer to a result buffer. The buffer has this format: $00 scrapType Word -- Scrap type $02 scrapSize Long -- Scrap size $06 scrapHandle Long -- Scrap handle _________________________________________________________________ $0D16 GetScrap Copies scrap information of the specified type into a specified handle, setting the handle to the correct size. If you want to copy the desk scrap into the LineEdit scrap, use the LEFromScrap routine in the LineEdit Tool Set. Parameters Input: destHandle Long -- Handle to scrap destination scrapType Word -- Scrap type Errors $1610 badScrapType No scrap of given type found. Memory Manager errors Returned unchanged GS/OS errors Returned unchanged C extern pascal void GetScrap(Handle destHandle, Word scrapType) _________________________________________________________________ $1216 GetScrapCount Returns the current scrap count. The scrap count changes whenever ZeroScrap is called; it reflects how many times the scrap has changed. You can use this count to test whether the desk scrap's contents have changed. Parameters Input: wordspace Word -- Space for result Output: scrapCount Word -- Current scrap count Errors None C extern pascal unsigned int GetScrapCount(void) _________________________________________________________________ $0E16 GetScrapHandle Returns the handle of the scrap of the requested type. This does not copy the scrap; it just returns a handle to it. Parameters Input: longspace Long -- Space for result scrapType Word -- Scrap type Output: scrapHandle Long -- Handle to specifid tye of scrap Errors $1610 badScrapType No scrap of given type found. Memory Manager errors Returned unchanged GS/OS errors Returned unchanged C extern pascal Handle GetScrapHandle(Word scrapType) _________________________________________________________________ $1016 GetScrapPath Returns a pointer to the pathname used for the Clipboard file. Parameters Input: longspace Long -- Space for result Output: pathPtr Long -- Pointer to pathname Errors None C extern pascal Pointer GetScrapPath(void) _________________________________________________________________ $0F16 GetScrapSize Returns the size of the specified scrap. Parameters Input: longspace Long -- Space for result scrapType Word -- Scrap type Output: scrapSize Long -- Size of scrap in bytes. Errors $1610 badScrapType No scrap of given type found. Memory Manager errors Returned unchanged GS/OS errors Returned unchanged C extern pascal LongWord GetScrapSize(Word scrapType) _________________________________________________________________ $1316 GetScrapState Returns a non-zero value if the scrap is in memory, or 0 if the scrap is on disk. If the system thinks the scrap is on disk, but the Clipboard file has been deleted, this function still returns 0. Parameters Input: wordspace Word -- Space for result Output: scrapState Word -- Nonzero if scrap in memory, 0 if on disk Errors None C extern pascal Word GetScrapState(void) _________________________________________________________________ $0A16 LoadScrap Loads the desk scrap into memory from disk. If it's already in memory, LoadScrap does nothing. If the Clipboard file is missing or cannot be found, the scrap is empty after this call. Parameters There are no input or output parameters. Errors Memory Manager errors Returned unchanged GS/OS errors Returned unchanged C extern pascal void LoadScrap(void) _________________________________________________________________ $0F16 PutScrap Appends data to the specified scrap. If the scrap is currently on disk, it's loaded first. Don't forget to call ZeroScrap before PutScrap if you don't want to append the data to the existing scrap. Parameters Input: numBytes Long -- Number of bytes to add to the scrap scrapType Word -- Scrap type srcPtr Long -- Pointer to data to be placed in the scrap Errors Memory Manager errors Returned unchanged GS/OS errors Returned unchanged C extern pascal void PutScrap(LongWord numBytes, Word scrapType, Pointer srcPtr) _________________________________________________________________ $1116 SetScrapPath Sets a pointer to the pathname used for the Clipboard file. Parameters Input: pathPtr Long -- Pointer to pathname of Clipboard Errors None C extern pascal void SetScrapPath(Pointer pathPtr) _________________________________________________________________ $1516 ShowClipboard Creates a system window that displays the current clipboard for you. It can handle text, picture, and sound scraps. To open the Clipboard window, use a flags value of $8000. To close it, use $40000. If you need to know the WindowPtr of the current Clipboard window (without opening or closing the window), use $0000. In all cases, the result windowPtr is either a valid window pointer or NIL if the Clipboard is not open. The Clipboard window sends a request of type $000C (systemSaysDoClipboard) to allow other software to display different types of data in the Clipboard window. For details, see page 28 of the Programmer's Reference for System 6.0.1. System 6.0.1 Parameters Input: longspace Long -- Space for result flags Word -- Flags (See below) reserved Long -- Reserved; use 0 Errors Errors from SelectWindow and NewWindow2 are returned unchanged. C extern pascal WindowPtr ShowClipboard(Word flags, Long reserved) flags bit 15: 1 = Open the Clipboard window (or bring it to he front if it's already open) bit 14: 1 = Close the Clipboard window if it's open bits 13-0: Reserved; set to 0. reserved Reserved for future expansion; use 0. _________________________________________________________________ $0916 UnloadScrap Writes the desk scrap from memory to the Clipboard file and releases the memory it occupies. If the scrap is already on disk, this call does nothing. Parameters There are no input or output parameters. Errors Memory Manager errors Returned unchanged GS/OS errors Returned unchanged C extern pascal void UnloadScrap(void) _________________________________________________________________ $0B16 ZeroScrap Clears the current contents of the scrap, whether it's in memory or on disk, and updates the scrap count. When the user selects the Cut or Copy options to change the scrap, y9ou should call ZeroScrap before calling PutScrap. Parameters There are no input or output parameters. Errors Memory Manager errors Returned unchanged GS/OS errors Returned unchanged C extern pascal void ZeroScrap(void) _________________________________________________________________ Scrap Manager Constants Name Value Description Public scrap types textScrap $0000 Text scrap. picScrap $0001 Picture scrap Scrap Manager Error Codes Code Name Description $1610 badScrapType No scrap of specified type found _____________________________________________________________________________ This text file is freely available public domain information. As such...It may be duplicated or reprinted, in whole or in part, without the express written permission of anybody.