Re: tiffs on pasteboard

2009-11-20 Thread Alexander Spohr

Am 20.11.2009 um 03:04 schrieb Chris Idou:

 But what are the rules and conventions? Why would Finder put the icon in the 
 pasteboard on the assumption that is what the user wants, but TextEdit would 
 paste in the actual file on the assumption that is what the user wants? It 
 seems schizophrenic.

Yeah. Copying a 20MB image to the pasteboard would be what the user wants. Or 
better one Gig of video. I think not.
You think like a user (who would assume that the file is really on the 
pasteboard) and not like a developer (who should know that the pasteboard 
content has to be lightweight).

 I just want a list of rules of how to use the Pasteboard in a way that 
 conforms to what users expect. If I start ignoring the TIFF part of the 
 pasteboard in favor of the URL on the assumption that is what the user wants, 
 why is the tiff there anyway?

The TIFF is a preview. The URL is the meat.

 And will that get me into trouble in other cases?

That depends only on the pasteboard provider. There is no strict rule. The 
provider does not know the recipient and therefore puts everything on the 
pasteboard that will satisfy the task the provider offers.

atze

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: tiffs on pasteboard

2009-11-20 Thread Chris Idou



I thought the solution to big files was to use pasteboard promises... not to 
setup a pasteboard which is  conflicted about what item it is trying to store. 
At least that's what I find documented by Apple.





From: Alexander Spohr a...@freeport.de
To: Chris Idou idou...@yahoo.com
Cc: Jens Alfke j...@mooseyard.com; cocoa-dev@lists.apple.com
Sent: Fri, 20 November, 2009 7:00:18 PM
Subject: Re: tiffs on pasteboard


Am 20.11.2009 um 03:04 schrieb Chris Idou:

 But what are the rules and conventions? Why would Finder put the icon in the 
 pasteboard on the assumption that is what the user wants, but TextEdit would 
 paste in the actual file on the assumption that is what the user wants? It 
 seems schizophrenic.

Yeah. Copying a 20MB image to the pasteboard would be what the user wants. Or 
better one Gig of video. I think not.
You think like a user (who would assume that the file is really on the 
pasteboard) and not like a developer (who should know that the pasteboard 
content has to be lightweight).

 I just want a list of rules of how to use the Pasteboard in a way that 
 conforms to what users expect. If I start ignoring the TIFF part of the 
 pasteboard in favor of the URL on the assumption that is what the user wants, 
 why is the tiff there anyway?

The TIFF is a preview. The URL is the meat.

 And will that get me into trouble in other cases?

That depends only on the pasteboard provider. There is no strict rule. The 
provider does not know the recipient and therefore puts everything on the 
pasteboard that will satisfy the task the provider offers.

atze


  
__
Win 1 of 4 Sony home entertainment packs thanks to Yahoo!7.
Enter now: http://au.docs.yahoo.com/homepageset/
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: tiffs on pasteboard

2009-11-20 Thread Jens Alfke

On Nov 20, 2009, at 1:35 AM, Chris Idou wrote:

 I thought the solution to big files was to use pasteboard promises... not to 
 setup a pasteboard which is  conflicted about what item it is trying to 
 store. At least that's what I find documented by Apple.

You're correct that promises would overcome some of the inefficiencies 
(although I can envision other situations where the size would be a problem.)

I suspect the real reason is that there isn't a straightforward mapping between 
file types and pasteboard types. There is not in general any table that says a 
file with extension .foo contains data that can be stored in a pasteboard 
using type 'FooPasteboardType'; so the Finder would not be able to decide in 
all cases what pasteboard type to use for the contents of the dragged/copied 
file.*

You could argue that images are a useful special case; but I suspect that the 
engineers responsible decided that it was better to remain consistent.

(And actually, it doesn't even work for all image types. The old Mac 'PICT' 
format is infamous for having a slightly different representation in memory 
than in a file, so you can't just slurp a PICT file into the pasteboard and 
have it be useable.)

