Chapter 5. Data Exchange on the IRIX Interactive Desktop

The IRIX Interactive Desktop enables users to transfer data between applications. There are two types of transfers from the user's point of view. Copy takes data specified in the source application and creates a duplicate in the destination application. Move removes the data specified in the source application and places it in the destination application. The source and destination applications can be the same application.

This chapter covers the following topics:

Supporting the Clipboard Transfer Model

In the clipboard transfer model, users move or copy a selection using the “Cut,” “Copy,” and “Paste” entries from the Edit menu. If your application contains data that users will want to transfer to other applications or across separate instantiations of your application, your application should support the clipboard transfer model described in this section. Note that this model is a subset of the clipboard transfer model described in Section 4.3 of the OSF/Motif Style Guide. For information on implementing clipboard transfer, see "Implementing the Clipboard Transfer Model" in Chapter 7, “Interapplication Data Exchange,” of the IRIX Interactive Desktop Integration Guide. For more information on the layout of the Edit menu, the behaviors of each entry, and keyboard accelerators, see “Edit Menu” in Chapter 8.

In a typical clipboard transfer, the user selects data in an application window and initiates a move or copy transfer operation by choosing “Cut” or “Copy” from the window's Edit menu. The source application then takes ownership of the clipboard atom replacing the prior owner (if there was one). The user completes the transfer by choosing “Paste” from the Edit menu in the destination application. The destination application then moves or copies the data associated with the clipboard to this destination. When the transfer is complete, the newly pasted data is not selected or highlighted. For more information on selection techniques, see “Selection” in Chapter 7.

Note that clipboard data is nonpersistent. If a user quits the application that currently owns the clipboard, the data associated with the clipboard atom is lost. Only one application can own the clipboard atom at any given time. For persistent media storage use the IRIX Interactive Desktop MediaWarehouse. For more information, see the IRIX Interactive Desktop MediaWarehouse User's Guide.

Figure 5-1 illustrates clipboard transfer using the SoundEditor application. In the figure, there are two instantiations of the application; the window on the left is the source and the one on the right is the destination. Note that the clipboard atom in the figure is only a representation and doesn't actually appear. In this example, the user selects a region of sound in the source window and chooses “Copy” from the Edit menu in that window. The source instantiation of SoundEditor takes ownership of the clipboard atom. When the user chooses “Paste” from the Edit menu in the destination window, the data associated with the clipboard is inserted into the destination sound file at the insertion cursor (the vertical black line). Note that after the “Paste” operation, the SoundEditor application doesn't select or highlight the newly pasted data.

Figure 5-1. Clipboard Transfer Example

Figure 5-1 Clipboard Transfer Example

The clipboard operates independently of the primary selection described in the next section, “Supporting the Primary Transfer Model.” When a user chooses “Cut” or “Copy” from an Edit menu, that application takes ownership of the clipboard but the primary selection remains unchanged.

Supporting the Primary Transfer Model

In the primary transfer model, users select the data for transfer using the left mouse button and copy the data to the destination application using the middle mouse button. If your application contains data that users will want to transfer to other applications or across separate instantiations of your application, your application should support the primary transfer model described in this section. Note that this model is a subset of the primary transfer model described in Section 4.3 of the OSF/Motif Style Guide. For information on implementing primary transfer, see "Implementing the Primary Transfer Model" in Chapter 7, “Interapplication Data Exchange,” of the IRIX Interactive Desktop Integration Guide.

In the primary transfer model, when a user begins a selection in an application, that application takes ownership of the primary selection atom, replacing the previous owner if there was one. This selection is referred to as the primary selection. The user can then copy the primary selection to a destination application by moving the pointer to the destination window (making it the active window) and clicking the middle mouse button. At this point, the destination application copies the primary selection data to this destination. Note that the data is pasted at the position of the pointer, not at the insertion cursor. Also note that when the copy is complete, the newly pasted data isn't selected or highlighted. For more information on selection techniques, see “Selection” in Chapter 7.

Figure 5-2 through Figure 5-3 illustrate primary selection and transfer using the SoundEditor application. Figure 5-2 illustrates making a primary selection. The user creates a selection by dragging with the left mouse button across a range of sound data. As soon as the user begins this selection, SoundEditor takes ownership of the primary selection atom. This selection is then referred to as the primary selection.

Figure 5-2. Primary Selection Example

Figure 5-2 Primary Selection Example

Figure 5-3 shows the source and destination windows just prior to a primary transfer. Figure 5-4 shows the source and destination windows after the transfer. Note that when the user clicks the middle mouse button, the primary selection is inserted at the pointer location rather than at the insertion cursor. Also note that after the transfer operation, the SoundEditor application doesn't select or highlight the newly pasted data and the primary selection doesn't change.

Figure 5-3. Primary Transfer Example: Before Transfer

Figure 5-3 Primary Transfer Example: Before Transfer

Figure 5-4. Primary Transfer Example: After Transfer

