POV-Ray : Newsgroups : povray.macintosh : Associating a resolution with a .pov file : Re: Associating a resolution with a .pov file Server Time
18 May 2024 06:45:31 EDT (-0400)
  Re: Associating a resolution with a .pov file  
From: Thorsten Froehlich
Date: 5 Jan 2003 15:44:33
Message: <3e189931@news.povray.org>
In article <3E1### [at] acmorg> , Eric Pepke <epe### [at] acmorg>  wrote:

> That's a good question.  I would think that they might be stored in a
> file with the same name and a different extension.

Mean mean so that preferences are lost when the users moves the file?  Also
some fools from Next may abandon some of the most outstanding features of
the Mac, that does not mean everybody has to follow Apple like lemmings ;-)

> Following your advice, however, I got the POV-Ray source code and
> searched for "Preference" and "Setting" (both are used in the POV-Ray
> user interface).  I found a piece of code that executed a
> WritePreferencesResource that used the TextDocument.renderSettings to
> keep the render settings.  This, of course, is a Collection, which is
> a Mac Carbon Core thingie.

As you know, you can call any Carbon function in Mac OS X...

>  I went through a bunch of stuff trying to
> figure out the use of kFilePrefs_CollectionKind versus (which is 'FPrf')
> which says it's used in kFPData_CollectionKind, but it isn't, and
> kPrefsCollectionKind which is actually 'Kind', so at this point I gave
> up and went back to WritePreferencesResource, which I found in the
> framework subdirectory, and it turns out the kind doesn't matter much,
> because it uses a FlattenCollectionToHdl to get the data to save to the
> resource.  This, of course, is Mac-specific and basically has an
> internal format. However, it's likely that Apple will maintain backward
> compatibility.

No, you are on the completely wrong track here.  The format is guaranteed by
Apple to be readable and writable by the appropriate system functions.
Nobody should even care what it looks like internally.  BTW, the "More is
Better" Apple DTS sample code actually uses collection based preferences
format also used by POV-Ray.

> So, at this point I gave up trying to find where the
> format is well documented and

Because you are still on the wrong track.  You are not looking for the
format of the Collection resource on disk because the operating system
already provides you with services to read and write it.  So you are looking
for the operating system functions to use the data once read via the
appropriate functions.  You found the POV-Ray functions that read and write
preferences, so I am surprised you missed it.

> just looked through the resource to find
> the values for width and height.  A 16-bit height turns out to start at
> address 31A, and a 16-bit width turns out to start at address 322.  This
> is probably the low word of a 32-bit number, but it doesn't matter for
> the resolutions I'm using.

Oh my god!  This will break instantly, and your speculation is completely
pointless given that you can find the truth in the source code so easily.
Do it properly (the same way as POV-Ray does) and you don't have to use such
hacks at all.  This is not a hacking contest, it is a read the documentation
contest!

> I went back and looked at the Read Me First! file, the How To Compile!
> file, the various text files in the subdirectories, and I could still
> find no documentation.

Well, those files tell you that the documentation exists in form of comments
in the source code.  And if you look you will easily find where the
collection resource is filled with content.  From there is really isn't hard
to track it back find the comments which exist for each and every collection
entry...

> So, in the absence of being able to find this documentation, I guess I'm
> stuck with taking a snapshot of the resource set up correctly, patching
> in the width and height programmatically, and saving that as a resource.

You are just on the completely wrong track, and that is where your trouble
comes from.  Some hacking won't get you anywhere, but actually following the
POV-Ray Mac source code together with knowing what system functions do will
help you a lot more and get you where you want much, much faster!

    Thorsten

____________________________________________________
Thorsten Froehlich
e-mail: mac### [at] povrayorg

I am a member of the POV-Ray Team.
Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.