—Jens

* Especially for package file types that are actually directories; would the 
rule be to create a Zip archive? 
:-P___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: tiffs on pasteboard

2009-11-20 Thread Chris Idou


Well... now that in 10.6 the pasteboard types are UTI types, I'm not sure that 
one can say anymore that there is no mapping from files to pasteboard types. 
And 10.6 Finder puts a public.tiff into the pasteboard in this case, but I 
would argue it is the wrong tiff.





On Nov 20, 2009, at 1:35 AM, Chris Idou wrote:

 I thought the solution to big files was to use pasteboard promises... not to 
 setup a pasteboard which is  conflicted about what item it is trying to 
 store. At least that's what I find documented by Apple.

You're correct that promises would overcome some of the inefficiencies 
(although I can envision other situations where the size would be a problem.)

I suspect the real reason is that there isn't a straightforward mapping between 
file types and pasteboard types. There is not in general any table that says a 
file with extension .foo contains data that can be stored in a pasteboard 
using type 'FooPasteboardType'; so the Finder would not be able to decide in 
all cases what pasteboard type to use for the contents of the dragged/copied 
file.*

You could argue that images are a useful special case; but I suspect that the 
engineers responsible decided that it was better to remain consistent..

(And actually, it doesn't even work for all image types. The old Mac 'PICT' 
format is infamous for having a slightly different representation in memory 
than in a file, so you can't just slurp a PICT file into the pasteboard and 
have it be useable.)

—Jens

* Especially for package file types that are actually directories; would the 
rule be to create a Zip archive? :-P


  
__
Win 1 of 4 Sony home entertainment packs thanks to Yahoo!7.
Enter now: http://au.docs.yahoo.com/homepageset/
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: tiffs on pasteboard

2009-11-20 Thread Kyle Sluder

On Nov 20, 2009, at 3:59 PM, Chris Idou idou...@yahoo.com wrote:

Well... now that in 10.6 the pasteboard types are UTI types, I'm not  
sure that one can say anymore that there is no mapping from files to  
pasteboard types. And 10.6 Finder puts a public.tiff into the  
pasteboard in this case, but I would argue it is the wrong tiff.


Icons in the Finder are just that: icons. It is not the Finder's job  
to do the open-the-file work of the drop target.


--Kyle Sluder
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


tiffs on pasteboard

2009-11-19 Thread Chris Idou


I'm trying to read a TIFF off the pasteboard, but it doesn't seem to work for 
me. What I'm doing is going into Finder, finding a TIFF file and Command-C it.

Among other types I then find on the pasteboard are:
NeXT TIFF v4.0 pasteboard type
and
public.tiff

If I take either of those from the pasteboard and write the NSData object to a 
file:

[content writeToFile:@/tmp/foo.tiffatomically:YES];

or else if I make an NSImage from the data:
[[NSImagealloc] initWithData:content]

and display it in an NSImageView then I always see the generic TIFF icon, i.e. 
the one with a photo of a child scattered on the table, with a loupe on top of 
it.

The same thing happens for JPEGs, GIFS and PNGs, but not for com.apple.icns. If 
I take the com.apple.icns, it displays correctly.

What am I doing wrong?


  
__
Win 1 of 4 Sony home entertainment packs thanks to Yahoo!7.
Enter now: http://au.docs.yahoo.com/homepageset/
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: tiffs on pasteboard

2009-11-19 Thread Kyle Sluder
On Thu, Nov 19, 2009 at 4:33 PM, Chris Idou idou...@yahoo.com wrote:
 I'm trying to read a TIFF off the pasteboard, but it doesn't seem to work for 
 me. What I'm doing is going into Finder, finding a TIFF file and Command-C it.

You've copied the file icon.  If you want to copy the file's data, you
need to open it in Preview and copy that.

--Kyle Sluder
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: tiffs on pasteboard

2009-11-19 Thread Jens Alfke