Figure 5-4 Primary Transfer Example: After Transfer

In general, when your application loses the primary selection, it should keep its current selection highlighted. When a user has selections highlighted in more than one window at a time, the most recent selection is always the primary selection. This is consistent with the persistent always selection model discussed in Section 4.2 in the OSF/Motif Style Guide. Exceptions to this guideline are those applications that use selection only for primary transfer—for example, the winterm Unix shell window. The only reason for users to select text in a shell window is to transfer that text using the primary transfer mechanism. In this case, when the winterm window loses the primary selection, the highlighting is removed. This is referred to as nonpersistent selection in Section 4.2 in the OSF/Motif Style Guide. For guidelines on selection in general, see “Selection” in Chapter 7.

If the user returns the keyboard focus to a window with a highlighted, superseded primary selection, the application should allow the user to reinstate the highlighted selection as the primary selection by pressing <Alt-Insert>. In addition to supporting this key combination, you can also add the entry “Promote” to the Edit menu for the application window. Make the “Promote” menu entry active only when your application has a selection which is not the primary selection. (For details of placing this item in the Edit menu, see “Edit Menu” in Chapter 8.)

Note that when a user begins to modify a selection, such as adding elements to it, it's considered to be a new selection. In this case, your application needs to reassert ownership of the primary selection if your application doesn't currently own it.

The primary selection operates independently of the clipboard, as described in the previous section, “Supporting the Clipboard Transfer Model.” When the user makes a selection, that selection becomes the primary selection—there's no effect on the contents of the clipboard.

Data Types Supported for Inter-Application Transfer

Applications can use the atom names for both clipboard and primary transfer of the corresponding types of data. A few atom names are listed in Table 5-1; the tables in Chapter 7, “Interapplication Data Exchange,” in the IRIX Interactive Desktop Integration Guide provide a complete list. If you want users to be able to transfer data from your application to other applications, you need to be able to export the data. If your application is to receive data from other applications, it must be able to import the data. For complete details of implementing both clipboard and primary data transfer, see Chapter 7, “Interapplication Data Exchange,” in the IRIX Interactive Desktop Integration Guide.

Table 5-1. Data Types Supported for Inter-Application Transfer

Target Format Atom Name

Nature of Data

What Target Receives

Receiving Application Requirements

INVENTOR

3D, generated by Inventor

Inventor data (Scene Graph)

Ability to read Inventor data

_SGI_RGB_IMAGE_FILENAME

color image in rgb format

rgb file name

Ability to use rgb files

_SGI_RGB_IMAGE

color image in rgb format

stream of rgb data

Ability to use rgb files

_SGI_AUDIO_FILENAME

sound data

audio file name

SGI audio file library libaudiofile

_SGI_AUDIO

sound data

stream of audio data

SGI audio file library libaudiofile

_SGI_MOVIE_FILENAME

movie data

movie file name

SGI Movie library libmovie

_SGI_MOVIE

movie data

stream of movie data

SGI Movie library libmovie

STRING

text encoded as ISO
Latin 1

textual data

Ability to read text encoded as ISO Latin 1

COMPOUND_TEXT

compound text

textual data formatted as compound text

Ability to read compound text


Data Exchange Guidelines

If your application contains data that users may wish to transfer to other applications or across separate instantiations of your application . . .

  • Support the Clipboard Transfer Model using the “Cut,” “Copy,” and “Paste” entries in the Edit menu. In this model, the clipboard is a global entity that's shared by all applications. Your application shouldn't use these entries to refer to a clipboard that's private to your application.

  • When supporting the Clipboard Transfer Model, don't select or highlight newly pasted data after a “Paste” operation.

  • Support the Primary Transfer Model. Assert ownership of the primary selection when the user begins to make a selection. Insert data at the location of the pointer when the user clicks the middle mouse button (which isn't necessarily at the insertion cursor).

  • When supporting the Primary Transfer Model, don't select or highlight newly transferred data after a transfer operation.

  • Use persistent always selection highlighting (keep the current selection highlighted even when your application loses the primary selection), unless the only action that can be performed on the selection is to copy the data using primary data transfer. In this case, use nonpersistent selection highlighting—that is, remove the selection highlight when the selection is no longer the primary selection.

  • When supporting the Primary Transfer Model, if the current active window has a selection that isn't the primary selection, reinstate this selection as the primary selection if the user presses <Alt-Insert>. Additionally, you can include a “Promote” entry in the Edit menu to perform the same function.

  • When supporting the Primary Transfer Model, when the user begins to modify a selection, such as adding elements to it, reassert ownership of the primary selection if your application does not currently own it.

  • When supporting both Clipboard Transfer and Primary Transfer, keep the primary selection independent from the clipboard. When the user begins to make a selection in your application, assert ownership of the primary selection but do not change the ownership of the clipboard. When the user chooses “Cut” or “Copy” from an Edit menu in your application, assert ownership of the clipboard but do not change the ownership of the primary selection.