home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Misc / RZToDoList / Source / RZ.m < prev    next >
Encoding:
Text File  |  1995-06-12  |  874 b   |  50 lines

  1. /* 
  2.  * Misc Functions
  3.  *
  4.  * You may freely copy, distribute and reuse the code in this example.
  5.  * This code is provided AS IS without warranty of any kind, expressed 
  6.  * or implied, as to its fitness for any particular use.
  7.  *
  8.  * Copyright 1995 Ralph Zazula (rzazula@next.com).  All Rights Reserved.
  9.  *
  10.  */
  11.  
  12. #import "RZ.h"
  13. #import <appkit/appkit.h>
  14.  
  15. char *RZCopyStringBuffer(const char *s)
  16. {
  17.     return s ? NXCopyStringBuffer(s) : NULL;
  18. }
  19.  
  20. char *RZReplaceStringBuffer(char **s, const char *new)
  21. {
  22.     if(s && *s) {
  23.         NX_FREE(*s);
  24.         *s = NULL;
  25.     }
  26.     
  27.     *s = RZCopyStringBuffer(new);
  28.     
  29.     return *s;
  30. }
  31.  
  32. void newLocation(NXPoint *p)
  33. /*
  34.  * This function computes a new location for each new window created.
  35.  */
  36. {
  37.     static unsigned    count = 0;
  38.     static NXPoint    loc;
  39.   
  40.     if (!count++)
  41.         loc = *p;
  42.     else 
  43.     {
  44.         p->x = loc.x += 20.0;
  45.         p->y = loc.y -= 25.0;
  46.         if (count > 10) 
  47.             count = 0;
  48.     }
  49. }
  50.