[comp.sys.mac.programmer] How much is enough?

rcook@eagle.wesleyan.edu (04/12/90)

Recently I wrote an LDEF for use with a Desk Accessory I am working on, but I
got a little paranoid when it came to the lDrawMsg.  I wanted the list data
(which is basically just a string with 8 header bytes that should not be
printed) to be drawn in Geneva font, size 9.  When highlighted, I wanted white
letters on a black background.  Sounds normal and straightforward, but can I
count on the current font being Geneva 9 point, textmode=ScrOr (or whatever),
textface=[] (no special style stuff), the black pattern being available,
penmode=PatCopy, etc?  I decided I couldn't count on such things, so
initialization time I loaded black from the system pattern list into the list's
private storage, and at draw time I save all the pertinent pen/text info, set
it the way I want it, draw the cell, and restore all the previous pen/text
info.  I'm guaranteed that the list will look right, but all my precautions add
significantly to code size and execution speed.

My question:  how careful does my LDEF (or code resource or DA or other piece of
software) need to be about changing current system settings?  Is it the
caller's or the callee's responsibility to preserve the current state?  Inside
Macintosh talks a little about this, doesn't mention (to my knowledge) what
things LDEFs are allowed to change.

If you've got a good rule-of-thumb or know something definitive, perhaps you
should post to the net, since I suspect many would be curious.  Thanks.

Randall Cook
rcook@eagle.wesleyan.edu