Re: Issue 2125 in pharo: ExternalDropHandler initialize

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: Issue 2125 in pharo: ExternalDropHandler initialize

pharo

Comment #2 on issue 2125 by [hidden email]: ExternalDropHandler  
initialize
http://code.google.com/p/pharo/issues/detail?id=2125

I started to do this and ran into this question...

There are two implementations of the default image handler. One is  
ExternalDropHandler class>>defaultImageHandler, the other is in  
ExternalDropHandler class>>registerStandardExternalDropHandlers.

The difference boils down to the last parameter to ExternalDropHandler  
class>>type:extension:action:

In #defaultImageHandler...
        [:stream :pasteUp :event | | image sketch |
                stream binary.
                image := Form fromBinaryStream: ((RWBinaryOrTextStream with: stream  
contents) reset).
                sketch := World drawingClass withForm: image.
                pasteUp addMorph: sketch centeredNear: event position.
                image := sketch := nil]

In registerStandardExternalDropHandlers (temporaries extracted to highlight  
difference)
        [:stream :pasteUp :event | | image sketch |
                image := Form fromBinaryStream: stream binary.
                sketch := World drawingClass withForm: image.
                pasteUp addMorph: sketch centeredNear: event position]

Which version should we choose? Marcus wrote #defaultImageHandler.


_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker