• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: weird user-default problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: weird user-default problem


  • Subject: Re: weird user-default problem
  • From: Ondra Cada <email@hidden>
  • Date: Thu, 31 Jan 2002 18:56:51 +0100

Malte,

>>>>>> Malte Tancred (MT) wrote at Thu, 31 Jan 2002 18:29:18 +0100:
MT> >Defaults database can contain just plists, IIRC, and NSColor is
MT> >definitely
MT> >not a plist. Encode it into a string or data (the latter can be done
MT> >transparently for almost any object via NSArchiver).
MT>
MT> Please don't fill the defaults database with binary data
MT> if it can be avoided. It makes it soo much harder to use
MT> the database from the command line. It also makes it feel
MT> more like the windows registry. :-)

Not really. It is indeed easy to write a simple "defaults" like tool, which
would interpret NSArchived-binaries properly (for library classes, of course)
and let you edit some of them.

MT> Encode it into a string!

That said, I do *HEARTILY* agree; the problem is that unless NSColor
supports some kind of "initWithDescriptionString" (which it does not, IIRC
(*)), it means relatively big issue for programmer who wants nonthing more
than to store a color into defaults.

(*) I haven't tried using catalog and color names; if it happens to work for
*any* color, well, thing's solved! But I fear it would not...

Don't forget that the color can be expressed in a number of color spaces,
and, actually, the number is even not definite, for other NSColor concrete
subclasses might occur any time. Therefore, archiving a color properly into a
string is not *that* easy.

And again, that said, I agree I should have emphasized that IF SIMPLE RGB IS
SUFFICIENT FOR THE APPLICATION, it should definitely encode the color into
defaults as just three easily externally-changeable values. Though, as soon
as the complete color management comes into account, I would use NSArchiver
myself just to save the effort...

And finally, perhaps it would be reasonable to fill a feature request to
allow storing NSColors into a string and reading them back, and to allow
using them directly through the NSUserDefaults (which would re-use the
aforementioned string encoding).
---
Ondra Cada
OCSoftware: email@hidden http://www.ocs.cz
2K Development: email@hidden http://www.2kdevelopment.cz
private email@hidden http://www.ocs.cz/oc


References: 
 >Re: weird user-default problem (From: Malte Tancred <email@hidden>)

  • Prev by Date: ANN: GNUMail.app 1.0.0pre2 / Pantomime 1.0.0
  • Next by Date: Re: System contextual menus
  • Previous by thread: Re: weird user-default problem
  • Next by thread: Re: weird user-default problem
  • Index(es):
    • Date
    • Thread