[comp.sys.mac.programmer] Pasting icon/picts onto icons in get-info boxes

jkeegan@hawk.ulowell.edu (Jeff Keegan) (05/28/91)

Well, I'm not sure if this is really a question for comp.sys.mac.programmer,
but I feel most comfortable positing it here because the people that will
be able to answer it (and that will be interested in it) will be programmers
(I imagine).. Ok.. 

I like the feature of System 7 that allows you to paste a PICT (preferably
ICON sized) into the get info box in the finder, to give something another
icon.. The thing I'm wondering though is considering the lack of a mask
definition, how does it determine a mask? Is it doing the same thing that
ResEdit does when you drag a icl8 to the mask field?  And where is this
information kept, the new desktop files? (forgive me if this is covered in
Inside Macintosh VI, I have yet to be able to obtain a copy)..

The reason for my question is less than professional, I admit, but I still have
to mention it..  You see I used to use SunDesk to put this really nice color
Hobbes icon on my hard drive.. But when I went into ResEdit, edited the icl8,
selected all and copied the pict, then pasted it onto the get-info box for my
hard drive, the icon I saw was masked wrong since I only saw small parts of 
the icon, and the drag-region when moving it covered only those parts.  It was
as if the other colors didn't register.  So I went back into ResEdit and
had it remap the colors for the icon into the system's colors (the 34 Apple
Icon colors) and it still didn't work..  I made sure the icon was completely
enclosed and still nothing..

I realize this is not a very important feature (obviously) since it's not like
we're creating a new icon family for it or anything, but I'm just wondering
if there is a way around this.. That black and white Hobbes icon is looking
pretty pale.  Maybe I should consider seeing if Calvin looks better...

Hmm..

..Jeff Keegan

-------------------------------------------------------------------------------
| Jeff Keegan                | I clutch the wire fence until my fingers bleed |
| jkeegan@hawk.ulowell.edu   | A wound that will not heal                     |
|----------------------------| A heart that cannot feel                       |
| This space intentionally   | Hoping that the horror will receed             |
| left blank                 | Hoping that tomorrow we'll all be freed  -RUSH |
-------------------------------------------------------------------------------

tagreen@lothario.ucs.indiana.edu (Todd Green) (05/28/91)

> [article about copying icl8's to hard drive deleted]

I cannot tell you why it doesn't work, but here is a (kludge city)
work around that I came up with since I had the same problem trying to
colorize my hd's.

Just build an application with the icl8 you want using your fav
compiler.  Then you can get info on this app and cut-n-paste the icon
over to your HD.  (If you don't have a compiler you can just change
the icon info for some program you won't use and rebuild the desktop.)

If someone has a better solution, (or an explanation why you cannot
copy icl8's directly from from ResEdit2.1 to the get-info box) I'd
love to hear it.

Tchau,
Todd

-- 
Internet: tagreen@bronze.ucs.indiana.edu
NeXTMail: tagreen@lothario.ucs.indiana.edu
BitNet:   tagreen@iubacs.bitnet

boerned@mist.CS.ORST.EDU (Dan Boerner) (05/29/91)

I was just playing around with this and what I've come up with so far is that
the Finder will create an entire IconFamily based upon the 'icl8' icon.  It
does this using the same algorithm as ResEdit does in its Family Icon Editor.
This means that the ICN# icon that is generated from your icl8 icon must
be completely enclosed in black bits.  So that when it is used to create the
mask, a solid mask is created.  Did that make sense?

The problem with the Hobbes icon is that it is not completely enclosed, so when
the mask is generated the black "paint" "leaks" out of the mask.  

One solution is to open up the file you are trying to change the icon of
using Resedit and hand patch the Icon Family rsrcs found therein.  I don't know
how to do this if you're trying to changed a Folder's Icon, because I don't
know how to get ResEdit to open a folder's rsrc fork.  Say, if a folder is
just a directory, where are the folder's Icons stored?  Hmmmm...

If you are trying to change a volume Icon, just change the Icon Family rsrcs
found in the invisible file "Icon" found on the root level of the volume. 

----
Dan Boerner
Grad Slave with 3 weeks left in my 'sentence'
Oregon State University

P.S.  Does anyone else's copy of ResEdit 2.1 add an extra line to the Mask
icon when dragging one of the other family icons down to the mask rectangle?
Do I have a damaged copy??

jsm@apple.com (Jeff Miller) (05/29/91)

In article <1991May27.203211.3542@ulowell.ulowell.edu>, jkeegan@hawk.ulowell.edu (Jeff Keegan) writes:
> I like the feature of System 7 that allows you to paste a PICT (preferably
> ICON sized) into the get info box in the finder, to give something another
> icon.. The thing I'm wondering though is considering the lack of a mask
> definition, how does it determine a mask? Is it doing the same thing that
> ResEdit does when you drag a icl8 to the mask field?  And where is this
> information kept, the new desktop files? (forgive me if this is covered in
> Inside Macintosh VI, I have yet to be able to obtain a copy)..
>
> -------------------------------------------------------------------------------
> | Jeff Keegan                | I clutch the wire fence until my fingers bleed |
> | jkeegan@hawk.ulowell.edu   | A wound that will not heal                     |
> |----------------------------| A heart that cannot feel                       |
> | This space intentionally   | Hoping that the horror will receed             |
> | left blank                 | Hoping that tomorrow we'll all be freed  -RUSH |
> -------------------------------------------------------------------------------
>

We use CalcMask, as documented in Inside Mac Vol IV, to calculate the mask
from a PICT.  As you've discovered, this algorithm doesn't always work as
well as a manually generated mask.  The Finder expects at least an ICN# on
the Clipboard in order to paste an icon rather than a PICT, since the ICN#
has the mask data.  So make sure you generate an ICN# to go along with
your icl8.

For volumes and folders, the custom icons are kept in an invisible file called
"Icon" at the root level.  For files, they're kept in the resource fork.

Jeff Miller
Macintosh System Software
jsm@apple.com
> 

stui@avalon.caladan.wa.com (Stuart Burden) (05/29/91)

Pity the whole system of replacing icons on the desktop isn't applicable
to all desktop icons.. you can't replace the trash icon.. or is there a
neat trick to do this that I've missed?.. thought System 7 was supposed
to treat the trash just like a folder.. or maybe not :-)

I guess it will just line up with the other pet peeves.. Empty Trash
Dialog not remembering it's position (same for building the desktop
dialog) :-)

