home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2J (Developer) / os42jdev.iso / NextDeveloper / Examples / AppKit / Yap / YapWrap.psw < prev   
Text File  |  1996-01-19  |  1KB  |  45 lines

  1. /*
  2.  *  The following pswrap functions are used by YapOutput in the Yap program...
  3.  *  By: Ali Ozer
  4.  *
  5.  *  You may freely copy, distribute and reuse the code in this example.
  6.  *  NeXT disclaims any warranty of any kind, expressed or implied,
  7.  *  as to its fitness for any particular use.
  8.  */
  9.  
  10. defineps GetUserTime (| int *utime)
  11.   yaptime utime
  12. endps
  13.  
  14. /* GetFocus gets the bbox of the current clippath, the ctm, and current win number. ReFocus focuses given these values.
  15. */
  16. defineps GetFocus(|float *llx; float *lly, *urx, *ury, ctm[6]; int *win)
  17.     gsave clippath pathbbox ury urx lly llx grestore
  18.     matrix currentmatrix {ctm} forall
  19.     currentwindow win
  20. endps
  21.  
  22. defineps ReFocus(int win; float ctm[6]; float llx, lly, urx, ury)
  23.     win windowdeviceround    % focus on this window
  24.     ctm setmatrix        % set up the matrix
  25.     newpath            % reestablish the clip path
  26.     llx lly moveto
  27.     llx ury lineto
  28.     urx ury lineto
  29.     urx lly lineto
  30.     closepath clip
  31.     newpath
  32. endps
  33.  
  34. /* Draw gridlines "every" apart from 0,0 to width,height
  35. */
  36. defineps DrawGrid(float width, height, every)
  37.     5 6 div setgray
  38.     0 every width {
  39.         0 moveto 0 height rlineto stroke
  40.     } for
  41.     0 every height {
  42.         0 exch moveto width 0 rlineto stroke
  43.    } for
  44. endps
  45.