On Nov 19, 2009, at 4:43 PM, Chris Idou wrote:

 If I double click the tiff in Finder, and open it in Preview, click it in 
 Preview, Command-A, Command-C, the same thing happens.

That's weird. Can you show us the code that reads the image data off the 
pasteboard?

—Jens___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: tiffs on pasteboard

2009-11-19 Thread Chris Idou


I notice that at least com.apple.icns works when I copy it from Preview, but it 
doesn't work when just copying from Finder.

But either way TextEdit seems to be able to get the right thing if I paste into 
it.





From: Chris Idou idou...@yahoo.com
To: Kyle Sluder kyle.slu...@gmail.com
Cc: cocoa-dev@lists.apple.com
Sent: Fri, 20 November, 2009 11:43:17 AM
Subject: Re: tiffs on pasteboard



If I double click the tiff in Finder, and open it in Preview, click it in 
Preview, Command-A, Command-C, the same thing happens.





From: Kyle Sluder kyle.slu...@gmail.com
To: Chris Idou idou...@yahoo.com
Cc: cocoa-dev@lists.apple.com
Sent: Fri, 20 November, 2009 11:36:54 AM
Subject: Re: tiffs on pasteboard

On Thu, Nov 19, 2009 at 4:33 PM, Chris Idou idou...@yahoo.com wrote:
 I'm trying to read a TIFF off the pasteboard, but it doesn't seem to work for 
 me. What I'm doing is going into Finder, finding a TIFF file and Command-C it.

You've copied the file icon.  If you want to copy the file's data, you
need to open it in Preview and copy that.

--Kyle Sluder



  
__
Win 1 of 4 Sony home entertainment packs thanks to Yahoo!7.
Enter now: http://au.docs.yahoo.com/homepageset/
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/idou747%40yahoo.com

This email sent to idou...@yahoo.com



  
__
Win 1 of 4 Sony home entertainment packs thanks to Yahoo!7.
Enter now: http://au.docs.yahoo.com/homepageset/
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: tiffs on pasteboard

2009-11-19 Thread Jens Alfke

On Nov 19, 2009, at 5:24 PM, Chris Idou wrote:

 But I'm still confused about one thing: If copying from Finder actually 
 copies the file icon, and not the actual tiff, how come it pastes ok into 
 TextEdit?

The Finder also puts the location of the file on the pasteboard, and I believe 
TextEdit sees that, recognizes that it's an image file, and reads the file into 
an image. You can do the same fairly easily.

—Jens___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: tiffs on pasteboard

2009-11-19 Thread Chris Idou



But what are the rules and conventions? Why would Finder put the icon in the 
pasteboard on the assumption that is what the user wants, but TextEdit would 
paste in the actual file on the assumption that is what the user wants? It 
seems schizophrenic. I just want a list of rules of how to use the Pasteboard 
in a way that conforms to what users expect. If I start ignoring the TIFF part 
of the pasteboard in favor of the URL on the assumption that is what the user 
wants, why is the tiff there anyway? And will that get me into trouble in other 
cases?





From: Jens Alfke j...@mooseyard.com
To: Chris Idou idou...@yahoo.com
Cc: Kyle Sluder kyle.slu...@gmail.com; cocoa-dev@lists.apple.com
Sent: Fri, 20 November, 2009 12:29:51 PM
Subject: Re: tiffs on pasteboard


On Nov 19, 2009, at 5:24 PM, Chris Idou wrote:

 But I'm still confused about one thing: If copying from Finder actually 
 copies the file icon, and not the actual tiff, how come it pastes ok into 
 TextEdit?

The Finder also puts the location of the file on the pasteboard, and I believe 
TextEdit sees that, recognizes that it's an image file, and reads the file into 
an image. You can do the same fairly easily.

—Jens


  
__
Win 1 of 4 Sony home entertainment packs thanks to Yahoo!7.
Enter now: http://au.docs.yahoo.com/homepageset/
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com