> Anyway, I can do this tomorrow. And since there are more involved changes > to existing code, do you guys (abisource people) want me to mail you > patches (so you can decide whether you like my implementation) or commit > it directly? Ok, nevermind. I can't figure out a way to do this that is not ugly. Simply, the Abiword framework is designed expecting one system clipboard. My current, partial implementation is taking the following approach (none of this has been committed): The unix clipboard has been modified to just store a pointer if the length of the dataput on the clipboard <= 0. Then, all the functions which have to access said data call a function to convert the current selection to the requested format (the passed poitner is to the current doc). This requires a new function in UnixApp which formats a specified doc range on demand to the specified format (basically duplicating the code in copyToClipboard, but behaves differently). Then, a new pair of copy/paste functions have to be added to UnixApp (such as copy/pasteTo/FromSelection. The paste behaves nearly identically to the pasteFromClipboard (just uses a different clipboard) but the copy adds the appropriate data formats with the data being a pointer to the document. Then, I write a listener which looks for changes in the selection, and calls the copyToSelection if a region is selected, or clears the selection clipboard if the selection is empty. Then, I write a function (which is somehow bound to middle mouse button) which calls the pasteFromSelection. The above method only does selection conversion at paste-time. Now, if we don't mind actually converting the selection and really populating the second clipboard every time a block of text is highlighted, then we can simply things substantially. I can resuse all of the existing copy/paste code, by swapping the application's clipboard pointer around. This would require no changes to the unix clipboard or UnixApp (besides allocating a second clipboard), and only require the listener and the middle button event function, which would basically consist of: mClipboard = mSelectionClipboard; cmdCopy(); // or cmdPaste(); mClipboard = mRealClipboard; I don't know if this would hurt performance greatly, but it still kind of annoys me. Anyone have ideas? Is the first method adequate? It really doesn't duplicate that much code... Anyway, I guess we can discuss this over some slashdot-funded beer tomorrow ;) justin
