ftp.nice.ch/Attic/openStep/developer/resources/MiscKit.2.0.5.s.gnutar.gz#/MiscKit2/Frameworks/MiscAppKit/MiscTreeDiagram.subproj/MiscConcreteTwoShape.m

This is MiscConcreteTwoShape.m in view mode; [Download] [Up]

/*	MiscConcreteTwoShape.m

	Copyright 1996 Uwe Hoffmann.

	This notice may not be removed from this source code.
	The use and distribution of this software is governed by the
	terms of the MiscKit license agreement.  Refer to the license
	document included with the MiscKit distribution for the terms.

	Version 2 (August 1996)
*/

#import <Foundation/Foundation.h>
#import <MiscFoundation/MiscUtilities.h>
#import <AppKit/dpsOpenStep.h>

#import "MiscConcreteTwoShape.h"
#import "MiscUserPath.h"
#import "MiscHitPath.h"
#import "MiscTDUtils.h"

@implementation MiscConcreteTwoShape 

- initBounds:(NSRect)aRect
{
    	hR = vR = NO;
	path1 = [[MiscUserPath allocWithZone:[self zone]] init];
	path2 = [[MiscUserPath allocWithZone:[self zone]] init];
	[self makePathWithBounds:aRect];
	return self;
}

- (void)dealloc
{
	[path1 release];
	[path2 release];
   	return [super dealloc];
}

- copyWithZone:(NSZone *)aZone
{
	MiscConcreteTwoShape *theCopy;
	
	theCopy = (MiscConcreteTwoShape *)NSCopyObject(self, 0, aZone);	
	theCopy->path1 = [path1 copyWithZone:aZone];
	theCopy->path2 = [path2 copyWithZone:aZone];	
	return theCopy;
}

- copy
{
	return [self copyWithZone:NSDefaultMallocZone()];
}

- (NSRect)bounds
{
	return [path1 bounds];
}

- (void)moveTo:(NSPoint)aPos
{
	NSRect r;
	
	r = [path1 bounds];
	r.origin = aPos;
	[self fillParamsWithBounds:r];
}

- (void)sizeTo:(NSSize)aSize
{
	NSRect r;
	
	r = [path1 bounds];
	r.size = aSize;
	[self fillParamsWithBounds:r];
}

- (void)drawOutline
{
	[path2 send:dps_ustroke cached:YES];
}

- (void)drawFill
{
	[path1 send:dps_ufill cached:YES];
}

- (void)drawShadowWithDelta:(NSPoint)aPos
{
	NSRect r;
	NSPoint original;
	
	r = [path1 bounds];
	original = r.origin;
	r.origin.x += aPos.x;
        r.origin.y += aPos.y;
	[self fillParamsWithBounds:r];
	[path1 send:dps_ufill cached:YES];
	r.origin = original;
	[self fillParamsWithBounds:r];
}

- (BOOL)hitOutline:(MiscHitPath *)hitPath
{
	return [hitPath hit:dps_inustroke path:path2];
}

- (BOOL)hitFill:(MiscHitPath *)hitPath
{
	return [hitPath hit:dps_inufill path:path1];
}

- initWithCoder:(NSCoder *)coder
{
	path1 = [[coder decodeObject] retain];
	path2 = [[coder decodeObject] retain];
        [coder decodeValuesOfObjCTypes:"cc", &hR, &vR];
	return self;
}

- (void)encodeWithCoder:(NSCoder *)coder
{
	[coder encodeObject:path1];
	[coder encodeObject:path2];
        [coder encodeValuesOfObjCTypes:"cc", &hR, &vR];
}


- (void)makePathWithBounds:(NSRect)aRect
{
	MiscRequiresConcreteImplementation(self, _cmd, [MiscConcreteTwoShape class]);
	return;
}

- (void)fillParamsWithBounds:(NSRect)aRect
{
	MiscRequiresConcreteImplementation(self, _cmd, [MiscConcreteTwoShape class]);
	return;
}

+ (NSSize)calcSizeForInnerSize:(NSSize)aSize
{
	NSSize s;
	
	s.width = s.height = 0;
	return s;
}

- (BOOL)reflectedHorizontal
{
        return hR;
}

- (BOOL)reflectedVertical
{
        return vR;
}

- (void)reflectHorizontal
{
        hR = !hR;
}

- (void)reflectVertical
{
        vR = !vR;
}

- (void)setReflectHorizontal:(BOOL)aBool
{
        hR = aBool;
}

- (void)setReflectVertical:(BOOL)aBool
{
        vR = aBool;
}

@end


	

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.