From: Daniel J S. <dan...@ie...> - 2006-07-16 21:25:45
|
I've been messing around with the clipboard a bit for the X11 term and understand things fairly well now. Anyway, I've just got to thinking, maybe the true power in a clipboard is not in the X11 term window, but in the X11 window associated with the gnuplot command line. Take for example what Abiword is sending to the X11 term window plot when I type CNTRL-V in Abiword. In the list you will see png, jpeg, tiff, gif, etc. selection request: text/rtf (421) for CLIPBOARD (377) selection request: application/rtf (423) for CLIPBOARD (377) selection request: image/png (424) for CLIPBOARD (377) selection request: image/jpeg (425) for CLIPBOARD (377) selection request: image/tiff (426) for CLIPBOARD (377) selection request: image/gif (427) for CLIPBOARD (377) selection request: image/bmp (428) for CLIPBOARD (377) selection request: image/x-xbitmap (429) for CLIPBOARD (377) selection request: image/x-xpixmap (430) for CLIPBOARD (377) selection request: image/x-portable-anymap (431) for CLIPBOARD (377) selection request: image/x-portable-pixmap (432) for CLIPBOARD (377) selection request: image/x-portable-graymap (433) for CLIPBOARD (377) selection request: image/vnd.wap.wbmp (434) for CLIPBOARD (377) selection request: image/x-cmu-raster (435) for CLIPBOARD (377) selection request: image/x-wmf (436) for CLIPBOARD (377) selection request: image/svg (437) for CLIPBOARD (377) selection request: image/svg+xml (438) for CLIPBOARD (377) selection request: UTF8_STRING (230) for CLIPBOARD (377) selection request: COMPOUND_TEXT (257) for CLIPBOARD (377) selection request: STRING (31) for CLIPBOARD (377) selection request: text/html (439) for CLIPBOARD (377) selection request: application/xhtml+xml (440) for CLIPBOARD (377) I believe I saw on the web that the above target strings are part of some quasi standard somewhere. Well, consider we do the following. Say we have a special output "file" which basically stores things internally. gnuplot> set term png gnuplot> set output clipboard Or, we could also just store the contents internally automatically any time an output plot is created. Now that I see how the X11 term works, it would be easy to configure this so that gnuplot knows to indicate to the client "image/png", "image/jpeg", etc. based upon the most recent terminal type. And to properly send a "None" if the current clipboarded plot format does not match what the client is asking for. I think that would be cool. Just plot in any format and if your word processor doesn't understand that one, try another. The X11 mousing is convenient for quick copy and that sort of thing, but again maybe adding a clipboard to the command line window is the real deal here. Dan PS: BTW, could we add some more flexibility to the terminal function "set_clipboard"? I mean, it only has a text string as an input so one can interpret a null string as meaning it should store a Pixmap instead of a text string. However, there is no way to indicate if this should go to CLIPBOARD or PRIMARY or whether to do clear or fill (i.e., cut/paste). I know set_clipboard() is generic and there may be some restrictions on generality, but we shouldn't limit future use. I don't know, something like set_clipboard(int destination, int action, char *text) clipboard #<destination> action <fill> / <clear> text <non-null the text> / <null, the internal pixmap> And the destination will be open to interpretation for the terminal type. In X11, 1 might mean PRIMARY, 2 might mean CLIPBOARD, 3 might mean SECONDARY (or nothing), any other number means CLIPBOARD. In Windows, maybe all numbers are mapped to the same thing, the clipboard. It's always easier to limit things from the mouse.c side of things, or have term options, than it is to try adding functionality at a later time. |