This is DistortedCubeInsp.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.
*/
/*****************************************************************************
*
* CustomObject module
* -------------------
*
* File: DistortedCubeInsp.m
*
* Contents: A distorted cube inspector
*
*
*****************************************************************************/
#import <appkit/Slider.h>
#import "DistortedCube.h"
#import "DistortedCubeInsp.h"
@implementation DistortedCubeInsp
/*******************************************************************************
* *
* Class methods *
* *
*******************************************************************************/
/*
* This method should return the name of the nib file that you want to
* use with the inspector.
*/
+ (const char *)nibName
{
return "DistortedCubeInsp";
}
/*******************************************************************************
* *
* Instance methods *
* *
*******************************************************************************/
/*
* Instance methods to be compatible with intuitiv'3d's inspector protocol.
*/
/*
* This method should return the name of the inspector
*/
- (const char *)title
{
return "DistortedCube inspector";
}
/*
* This method should send all inspector values to the object
* This method is called when the user press the Ok button.
*/
- sendAllValueToObject:anObject
{
[anObject setStartWidth:[startWidthTextField floatValue]];
[anObject setStartHeight:[startHeightTextField floatValue]];
[anObject setDestWidth:[destWidthTextField floatValue]];
[anObject setDestHeight:[destHeightTextField floatValue]];
[anObject setOffsetForX:[offsetForXTextField floatValue]];
[anObject setOffsetForY:[offsetForYTextField floatValue]];
[anObject setOffsetForZ:[offsetForZTextField floatValue]];
return self;
}
/*
* This method should set the inspector's interface to the
* value of anObject. This method is called when there is
* a new object selection or when the user presses the
* revert button.
*/
- receiveAllValueFromObject:anObject
{
float startWidth = [anObject startWidth];
float startHeight = [anObject startHeight];
float destWidth = [anObject destWidth];
float destHeight = [anObject destHeight];
float offsetForX = [anObject offsetForX];
float offsetForY = [anObject offsetForY];
float offsetForZ = [anObject offsetForZ];
[startWidthSlider setFloatValue:startWidth];
[startWidthTextField setFloatValue:startWidth];
[startHeightSlider setFloatValue:startHeight];
[startHeightTextField setFloatValue:startHeight];
[destWidthSlider setFloatValue:destWidth];
[destWidthTextField setFloatValue:destWidth];
[destHeightSlider setFloatValue:destHeight];
[destHeightTextField setFloatValue:destHeight];
[offsetForXSlider setFloatValue:offsetForX];
[offsetForXTextField setFloatValue:offsetForX];
[offsetForYSlider setFloatValue:offsetForY];
[offsetForYTextField setFloatValue:offsetForY];
[offsetForZSlider setFloatValue:offsetForZ];
[offsetForZTextField setFloatValue:offsetForZ];
return self;
}
/*
* Target / action methods. Please see DistortedCubeInsp.nib
*
* Please notice macro usage for real-time if needed.
*/
- takeStartWidthFrom:sender
{
float value = [sender floatValue];
if (value < 0.0)
value = 0.0;
[startWidthTextField setFloatValue:value];
[startWidthSlider setFloatValue:value];
if (INSPECTOR_IS_REAL_TIME)
{
[INSPECTED_OBJECT setStartWidth:value];
UPDATE_SCENE;
}
return self;
}
- takeStartHeightFrom:sender
{
float value = [sender floatValue];
if (value < 0.0)
value = 0.0;
[startHeightTextField setFloatValue:value];
[startHeightSlider setFloatValue:value];
if (INSPECTOR_IS_REAL_TIME)
{
[INSPECTED_OBJECT setStartHeight:value];
UPDATE_SCENE;
}
return self;
}
- takeDestWidthFrom:sender
{
float value = [sender floatValue];
if (value < 0.0)
value = 0.0;
[destWidthTextField setFloatValue:value];
[destWidthSlider setFloatValue:value];
if (INSPECTOR_IS_REAL_TIME)
{
[INSPECTED_OBJECT setDestWidth:value];
UPDATE_SCENE;
}
return self;
}
- takeDestHeightFrom:sender
{
float value = [sender floatValue];
if (value < 0.0)
value = 0.0;
[destHeightTextField setFloatValue:value];
[destHeightSlider setFloatValue:value];
if (INSPECTOR_IS_REAL_TIME)
{
[INSPECTED_OBJECT setDestHeight:value];
UPDATE_SCENE;
}
return self;
}
- takeOffsetForXFrom:sender
{
float value = [sender floatValue];
if (sender == offsetForXSlider)
[offsetForXTextField setFloatValue:value];
else
[offsetForXSlider setFloatValue:value];
if (INSPECTOR_IS_REAL_TIME)
{
[INSPECTED_OBJECT setOffsetForX:value];
UPDATE_SCENE;
}
return self;
}
- takeOffsetForYFrom:sender
{
float value = [sender floatValue];
if (sender == offsetForYSlider)
[offsetForYTextField setFloatValue:value];
else
[offsetForYSlider setFloatValue:value];
if (INSPECTOR_IS_REAL_TIME)
{
[INSPECTED_OBJECT setOffsetForY:value];
UPDATE_SCENE;
}
return self;
}
- takeOffsetForZFrom:sender
{
float value = [sender floatValue];
if (sender == offsetForZSlider)
[offsetForZTextField setFloatValue:value];
else
[offsetForZSlider setFloatValue:value];
if (INSPECTOR_IS_REAL_TIME)
{
[INSPECTED_OBJECT setOffsetForZ:value];
UPDATE_SCENE;
}
return self;
}
@end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.