[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Drag & Drop Text Selection to Droplet Question



At 12:32 -0400 8/15/98, Kevin Reid wrote:
>> Code shouldn't assume that there is just a TEXT resource and that it is ID
>> 256...there's an indexing resource which indicates the flavors and resource
>> IDs (Finder always creates with ID 256...at least so far).
>
>I was afraid of this. What's the format of the resource?
>

Well, it's been about 4 years, but...

The "map" is found in a resource of type 'drag', whose ID seems to be 128
(but it might be better to ask the Resource Manager for the first 'drag'
resource, rather than 'drag' 128).

A freshly made clipping file (drag from SimpleText to the desktop, meaning
Finder did the work) contains

00 00 00 01    00 00 00 04    00 00 00 00    00 00
followed (bytes 14 and 15, zero-based count) by the number of flavors in
the file...2 in this case:

00 02    #for this clipping, these are 'TEXT' and 'styl' flavors.

Followed by 2 16-byte entries, of which the useful parts are
4-bytes:   the type code:  'TEXT', 'styl', 'PICT', 'snd '  etc
2-bytes:    00 00
2 bytes:    01 00    #that is, resource ID of 256 (varying this along with
changing the IDs of the actual resources left working clipping files which
Finder could understand)...Finder always uses 256.

8 bytes, all zero in every case I've seen.

-------
I'm not sure what that 04 is in byte 7 of the resource...my drag resource
ResEdit template (based on lightweight reverse engineering) claims that
should be a 0.  For that matter, I don't know what the 01 in byte 3
is...but a version code is one decent bet.

-------
Reading the Drag Manager docs would probably produce more information:  I
have a feeling Finder is basing its drag resource on something in those
docs, and that all those seemingly spurious zeros correspond with
information which is filled in in other contexts.

The only claim I can make to the correctness of the above is:  "it works".

   --John
--
John Baxter   jwblist@olympus.net      Port Ludlow, WA, USA
Give a man a fish and you feed him for a day.  Teach him to fish,
and you get rid of him for the weekend.

***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch