| Document Ref: | 1309,419/FS |
|---|---|
| Project: | Shared Source RISC OS release (formerly Ursula and Java 1.2) |
| Revision: | F *** DRAFT *** |
| Date: | 16 October 2007 |
| Author(s): | Ben Avison |



It should be emphasised that a caret must never appear within the same window as a selection at any time, not even during the selecting drag. Placing a new caret or selection removes any caret or selection previously active in the same window. (The definition of a window for these purposes is a top-level window and its panes and all their child windows.)
However, if during (or immediately after) the selection process, the selection would have to be drawn with zero width (i.e. for text selections, when the two ends snap to the same character boundary), a caret must be displayed instead. It is helpful to consider the caret as a zero-width selection; only one selection may be present within one window at a time, so the exclusivity of the caret and selection is an extension of this concept.
When either a caret or a selection is placed in a document, the window must gain the input focus. This will happen automatically for a Wimp-drawn user caret, but in the case of application-drawn carets and selections, the application must position the Wimp caret in the window, but marked as invisible, in order to achieve the same effect. Simply changing the window border colour (as is possible in Wimps since RISC OS 4) is not acceptable.
When a caret or selection is placed in a different drag-and-drop window, the old selection must be redrawn as a shaded selection, not left as is or removed entirely. The caret must be removed entirely (or optionally redrawn as a shadow caret); if the application uses a Wimp-drawn user caret, the caret will be removed for it automatically. The LoseCaret and GainCaret events must not be used to determine when this is necessary, as the Wimp may "borrow" the caret temporarily while a menu is open. A Wimp message exists to indicate when removal or redraw of the caret and selection is necessary, and must be used in preference to the events (see §5.1.1).
Note that a selection may also be non-shaded but not have the input focus if an application not adhering to the cut-and-paste / drag-and-drop protocols had grabbed the Wimp caret (and therefore the input focus). Similarly, non-Wimp-drawn carets may be deprived of the input focus under similar circumstances while neither being removed, nor being replaced with a shadow caret.
Using this method is better than EORing a block of colour, especially in the shaded selection case, where the anti-aliasing of the text is destroyed by an EOR operation. It also means that non-standard writable icons are catered for sensibly as well with no extra effort:
<P align='center'>
In the past, during writable icon redraws caused by scrolling of the icon (caused, for example, by repositioning of the caret), there has been a certain amount of flicker, both of the text, and of the caret itself, especially for large writable icons. This will be exaggerated substantially if the same technique is used to draw selections; to reduce flicker in both cases, a new algorithm will be written to deal with icon updates following caret / selection / ghost caret changes, utilising block copies wherever possible.
Below, the autoscrolling zone is cross-hatched; the autoscrolling pause zone is the intersection of the autoscrolling zone with the icon bounding box:
<P align='center'>
To work around this, separate checksums will be kept for the text of the icon currently containing the selection and the ghost caret. Each time an icon is redrawn, a new checksum is calculated, and if the checksum has changed, the selection or ghost caret will be removed. This is because the change to the text has probably invalidated the selected text anyway.
A variant on this approach will be used to fix the equivalent long-standing bug in the case of carets. One potential fix which we have to reject is to simply remove the caret when the text changes, because in many cases the application already has its own workaround whereby it reapplies the caret, so with each change of the text, the window's title bar would flicker due to losing and re-gaining the input focus. Instead, the Wimp will recalculate the caret position, assuming the same index into the string is required - unless the icon's numeric flag (icon flag bit 20) is set, in which the caret will be kept at the same index from the end of the string, to preserve the decimal place being edited. This way, future applications need not include the workaround at all.

Whether a dragbox is to be used or not, the representation is (of course) updated automatically by the Wimp to follow the pointer. The box, sprite or object must always keep the same position relative to the pointer's active point as the original bounding box did at the click that started the drag - except that in the special case of the "package" sprite, the sprite must always be centred over the pointer's active point.

