Next: , Previous: Properties, Up: Kernel



6.6 Clipboard

To enable Copy & Paste operations, the VRR kernel implements a clipboard. The clipboard is a regular page tlo_clipboard which is linked in the zombie and for which a reference is kept. The GUI even enables the user to edit the clipboard contents. When some objects are copied into the clipboard, they are selected; and when the clipboard contents are to be pasted into another page, only the selected ones are pasted.

The most important clipboard functions are clipboard_duplicate_go and clipboard_copy_selected_go.

clipboard_copy_selected_go

     void clipboard_copy_selected_go(struct go_group *source,
                   struct go_group *target, struct go *after,
                   uns reversed)

This function copies all selected GOs from the source group into the target group. The created GOs are linked after the after GO. If reversed is zero then created objects are linked in same order as they are in source. Otherwise, they are linked in the reversed order.

The clipboard_copy_selected_go function must be called in a transaction on the target's page and the topological sort must be passive is both pages. The source and target pages must be different.

     struct go* clipboard_duplicate_go(struct go *original)

This function receives a graphics object original and creates and returns its duplicate.

     void clipboard_paste(struct go_group *target, struct go *after,
                          uns reversed)

This function pastes the contents of the clipboard into the target group. It just calls clipboard_copy_selected_go.

     uns clipboard_copy(struct go_group *source, const char* name_trans,
                        char* error_string, uns reversed)

This function copies the selected GOs in the source page into the clipboard. This function only removes all the previous contents of the clipboard and calls clipboard_copy_selected_go. It must be called in a transaction on the source page.

     void clipboard_cut(struct go_group *source, uns reversed)

This function moves the selected GOs from the source page into the clipboard. Because of the locality of undo histories, the GOs cannot be moved between pages directly; instead, the function copies the selected content of the source page into the clipboard and the original GOs are removed.