From: fletcher@socrates.umd.edu (Charles Fletcher)
Newsgroups: comp.sys.next.programmer
Subject: Converting 2.1 palettes to 3.0
Summary: The title is the summary
Keywords: palettes, interface builder, 3.0, project builder
Date: 1 Oct 92 13:03:00 GMT
Organization: University of Maryland University College


I have placed a version of the CircularSlider palette which works with 3.0
in the submissions directory at Purdue. I have only tested it in IB test mode.
I have not compiled it in an application, and in fact, have not compiled a
library to use it with an application--this is up to the user (see the
Makefiles and the original CS, in the oops/ib directory at purdue, I believe,
for more details about this.) Furthermore, since I took the original version
and redid it, it has the problem of not using the full rotation when the
max value is less than 360. (I like it to go all the way around--360 degrees--
when going from min to max. Now, if say the max value is set to 120, the slider
will only go one third of the way around. This can easy be changed in the code
and recompiled.) Anyway, it is a starting point for those who want it and
want to play with it. 

Also, I have included a list of instructions, which I give below, for
converting a 2.1 palette to 3.0. Hopefully I have forgotten anything.
I haven't any luck with double clicking on the old project file and
doing an automatic conversion. I start anew and work from there. 

I would like comments on these instructions from any other palette
makers out there (Nick?), including you professionals (Mike, Alex,
Eric, Chris, ... anyone?)

Let me know of any problems or additions.

Charlie

***********************************************************************

The following tells how (?) to convert a 2.1 palette to a 3.0 palette.
It is assumed that the 2.1 palette object(s) is (are) a subclass of View.
You should also consult the NeXT docs "Creating a Custom Palette."

1) Make a new directory called, say, xxxPalette. Start ProjectBuilder (PB)
and select NEW, choosing Patette as the type from the Save Panel. Go to
your xxxPalette directory and click OK. (This creates the files: Makefile,
xxxPalette.h/m, palette.table, PB.gdbinit, and PB.project.)

2) Remove xxxPalette.m from Classes and add it to Other Sources (under Files).
Add your view .m file (say you called it xxxView.m) into the Classes list. 
Add xxxInspector.m and any other support files into the Other Sources list.
Note that the .h files will automatically be added under Headers.

3) Modify the following files (practically everything):

	a) xxxView.m/h -- Change the method -inspectorName to
	-getInspectorClassName.

	b) xxxInspector.m/h -- Remove +finishLoading and
	+startUnloading. (Note that nib files are no longer 
	stored in the Mach header. They are simply files (folders,
	actually) in the palette folder.) Also, remove -ok and -revert
	from the .h file, they are now in the superclass (IBInspector).
	Modify the -init method by removing

	[NXApp loadNibSection:"CircularSliderInspector.nib" owner:self];

	and adding

  char buf[MAXPATHLEN + 1];
      
  [[NXBundle bundleForClass:[xxx class]] getPath:buf 
	forResource:"xxxInspector" ofType:"nib"];
  [NXApp loadNibFile:buf owner:self withNames:NO fromZone:[self zone]];

	Add the method

	- (BOOL)wantsButtons
	{
	    return YES;
	}

	(You may return NO here and connect the objects in the inspector
	panel to the -ok action using IB for automatic updating.)
	In the .h file, make xxxInspector a subclass of IBInspector.
	Change #import <nib/InterfaceBuilder.h> to 
	#import <apps/InterfaceBuilder.h>. Make sure -ok and -revert
	return [super ok/revert:sender]. (See the NeXT docs on creating
	a custom palette.)


	Modify the xxxInspector.nib file by loading it into IB and 
	subclassing it to IBInspector (first remove (ie, cut) the Inspector
	subclass.) Rename this subclass and Parse in the xxxInspector.h.
	Save the nib file and add it to the project. Localize this file.
	[Having fun so far?]

	c) Load xxxPalette.nib into IB (note the automatic connection
	to originalWindow) and add a customView of the correct size to
	the Panel. Subclass View and Parse in your xxxView.h code. Make the
	customView of this class type. Save.

	d) Add the tiff icon to the project (Note only one is needed,
	do away with the xxxH.tiff file.)

	e) Modify the Icon and Export Class part of the palette.table
	file.

	f) Add any additional Makefile.pxxx to the Supporting Files
	category of the project.


4) Build the palette and load into IB.




-- 
	NeXTMail to:		|	...to confer, converse, and 
	charlie@technosci.com	|	otherwise hobnob with my    
				|	brother wizards.	    
Newsgroups: comp.sys.next.programmer