While the task that technically owns the drag continues to be the sending task, the receiving task is responsible for drawing any ghost caret. Therefore the ghost caret position is only updated at each pass through the underlying message protocol, approximately four times a second. In order to prevent the sending task's dragbox or sprite from coexisting with the ghost caret, and thus cluttering the target area to an unnecessary extent, provision is made in the protocol for the receiving task to request that the drag be replaced with a "drag point" (type 7) drag for as long as the receiving task is displaying a ghost caret.
In textual documents, if during the drag, the pointer is positioned over the original selection, the ghost caret must not be displayed - the dragbox must be displayed instead. This is because dragging text inside itself has no meaning.
Drags to writable icons (including drags within the same icon) will use an I-beam ghost caret. The ghost-caret drawing facility of the Wimp will also be made available to applications, in order to ensure that all I-beam ghost carets are drawn to the same colour and design. The colour used will be the ColourTransed version of palette entry &80808000 (50.2% grey) in order to attain maximum contrast when EORed over every possible colour.
If the pointer is dragged over the autoscrolling zone (as defined in §4.1.3.2), the icon will be scrolled in order to let the ghost caret be positioned in an out-of-sight part of the icon. This will happen even if the selection fills the icon (meaning that the ghost caret cannot be positioned anywhere in the icon) because there would be no visual clues as to why the autoscrolling was not occurring in this case.
Window autoscrolling will not be initiated while the pointer is being dragged over a writable icon. However, if autoscrolling of the icon's window is already in progress and the pointer moves on to a writable icon, the ghost caret will not be placed in the writable icon.
| Message_ClaimEntity (&0000F) | |||||
| This message is broadcast by a task claiming the cut-and-paste / drag-and-drop caret, selection or clipboard. | |||||
| R1+12 | your_ref: 0 | ||||
| R1+20 | flags: | bit 0/1 set | => | caret or selection being claimed | |
| bit 2 set | => | clipboard being claimed (see §5.2.1) | |||
| all other bits are reserved and must be clear | |||||
| Wimp_SetCaretPosition (SWI &400D2) | ||||
| Set up the data for a new caret, ghost caret or selection position, and redraw it there. | ||||
| On entry | ||||
| To remove the caret / ghost caret / selection: | ||||
| R0 = | -1 | |||
| R2 = | "TASK" => | use bits 30 and 31 of R4 to determine which entity to remove, otherwise remove the caret | ||
| R3 = | flags | bits other than 30 and 31 reserved, must be zero | ||
To set a user caret / user ghost caret: | ||||
| R0 = | window handle | |||
| R1 = | -1 | |||
| R2 = | x-offset of caret / ghost caret, relative to work area origin | |||
| R3 = | y-offset of caret / ghost caret, relative to work area origin | |||
| R4 = | height of caret, and flags | |||
To set an icon caret, centred if possible, by known index into the string: | ||||
| R0 = | window handle | |||
| R1 = | icon handle | |||
| R4 = | -1 | |||
| R5 = | index of caret into string (must be >= 0) | |||
| or alternatively, if you wish to override the default Y position, size or flags: | ||||
| R0 = | window handle | |||
| R1 = | icon handle | |||
| R3 = | y-offset of caret, relative to work area origin | |||
| R4 = | height of caret, and flags (bits 28-31 all clear) | |||
| R5 = | index of caret into string (must be >= 0) | |||
To set an icon caret, centred if possible, by approximate current position on screen (note that if positioning the caret there causes the icon to scroll, the final caret position may be very different to the specified position): | ||||
| R0 = | window handle | |||
| R1 = | icon handle | |||
| R2 = | current x-offset of desired position, relative to work area origin | |||
| R3 = | current y-offset of desired position, relative to work area origin | |||
| R5 = | -1 | |||
To set an icon caret / icon ghost caret, not necessarily centred: * | ||||
| R0 = | window handle | |||
| R1 = | icon handle | |||
| R2 = | new value of caret scrollx | |||
| R3 = | 0 (reserved for future expansion) | |||
| R4 = | height of caret, and flags (bit 28 set, bit 30 set for ghost caret or clear for caret, bit 31 clear) | |||
| R5 = | index of caret into string (must be >= 0) | |||
To set an icon selection, centred if possible (or if the selection is wider than the icon, right-aligned within the icon): | ||||
| R0 = | window handle | |||
| R1 = | icon handle | |||
| R4 = | flags (bit 28 clear, bit 30 clear, bit 31 set) | |||
| R5 = | index of lower boundary into string | |||
| R6 = | index of upper boundary into string (no action is taken if R5 >= R6) | |||
To set an icon selection, not necessarily centred: * | ||||
| R0 = | window handle | |||
| R1 = | icon handle | |||
| R2 = | new value of selection scrollx | |||
| R3 = | 0 (reserved for future expansion) | |||
| R4 = | flags (bit 28 set, bit 30 clear, bit 31 set) | |||
| R5 = | index of lower boundary into string | |||
| R6 = | index of upper boundary into string (no action is taken if R5 >= R6) | |||
Flag bits 30/31 determine which entity the call refers to, and also affect the other flag bit meanings: | ||||
| Value | Entity | Bit(s) | Meaning (if one bit, then meaning when set) | |
| 0 | Caret | 0-15 | height in OS units (0-65535) | |
| 16-23 | colour (bits 20-23 ignored if a Wimp colour number) | |||
| 24 | use a Wimp-drawn caret rather than the Font Manager caret | |||
| 25 | do not draw the I-beam (caret is invisible) | |||
| 26 | use bits 16-23 for colour (else defaults to colour 11) | |||
| 27 | colour is a GCOL, otherwise a Wimp colour number | |||
| 28 | use both R2 and R5 to position the caret in an icon and override centring behaviour (internal use only, must be zero for external callers) | |||
| 29 | reserved, must be zero | |||
| 1 | Ghost caret | 0-15 | height in OS units (0-65535) | |
| 16-23 | not used; must be zero (palette entry &80808000 always used) | |||
| 24 | use a Wimp-drawn caret rather than the Font Manager caret | |||
| 25-27 | not used; must be zero (cannot be invisible, colour is fixed) | |||
| 28 | use both R2 and R5 to position the ghost caret in an icon and override centring behaviour (internal use only, must be zero for external callers) | |||
| 29 | reserved, must be zero | |||
| 2 | Selection | 0-25 | not used; must be zero (height and colour determined by icon properties and bit 26) | |
| 26 | use shaded selection colour scheme (also implies that the window containing the selection should not be awarded the input focus as the result of this call) | |||
| 27 | the window containing the selection should not be awarded the input focus, even if it is not shaded | |||
| 28 | use both R2 and R5/R6 to position the selection in an icon and override centring behaviour (internal use only, must be zero for external callers) | |||
| 29 | reserved, must be zero | |||
| 3 | Reserved | |||
| On exit | ||||
| R0-R5 are preserved, except that if R0 was -1 and R2 was "TASK" on entry, then R2 is set to zero on exit. | ||||
| The versions of the indexes into the string held internally, after an icon caret is positioned by index, will in future be restricted to the range { 0 <= index <= length } rather than just { index >= 0 }. This is essentially a bugfix, and will affect the values returned by Wimp_GetCaretPosition. | ||||
| Wimp_GetCaretPosition (SWI &400D3) | ||||
| Returns details of the state of the caret, ghost caret or writable icon selection. | ||||
| On entry | ||||
| R0 = | if R2 = "TASK", this is the entity to inspect (0 => caret, 1 => ghost caret, 2 => selection) | |||
| R1 -> | block to fill with entity state | |||
| R2 = | "TASK" => | fill block with state of entity specified by R0 and R3, else fill block with caret state | ||
| R3 = | if R0 = 2 and R2 = "TASK", this is either the handle of the window to inspect, or -1 to inspect the window which currently has the input focus and therefore also the only un-shaded selection | |||
| On exit | ||||
| R0 | corrupted | |||
| R1 | preserved | |||
| R2 = | 0 if it was "TASK" on entry | |||
| R3 | preserved | |||
If the caret or ghost caret state is being returned, the block is filled as follows: | ||||
| R1+0 | window handle (or -1 if there is no [ghost] caret) | |||
| R1+4 | icon handle (or -1 if a user [ghost] caret) | |||
| R1+8 | x-offset of [ghost] caret, relative to work area origin | |||
| R1+12 | y-offset of [ghost] caret, relative to work area origin | |||
| R1+16 | height of [ghost] caret and flags (bit 28 clear) | |||
| R1+20 | index of [ghost] caret into string (undefined if a user [ghost] caret) | |||
If the selection state is being returned, the block is filled as follows: | ||||
| R1+0 | window handle (or -1 if there is no writable icon selection) | |||
| R1+4 | icon handle (>= 0) | |||
| R1+8 | x-offset of lower boundary of selection, relative to work area origin | |||
| R1+12 | width of selection | |||
| R1+16 | y-offset of selection, relative to work area origin | |||
| R1+20 | height of selection and flags (bit 28 clear) | |||
| R1+24 | index of lower boundary into string | |||
| R1+28 | index of upper boundary into string | |||
| SWI Clipboard_Put (&4E000) | |||||
| Puts data on the clipboard, or initiates the data-send of a drop (see §5.4.2). | |||||
| On entry | |||||
| R0 = | flags: | bit 0 set | => | clear the clipboard (must be used when the application exits, unless another task has since claimed the clipboard using a Message_ClaimEntity 4) | |
| bit 1 set | => | do not store the data, just the data length (and the task handle) - when the data is required, the Clipboard will send the clipboard-owning task a Message_PutRequest stating the required data type, see §5.3.2 | |||
| bit 2 set | => | R1 is a pointer to a data type list, otherwise R1 is the data type | |||
| bit 31 set | => | flag reply messages as for the attention of the Wimp | |||
| all others are reserved and must be zero | |||||
| R1 = | depending on flags bit 2, either the data type (in bits 0-11), or a pointer to non-null list of data types that the task can translate the data to (in no particular order), terminated by -1 | ||||
| R2 = | pointer to data (if flags bit 1 is clear) | ||||
| R3 = | data length | ||||
| R4 = | pointer to proposed leafname of data, null-terminated | ||||
| R5 = | my_ref of Message_PutRequest which this is a reply to, or 0 if this isn't a reply | ||||
| On exit | |||||
| R0-R5 preserved | |||||
| The Clipboard broadcasts a Message_ClaimEntity 4 (unless the Clipboard owns the clipboard already), and takes a copy of the data, the leafname and the data type list, as appropriate. An error is generated if any of the pointers are invalid. | |||||
| Message_DataRequest (&00010) | |||||
| This message is broadcast by a task when it wishes to paste data from a clipboard maintained by another task. | |||||
| R1+12 | your_ref: 0 | ||||
| R1+20 | destination window handle | ||||
| R1+24 | internal handle to indicate destination of data; may be icon handle (see below) | ||||
| R1+28 | destination x co-ordinate | ||||
| R1+32 | destination y co-ordinate | ||||
| R1+36 | flags: | bit 2 set | => | send data from clipboard | |
| all other bits are reserved and must be clear | |||||
| R1+40 | list of data types in receiver's order of preference, terminated by -1 (may be null) | ||||
| SWI Clipboard_Get (&4E001) | |||||
| Requests data from the clipboard, using the Clipboard as a proxy. | |||||
| On entry | |||||
| R0 = | flags: | bit 31 set | => | flag reply messages as for the attention of the Wimp (this bit must only be set by the Wimp) | |
| all others are reserved and must be clear | |||||
| R1 = | destination window handle | ||||
| R2 = | destination icon handle (-1 if none) | ||||
| R3 = | destination x co-ordinate | ||||
| R4 = | destination y co-ordinate | ||||
| R5 = | pointer to list of data types that the task is interested in receiving, in order of preference, terminated by -1 (may be a null list if the native format is required) | ||||
| On exit | |||||
| R0-R5 preserved | |||||
| The Clipboard takes an internal copy of the data type list. If it owns the clipboard itself, it replies immediately with a Message_Paste. If a task has registered itself with the Clipboard using a bit-1-set SWI Clipboard_Put, the Clipboard sends a Message_PutRequest to the clipboard owner, and uses the data copied from the details in the following SWI Clipboard_Put to construct a Message_Paste. Alternatively, if a conventional drag-and-drop task owns the clipboard, the Clipboard will send a Message_DataRequest and handle all the Message_DataSave etc. messaging, before sending a Message_Paste to the pasting task, thus creating a uniform interface. | |||||
| Message_PutRequest (&4E000) | |||||
| This message requests that clipboard or selection data be sent to the Clipboard. | |||||
| R1+12 | your_ref: 0 | ||||
| R1+20 | flags: | bit 0 | => | flags bit 0 to use in Clipboard_Put | |
| bit 1 | => | flags bit 1 to use in Clipboard_Put | |||
| bit 2 | => | flags bit 2 to use in Clipboard_Put (note this also determines whether a single data type, or a data type list pointer is required in R3) | |||
| bit 3 set | => | send the clipboard (otherwise send the selection) | |||
| bit 4 set | => | delete the selection after sending the data | |||
| bit 31 set | => | message is for the attention of the Wimp, other tasks must ignore it | |||
| all others are reserved and must be clear | |||||
| R1+24 | destination window handle | ||||
| R1+28 | destination icon handle (-1 if none) | ||||
| R1+32 | destination x co-ordinate | ||||
| R1+36 | destination y co-ordinate | ||||
| R1+40 | pointer to list of data types that the destination task is interested in receiving, in order of preference, terminated by -1 (may be a null list if the native format is required) - now held in the Clipboard's workspace | ||||
| Message_Paste (&4E001) | |||||
| This message informs the task being pasted to or dropped upon that the data is ready to be received. | |||||
| R1+12 | your_ref: 0 | ||||
| R1+20 | flags: | bit 0 set | => | Clipboard couldn't find any clipboard after a Clipboard_Get call - take no further action | |
| bit 31 set | => | message is for the attention of the Wimp, other tasks must ignore it | |||
| all others are reserved and must be clear | |||||
| R1+24 | destination window handle | ||||
| R1+28 | destination icon handle (-1 if none) or internal handle if initiated by a Message_DataRequest | ||||
| R1+32 | destination x co-ordinate | ||||
| R1+36 | destination y co-ordinate | ||||
| R1+40 | data type | ||||
| R1+44 | pointer to data, or 0 if flag bit 0 set | ||||
| R1+48 | data length | ||||
| R1+52 | pointer to proposed leafname of data, null-terminated, or 0 if flag bit 0 set | ||||




