This is SkyInspector.m in view mode; [Download] [Up]
/* Copyright 1993 by Cub'x Systemes * * All Rights Reserved * * Permission to use, copy, and distribute this software and its * documentation for the purpose of making new intuitiv'3d modules. * This copyright notice must appears in all copies that you distribute. * The name of Cub'x Systeme should not be used in advertising or publicity * without specific, written prior permission. * CUB'X SYSTEMES DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL * CUB'X SYSTEMES BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ /******************************************************************************* * * * Project intuitiv'3d * * ------------------- * * * * * * File: SkyInspector.h * * * * * * Creation date: Tue Jul 27 14:42:12 GMT+0200 1993 * * * * * * Contents: a sky inspector. * * * * * *******************************************************************************/ #import "SkyInspector.h" #import <appkit/Application.h> #import "Sky.h" #import <sys/param.h> /* * It is convenient to define a constant for each * shader args */ #define KD 0 #define KA 1 #define WEATHER 2 #define LIGHTBLUE 3 #define DARKBLUE 4 /* * There is only one instance of the inspector */ static id instance = nil; @implementation SkyInspector + alloc { if( ! instance ) { char buf[MAXPATHLEN+1]; self = instance = [super alloc]; [instance setFlipped: YES]; /* * Here is how to load a nib file that is inside a module bundle */ [[NXApp moduleManager] getPath: buf forResource: "SkyInspector" ofType: "nib"]; [NXApp loadNibFile: buf owner: self]; } else self = instance; return self; } /* * This method is called by the generic shader inspector to see * if the subclass provides a better implementation that the default * one for each parameters. */ - (BOOL)shouldUseArg:(unsigned int) argNum { switch( argNum ) { case LIGHTBLUE: case DARKBLUE: case WEATHER: return NO; } return YES; } /* * You should returns YES if your shader changes its behavior * when a scaling is done. */ - (BOOL)shouldUseScale { return NO; } /* * When this method is called, the instance variable * shader is set to the current shader */ - makeInterfaceBeforeAllAt:(NXCoord*) py { CXArg *arg = [shader argArray]; NXRect fr; /* * Initialize the special interface */ [lightBlueW setColor: arg[LIGHTBLUE].data.color]; [darkBlueW setColor: arg[DARKBLUE].data.color]; [weatherS setFloatValue: arg[WEATHER].data.scalar]; /* * Adds it and places it */ [self addSubview: box]; [box moveTo: 5.0 : *py]; /* * Update the py value according to the size * of the box (for the next interface) */ [box getFrame:&fr]; (*py) += fr.size.height + DEFAULT_OFFSET; [self sizeTo: DEFAULT_WIDTH : *py]; return self; } - uninit { [box removeFromSuperview]; return self; } - lightBlueChange:sender { CXArg *arg = [shader argArray]; arg[LIGHTBLUE].data.color = [sender color]; [super aValueHaveChange: self]; return self; } - darkBlueChange: sender { CXArg *arg = [shader argArray]; arg[DARKBLUE].data.color = [sender color]; [super aValueHaveChange: self]; return self; } - weatherChange: sender { CXArg *arg = [shader argArray]; arg[WEATHER].data.scalar = [sender floatValue]; [super aValueHaveChange: self]; return self; } @end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.