On Thu, Mar 23, 2023 at 1:05 PM Eliot Miranda <eliot.miranda@gmail.com> wrote:


On Thu, Mar 23, 2023 at 11:40 AM Hilaire Fernandes <hfern@free.fr> wrote:
 

Hi,

I want to copy to the OS clipboard DrGeo sketch as SVG image.

The clipboard in the image is only for text. I read about Extented Clipboard (Mac OSX) plugin to manage other type of data. I was told the plugin also existed for Linux at some time (when Sophie was developed). Is it possible to retrieve it?


As John said it doesn't appear to exist for Linux.  But X11 has a clipboard and implementing the innards for X11 shouldn't be that difficult.  The only complication is that if one wants to do the job "properly" one has to extend the indirection scheme Ian Piumarta came up with so that it can work on the other graphical back-ends such as the raw frame buffer.  Hillaire, if you're interested in implementing the X11 ExtendedClipboard internals I'm happy to answer any questions you have.

Just a little bit about what I'm trying to do:

We use the ClipboardExtendedPlugin to bring in data to Virtend, in particular images, filenames, and text.  I love to be able to paste Shout-styled text into email and currently that's difficult:
1. select some styled text
2. use the "copy as html" menu item
3. paste the HTML text into a file called 'foo.html'
4. open the file in a web browser
5. select the text in the web browser

So I'm making sure that the plugin can paste multiple forms of text.  Currently on Mac I have the following (a variation of which I just used to paste the following) 
[| text styledText htmlText |
text := (Text sourceCodeAt: #printHtmlString) asText.
styledText := SHTextStylerST80 new parseAMethod: true; styledTextFor: text.
htmlText := styledText printHtmlString.
"If one does only the addClipboardData:...dataFormat: 'public.html' then Safari pastes styled text correctly.
Do both that and addClipboardData: ... dataFormat: 'public.text' and Safari pastes plain text.
So the plugin is doing damage using declareTypes: every time. It needs to augment the types."

ExtendedClipboardInterface current
    
clearClipboard;
    
addClipboardData: '<meta charset="UTF-8">', htmlText asString dataFormat: 'public.html';
    
addClipboardData: (UTF8TextConverter new encodeString: text asString) dataFormat: 'public.utf8-plain-text'].

So the Mac plugin primitives don't yet support being able to paste multiple alternatives in a series of invocations.  I could implement an interface that takes multiple alternatives in a single primitive invocation, but I think John's design intent is better; one should be able to use a sequence of invocations, each of which adds to the clipboard.  So I'm trying to get that to work right now.  I'm working on MacOS and Windows to make sure that things work there.  I'm not working on Linux cuz there's no there there yet ;-)

Ah, that was easy.  Use addTypes:owner: instead of declareTypes:owner: (in the Mac Objective-C innards) and the Mac works.  Now Windows...

Thanks

Hilaire

-- 
GNU Dr. Geo
http://drgeo.eu
http://blog.drgeo.eu


--
_,,,^..^,,,_
best, Eliot


--
_,,,^..^,,,_
best, Eliot