/* 
 * Misc Functions
 *
 * You may freely copy, distribute and reuse the code in this example.
 * This code is provided AS IS without warranty of any kind, expressed 
 * or implied, as to its fitness for any particular use.
 *
 * Copyright 1995 Ralph Zazula (rzazula@next.com).  All Rights Reserved.
 *
 */

#import "RZ.h"
#import <appkit/appkit.h>

char *RZCopyStringBuffer(const char *s)
{
	return s ? NXCopyStringBuffer(s) : NULL;
}

char *RZReplaceStringBuffer(char **s, const char *new)
{
	if(s && *s) {
		NX_FREE(*s);
		*s = NULL;
	}
	
	*s = RZCopyStringBuffer(new);
	
	return *s;
}

void newLocation(NXPoint *p)
/*
 * This function computes a new location for each new window created.
 */
{
	static unsigned	count = 0;
	static NXPoint	loc;
  
	if (!count++)
		loc = *p;
	else 
	{
		p->x = loc.x += 20.0;
		p->y = loc.y -= 25.0;
		if (count > 10) 
			count = 0;
	}
}