Stu.

--
stui@avalon.uucp
stui@avalon.caladan.wa.com

aries@rhi.hi.is (Mimir Reynisson) (05/30/91)

Because, as far as I can remember, the finder expects you to paste
in PICT resources. Just use a magic tool like Clipboard Magician and
everything should be cool :)
_____________________________________________________________________________
Mimir Reynisson (aries@rhi.hi.is)        Technology Development Centre
Aries Software, Inc.                     Dunhagi 5, IS-107 Reykjavik
-----------------------------------------------------------------------------

grh@rhi.hi.is (Gisli Runar Hjaltason) (05/30/91)

The icon family for folders and disks is stored in an Icon resource file inside
the folder/disk. What you can do is to paste an icon into the get-info box, and
then open the Icon file and modify or replace the icons. The ID of the icons
is -16554 or something around that (sorry, I don't have IM-VI or System 7
nearby). For files, the icon family is stored inside the file's resource fork,
and the same ID is used.
-- 
Gisli Runar Hjaltason, owner | smail: Njalsgata 12     | Did you know that IM VI
Hugald, Software Development |        IS-101 Reykjavik | is larger than IM I-IV
    email: grh@rhi.hi.is     |        Iceland          | put together?

tisu@quads.uchicago.edu (Seth Tisue) (05/30/91)

In article <0B02FFF0.gq3aht@avalon.caladan.wa.com> stui@avalon.caladan.wa.com (Stuart Burden) writes:
>Pity the whole system of replacing icons on the desktop isn't applicable
>to all desktop icons.. you can't replace the trash icon.. or is there a
>neat trick to do this that I've missed?.. thought System 7 was supposed
>to treat the trash just like a folder.. or maybe not :-)

I seem to remember reading a net-article claiming that Apple had made the
trash icon un-modifiable (by official means) for legal reasons, i.e., the
appearance of the position of Trash was a distinctive Macintosh feature
which they didn't want to compromise.

Then again, maybe that's just a rumor.



-- 
---- Seth Tisue                     USMail: c/o Plaster Cramp Press  
---- (tisu@midway.uchicago.edu)                       P.O. Box 5975
"Please to be restful.  It is only a few           Chicago IL 60680
crazies who have from the crazy place outbroken."    --------------

alexr@apple.com (Alexander M. Rosenberg) (05/30/91)

In article <1991May29.211517.7687@midway.uchicago.edu>, tisu@quads.uchicago.edu (Seth Tisue) writes:
> 
> In article <0B02FFF0.gq3aht@avalon.caladan.wa.com> stui@avalon.caladan.wa.com (Stuart Burden) writes:
> >Pity the whole system of replacing icons on the desktop isn't applicable
> >to all desktop icons.. you can't replace the trash icon.. or is there a
> >neat trick to do this that I've missed?.. thought System 7 was supposed
> >to treat the trash just like a folder.. or maybe not :-)
> 
> I seem to remember reading a net-article claiming that Apple had made the
> trash icon un-modifiable (by official means) for legal reasons, i.e., the
> appearance of the position of Trash was a distinctive Macintosh feature
> which they didn't want to compromise.
> 
> Then again, maybe that's just a rumor.
> 

I agree with the 'rumor' label. My understanding is that the Trash icon isn't
changeable because the current icon changing interface doesn't handle the
fact that the Trash has two icons: empty and full. Also keep in mind that
although the Trash is now a folder, it's not feasible to keep the custom
icon in the "Icon" file in that folder as it's contents are considered
volitile (under user control, of course). So, if the Get Info window somehow
did support custom Trash icons, where would the Finder keep them? All I can
think of would be to keep them in the Desktop database, but that's volume
specific. (Although the Finder treats icons as the sum of all Desktop
databases on mounted volumes.)

Something to think about.

---------------------------------------------------------------------------
-  Alexander M. Rosenberg  - INTERNET: alexr@apple.com      - Yoyodyne    -
-  330 1/2 Waverley St.    - UUCP:ucbvax!apple!alexr        - Propulsion  -
-  Palo Alto, CA 94301     -                                - Systems     -
-  (415) 329-8463          - Nobody is my employer so       - :-)         -
-  (408) 974-3110          - nobody cares what I say.       -             -

francis@arthur.uchicago.edu (Francis Stracke) (05/30/91)

In article <3208@krafla.rhi.hi.is> grh@rhi.hi.is (Gisli Runar Hjaltason) writes:

>then open the Icon file and modify or replace the icons. The ID of the icons
>is -16554 or something around that (sorry, I don't have IM-VI or System 7

That is the correct ID.

--
/============================================================================\
| Francis Stracke	       | My opinions are my own.  I don't steal them.|
| Department of Mathematics    |=============================================|
| University of Chicago	       | Until you stalk and overrun,	     	     |
| francis@zaphod.uchicago.edu  |  you can't devour anyone. -- Hobbes 	     |
\============================================================================/