In the fifth case, it is necessary for the Clipboard to ack the Message_DataRequest so that it doesn't bounce while the Message_PutRequest is delivered to the clipboard-owning task.
| SWI Clipboard_GetDataType (&4E002) | |||||
| Requests data type of the clipboard, using the Clipboard as a proxy. | |||||
| On entry | |||||
| R0 = | flags: | bit 31 set | => | flag reply messages as for the attention of the Wimp (this bit must only be set by the Wimp, even though there are currently no plans for it to do so at present) | |
| all others are reserved and must be clear | |||||
| R1 = | destination window handle | ||||
| R2 = | destination icon handle (-1 if none) | ||||
| R3 = | destination x co-ordinate | ||||
| R4 = | destination y co-ordinate | ||||
| R5 = | pointer to list of data types that the task is interested in receiving, in order of preference, terminated by -1 (may be a null list if the native format is required) | ||||
| On exit | |||||
| R0-R5 preserved | |||||
| The Clipboard takes an internal copy of the data type list. If it owns the clipboard itself, it replies immediately with a Message_DataTypeIs. If a task has registered itself with the Clipboard using a bit-1-set SWI Clipboard_Put, the Clipboard sends a Message_PutRequest to the clipboard owner, and uses the (single) data type returned in the following SWI Clipboard_Put to construct a Message_DataTypeIs. Alternatively, if a conventional drag-and-drop task owns the clipboard, the Clipboard will send a Message_DataRequest, but fail to reply to the subsequent Message_DataSave; the data type from the Message_DataSave is used in the Message_DataTypeIs, thus creating a uniform interface. | |||||
| Message_DataTypeIs (&4E002) | |||||
| This message informs a task of the data type of the clipboard (subject to the data type list passed to the preceding SWI Clipboard_GetDataType). | |||||
| R1+12 | your_ref: 0 | ||||
| R1+20 | flags: | bit 0 set | => | Clipboard couldn't find any clipboard after a Clipboard_GetDataType call | |
| bit 31 set | => | message is for the attention of the Wimp, other tasks must ignore it | |||
| all others are reserved and must be clear | |||||
| R1+24 | destination window handle | ||||
| R1+28 | destination icon handle (-1 if none) | ||||
| R1+32 | destination x co-ordinate | ||||
| R1+36 | destination y co-ordinate | ||||
| R1+40 | data type | ||||
| Message_Dragging (&00011) | |||||
| This message is sent by a sending task to a (prospective) claiming task at intervals of 0.25 second, carrying context-sensitive information about the drag. | |||||
| R1+12 | your_ref: my_ref of last Message_DragClaim (or 0 if there was no claimant last time, or if this is the first Message_Dragging) | ||||
| R1+20 | destination window handle (constructed from Wimp_GetPointerInfo) | ||||
| R1+24 | destination icon handle (constructed from Wimp_GetPointerInfo) | ||||
| R1+28 | destination x co-ordinate (constructed from Wimp_GetPointerInfo) | ||||
| R1+32 | destination y co-ordinate (constructed from Wimp_GetPointerInfo) | ||||
| R1+36 | flags: | bit 1 set | => | sending data from selection (for information only, receiver must ignore) | |
| bit 2 set | => | sending data from clipboard - i.e. from a clipboard-displaying window (for information only, receiver must ignore) | |||
| bit 3 set | => | source data will be deleted (for information only, and unfortunately is incorrect when generated by DataPower; receiver must ignore) | |||
| bit 4 set | => | drag is being aborted, do not respond to this message | |||
| all other bits are reserved and must be clear | |||||
| R1+40 | xmin, ymin, xmax, ymax (4 bytes each): bounding box of data, relative to pointer, measured in millipoints (1/72000th of an inch), not scaled according to the zoom factor(s) of the source window; xmin > xmax means data has no bounding box, or bounding box is unknown | ||||
| R1+56 | list of available data types in no particular order, terminated by -1 (must not be null) | ||||
| Message_DragClaim (&00012) | |||||
| This message is sent by a claiming task to the sending task in response to a Message_Dragging, carrying context-sensitive information about the drag. It must only be issued if the claiming task is interested in at least one available data type. | |||||
| R1+12 | your_ref: my_ref of last Message_Dragging | ||||
| R1+20 | flags: | bit 0 set | => | a pointer shape other than ptr_drop is in use | |
| bit 1 set | => | claiming task requires the absence of the Wimp dragbox / DragASprite sprite / DragAnObject object | |||
| bit 3 set | => | claiming task is a trashcan application, so the source data must be deleted irrespective of Message_Dragging's flags bit 3 (else deletion of the source data is determined by sending task) | |||
| all other bits are reserved and must be clear | |||||
| R1+24 | list of available data types in receiver's order of preference, terminated by -1 (may be null) | ||||
| SWI Clipboard_StartDrag (&4E003) | |||||
| Starts a drag-and-drop drag, using the Clipboard as a proxy. | |||||
| On entry | |||||
| R0 = | flags: | bit 1 | => | as Message_Dragging (= sending from selection) | |
| bit 2 | => | as Message_Dragging (= sending from clipboard) | |||
| bits 14, 15 | 0 | => use rotating-dash fixed-size Wimp dragbox | |||
| 1 | => use DragASprite | ||||
| 2 | => use DragAnObject | ||||
| 3 | => reserved | ||||
| bit 16 | => | as DragAnObject_Start, if applicable (R1 is a pointer to a routine rather than a SWI number) | |||
| bit 17 | => | as DragAnObject_Start, if applicable (if bit 16 is set and bit 18 clear, enter routine with R10 below R13 - note this was previously misdocumented as the routine being entered in SVC mode rather than USR mode) | |||
| bit 18 | => | as DragAnObject_Start, if applicable (if bit 16 is set and DragAnObject is version 0.09 or later, enter routine in USR mode rather than SVC mode) | |||
| bit 31 set | => | flag reply messages as for the attention of the Wimp (this bit must only be set by the Wimp) | |||
| all others are reserved and must be clear | |||||
| R1 = | sprite area or renderer (if DragASprite or DragAnObject, respectively) | ||||
| R2 = | pointer to sprite name or register/parameter block (if DragASprite or DragAnObject, respectively) | ||||
| R3 = | source window handle (used in combination with the Shift key state to determine when the source data needs deleting afterwards) | ||||
| R4 = | pointer to word-aligned block containing three bounding boxes, each made up of four 32-bit quantities held in the order xmin, ymin, xmax, ymax, where the minima are inclusive and the maxima are exclusive:
<OL>
| ||||
| R5 = | data length, bytes | ||||
| R6 = | pointer to non-null list of data types that the task can translate the data to (in no particular order), terminated by -1 | ||||
| R7 = | pointer to proposed leafname of data, null-terminated | ||||
| On exit | |||||
| R0-R7 preserved | |||||
| The Clipboard takes a copy of the data pointed to, and performs the actions described in §5.4.1.3 (sending) on behalf of the task. In order to achieve this, it forces the required Wimp events to be unmasked using a pre-poll filter, then performs its main actions using a post-poll filter; it also calls Wimp_AddMessages, so it not necessary for the task to register interest in Message_DragClaim etc. at initialisation. During the drag, the task will not see any user_drag_box events, key_pressed events (except for Escape), or any DragClaim, RAMFetch, DataSaveAck or DataLoadAck messages. If null events were enabled in the poll mask before it was massaged by the pre-poll filter (and, if it was a call to Wimp_PollIdle, the required time has passed) they will also pass through to the task once the post-poll filter has done its work. | |||||
| When the drag ends (successfully or not), the filters are removed. When the drag ends successfully, the task's cooperation is required in order to translate the data to the required data type; this is accomplished by the Clipboard sending it a Message_PutRequest with flags bit 3 clear, as described in §5.3.2.1. | |||||
| SWI Clipboard_CatchDrop (&4E004) | |||||
| Request the Clipboard to act as a proxy for data transfer during a drop. | |||||
| On entry | |||||
| R0 = | flags: | bit 31 set | => | flag reply messages as for the attention of the Wimp (this bit must only be set by the Wimp) | |
| all others are reserved and must be clear | |||||
| R1 = | pointer to DataSave message block (or DataLoad message block if initiated by the Filer) that needs replying to | ||||
| On exit | |||||
| R0-R1 preserved | |||||
| The Clipboard handles the data transfer for the task, trying memory data transfer first if possible. When the transfer is complete, the Clipboard sends a Message_Paste to the task that called this SWI, so as to appear identical to a paste operation. | |||||
| It will also detect if it sent the DataSave message itself - in other words, if the sending task was using the Clipboard as a proxy too - if so, no further messaging will occur, and the Clipboard will simply use the pointer to its copy of the data made during Clipboard_Put in the Message_Paste. | |||||
| AND conj. | Logical AND. |
| Caret n. | The position in a document where typed characters or pasted clipboard contents will be placed. Many pre-drag-and-drop applications also use this position as the insertion point for dropped data, but drag-and-drop applications must use the ghost caret for this purpose instead. In textual documents, the caret is often shown by a red I-beam, but other representations of the caret may be more appropriate for other kinds of data. Some editors, such as !Draw, do not have a visible insertion point, but still "grab the caret" and mark it as invisible, in order to gain the input focus so that they may receive keystroke events. |
| Clear v. | The operation by which a selection is undone. |
| Clipboard n. | A hidden, temporary storage area that holds any type of data while the user is copying or moving it using the cut-and-paste protocol, whether internal to one application, or between applications. Conceptually, there is only one clipboard, but the actual storage area may actually be managed by different applications or modules, depending upon the circumstances. |
| The term may also be used to refer to the Clipboard module, although in this eventuality, the initial letter will be in upper case. | |
| Copy v. | The operation by which the current selection is replicated in the clipboard, overwriting any existing data in the clipboard. |
| Cut v. | As copy, but the selection is subsequently deleted from its original location. |
| Data type n. | A value equivalent to a filetype, but not necessarily referring to a file. |
| Drag v. | The operation by which the user indicates where they wish a selection to be copied or moved to by dragging a representation of the data from the selection to the destination. |
| Drop v. | At the end of a drag, the actual data transfer process. This combines the functionality of a paste operation with either a cut or copy operation, as appropriate. |
| Ghost caret n. | During a drag operation, the position in a document where the data would be inserted, were the user to release the mouse button. In textual documents, the ghost caret is often shown similarly to a normal caret, but coloured grey, and "snapped" to the nearest character boundary. Other documents might better display the ghost caret as the bounding box of the data, scaled according to the destination window's zoom factor(s). |
| OR conj. | Logical inclusive OR (i.e. not EOR) - used where the 'or' would have an ambiguous meaning, for example in English text. |
| Input focus n. | The defining attribute of the window where keystroke events will be delivered. The user may be able to see a caret or a selection, or possibly neither, in the window that has the input focus; the window border will be coloured in an alternative colour (conventionally cream). Any parent nested windows (recursively), and any non-pane window behind a pane window, will also have their title bars recoloured. |
| Paste v. | The operation that the user performs to copy the clipboard contents into a document, at the caret. |
| Selection n. | The portion of a document which the user has chosen as the target for subsequent operations. This may be a contiguous selection (as in the case of selected text) or a non-contiguous selection (as in the case of a number of selected files in the Filer). The rendering of the selection is media-dependent, but typically may be shown by inversion of the colours of the selected region, or alternatively by the drawing of a bounding box around the selection(s). |
| A shaded selection, which ought be rendered to match the Wimp's rendering of shaded selections in writable icons, indicates the location of a selection after another selection has been made in another window - but not when a caret or selection is made in a non-drag-and-drop application. | |
| Shadow caret n. | The equivalent of a shaded selection, but for carets. A shadow caret must not be rendered in such a way that it can be mistaken for a ghost caret. It is optional, because applications are expected normally to use a Wimp-drawn caret, and the Wimp does not support shadow carets. However, shadow carets can be useful, especially if the application draws its own caret anyway (as, for example, if an I-beam is an unsuitable), because they fix an insertion point for a drop, whenever one or both of the sending and receiving tasks uses pre-drag-and-drop data transfer protocol. The shadow caret is also the position to which the caret will be returned if the user Adjust-clicks on the window, or clicks in a "dead" region of the window, such as a page border; this is particularly useful in cases where repositioning the caret would be time-consuming or fiddly, for example if the caret is in a deep "layer" of a document. </TBODY> |
| Revision | Who | Date | Comment |
| A (aka 0.00) | BJGA | 12-09-1997 | Started |
| B (aka 0.01) | BJGA | 13-10-1997 | First release for comment |
| C (aka 0.02) | BJGA | 14-10-1997 | Released for review |
| D | BJGA | 19-05-1998 | Prepared for D.O. |
| E | BJGA | 26-02-1999 | Started reworking document for Java 1.2 project, didn't get far before cancelled again |
| F | BJGA | 16-10-2007 | Finally finished integrating the Ursula review comments and 8 years' worth of mental notes, for initial release alongside shared source code |