Introduction and Overview
The clipboard has been present on RISC OS for some time but is much underused. This has been addressed in RISC OS 4.2; in particular the 'standard' applications Draw, Paint and Edit have been updated with clipboard-based Cut and Paste functions in an effort to lead the initiative to see more widespread use in RISC OS.
Technical Details
To help with this, RISC OS 4.24 onwards provides two simple SWIs to provide copy and paste facilities to applications.
Data pasted onto the clipboard is stored as a typed file - much as a selection saved to the RAM disc would be.
SWI Calls
| R0 | = | Flags:
| |||||||||||||||||
| R1 | = | Filetype of data | |||||||||||||||||
| R2 | = | Pointer to block of memory if a memory copy; pointer to filename if a file copy | |||||||||||||||||
| R3 | = | Length of block of memory if a memory copy; undefined for all other uses | |||||||||||||||||
| R0 - R3 | = | Preserved |
This call is used to copy data to the clipboard. The data must be assigned a filetype; this allows receiving applications to understand what they are dealing with. Data may be passed to the clipboard as a file or as a block of memory.
The application must, of course, implement 'cut' itself by using the SWI ClipboardHolder_Copy SWI and then removing its own data, leaving just the copy on the clipboard.
| R0 | = | Flags:
| ||||||||||||||||||||
| R1 | = | Preferred filetype of data, or -1 to receive it in the format it was copied as | ||||||||||||||||||||
| R2 | = | Window handle to provide clipboard data to (or 0 for a new window) | ||||||||||||||||||||
| R3 | = | Private handle to identify request | ||||||||||||||||||||
| R0 | = | State:
| |||||||||||||||
| R1 | = | Filetype of data | |||||||||||||||
| R2 | = | Pointer to block of memory if a memory copy; pointer to filename if a file copy | |||||||||||||||
| R3 | = | Length of block of memory if a memory copy; preserved for file copies | |||||||||||||||
This call is used to request data to paste from the clipboard. The data has been assigned a filetype when it was copied; this allows receiving applications to understand what they are dealing with.