questions about primary selections in Abiword

Justin Bradford (justin@ukans.edu)
Sun, 8 Aug 1999 06:12:02 -0500 (CDT)


I want to implement the primary selections now.
Several of the steps are pretty obvious, such as using the Listener
interface to get notifications concerning the current Abiword selection.
And then pasting looks like it should be done by adding the appropriate
lines to the binding code.

As for the actual code doing the work, I kind of want to minimize changes
to the rest of Abiword's code, as well as try to avoid duplicating
code.

If I were to do it right now, this would be the implementation:
add code to the unix wp init function which causes the creation of a
second specialized clipboard (using the PRIMARY atom). As part of this
second clipboad, it would create a simple view listener. The view listener
would simply tell clipboard #2 that there either is/isn't something
selected, and the clipboard would get/release the clipboard as
appropriate. No data would actually be passed at this point. However, the
clipboard would need to know which formats to advertise...
Then, if some app pastes our selection, I just call the "region" exporter
corresponding to the requested format (passing the current selection
bounds, just like the copy function currently does).
The paste function would be tied to the mouse click, via the event binding
stuff, and would basically duplicate the current pasteFromClipboard
function.

This wouldn't be a bad implementation, but it bothers me that I
have to duplicate the paste/copy functions. Perhaps if the second set of
copy/paste are in the same class/file as the original? That would be more
maintainable, I think, and my listener could just call the paste, which
calls the second clipboard with the formats to advertise.
Sound ok?

Also, if someone can give me a quick intro to the binding stuff. I get
the basic format, except I can't tell if I'm supposed to specify the
function handler there or not. I could never find an example.

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?

Justin



This archive was generated by hypermail 1.03b2.