[Select]

Desktop


Index

 

Clipboard Holder

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

ClipboardHolder_Copy (SWI &54040)

Copies data to the clipboard.

On entry
   R0 = Flags:
         bits 0-2 = Type of copy to perform:
                     0 = Memory copy
                     1 = File copy
                     2-7 Reserved
                     3-31 = Reserved, must be zero
   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.
On exit
   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 ClipboardHolder_Copy SWI and then removing its own data, leaving just the copy on the clipboard.

ClipboardHolder_Paste (SWI &54041)

Request data to 'paste' from the clipboard.

On entry
   R0 = Flags:
         bits 0-2 = Type of paste to be performed:
                     0 = Paste to memory
                     1 = Paste to file
                     2-7 = Reserved
         bit 3 = Only check the status and filetype
         bits 4-31 = Reserved, must be zero
   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.
On exit
   R0 = State :
         bit 0 = Clipboard can be delivered to memory
         bit 1 = Clipboard can be delivered to file
         bit 2 = Clipboard must be delivered by the clipboard protocol
         bit 3-31 = Reserved, must be zero
   R1 = Filetype of data
   R2 = Pointer to block of memory if a memory copy; Pointer filename if a file copy.
   R3 = Length of block of memory if a memory copy; preserved for file copies.

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.

The application must, of course, implement 'cut' itself by using the ClipboardHolder_Copy SWI and then removing its own data by itself, leaving just the copy on the clipboard.


This documentation is copyright 3QD Developments Ltd 2013 and may not be reproduced or published in any form without the copyright holders permission. RISC OS is subject to continuous development and improvement as such all information is reproduced by 3QD Developments Ltd in good faith and is believed to be correct at the time of publication E&OE. 3QD Developments Ltd cannot accept any liability for any loss or damage arising from the use of any information provided as part of the RISC OS Documentation.

HTML document version 1.03 3rd November 2015