[comp.sys.next] fsectbyname

lane@sumex-aim.stanford.edu (Christopher Lane) (06/17/89)

In article <9782@polya.Stanford.EDU> Ali T. Ozer writes:
>In article <23940@labrea.Stanford.EDU> Christopher Lane writes:
>>Since the point of IB generated applications is that the end users can
>>customize the interface(s) to their needs/tastes without sources or
>>recompilation, can someone explain to me how to do the following:
>
>When the .nib file is included in the executable as a part of the __NIB 
>MachO segment, it cannot be edited. (At least not in 0.9 and 1.0.)
>If a developer wants the users to change the interface to
>his/her application, then the .nib file should be included separately.
>Preferences and Workspace include their interfaces as a part of the
>executable, so you cannot change their interfaces...

Not being one to take 'cannot' as an answer, I've written the command
'fsectbyname' which is similar to (but does not use) the system call
'getsectbyname' but operates externally on files and also has the
functionality of the non-existent function 'putsectbyname'.  For example:

    fsectbyname r /NextApps/Preferences __NIB Preferences >Preferences.nib

can be used to extract the Preferences 'nib' file for the main panel in a form
that Interface builder will accept.  You can also edit the 'nib' (or 'tiff' or
whatever you extracted) and put it back via:

    fsectbyname w /NextApps/Preferences __NIB Preferences <MyPreferences.nib

But since the file you splice back in has to be the same size or smaller than
the original 'section', this generally isn't of much use unless you are
removing items from the panel.  Unfortunately IB and Icon generate larger
output files even when there are no changes so this option is not always
useful.

This command should be used in conjunction with the 'size -m' command which
lists the names and sizes of segments and sections in an object file.

I've FTP'd the source, binary and 'man' page in a compressed tar file to the
submissions directory on the cs.orst.edu NeXT archive.  The 'fsectbyname'
command with no or insufficient arguments gives a summary of its usage.

I've used it successfully to remove the 'Password' and 'Startup' buttons from
the 'Preferences' application as they are not needed/wanted at our site.  I've
also successfully extracted a number of 'nib', 'tiff' and 'ps' segments from
various applications.

It is clear that what is really needed, and possible, is a NeXT equivalent to
'ResEdit'.  This routine is meant only as a temporary solution (to a problem
that I'm not planning to work on).  The program could also be made more useful
by being able to relocate segments and sections in the object file so that
larger sections could be spliced in (another problem I'm not planning to work
on).  Other suggestions/comments would be welcome.

Not a program for the squeamish.

- Christopher

PS: I still can't fix that 'logout' panel to move the confirm to the 'correct'
button as Workspace doesn't use a __NIB segment--does NeXT internally not
believe in InterfaceBuilder generated objects?

ali@polya.Stanford.EDU (Ali T. Ozer) (06/17/89)

In article <23955@labrea.Stanford.EDU> Christopher Lane writes:
>PS: I still can't fix that 'logout' panel to move the confirm to the 'correct'
>button as Workspace doesn't use a __NIB segment--does NeXT internally not
>believe in InterfaceBuilder generated objects?

No, no. Interface Builder and Workspace Manager are both fairly large 
applications that were developed in parallel. That is the primary reason why
Workspace doesn't read its user interface from a .nib file. 
A good number of NeXT applications do use InterfaceBuilder .nib
files for their user interfaces.

Ali Ozer, NeXT Developer Support
aozer@NeXT.com

carlson@lance.tis.llnl.gov (John Carlson) (11/21/89)

In article <12857@polya.Stanford.EDU> ali@Polya.Stanford.EDU (Ali T. Ozer) writes:
>In article <1989Nov18.035121.8882@agate.berkeley.edu> Izumi Ohzawa writes:
>> ...  So, I modified Preferences in /NextApps 
>>using "fsectbyname" utility and IB. You can extract appropriate .nib file
>>with fsectbyname, edit it by IB to break connection from "SET" button, and
>>put back the modified .nib file back into Preferences executable.
>
>Wow. That fsectbyname is pretty handy!

When do we get the version where we can drag an icon from and to IB? :-)

John Carlson
carlson@tis.llnl.gov