home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / x / volume19 / xfig / part01 / w_canvas.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-05-27  |  1.5 KB  |  40 lines

  1. /*
  2.  * FIG : Facility for Interactive Generation of figures
  3.  * Copyright (c) 1985 by Supoj Sutanthavibul
  4.  *
  5.  * "Permission to use, copy, modify, distribute, and sell this software and its
  6.  * documentation for any purpose is hereby granted without fee, provided that
  7.  * the above copyright notice appear in all copies and that both the copyright
  8.  * notice and this permission notice appear in supporting documentation. 
  9.  * No representations are made about the suitability of this software for 
  10.  * any purpose.  It is provided "as is" without express or implied warranty."
  11.  */
  12.  
  13. /************** DECLARE EXPORTS ***************/
  14.  
  15. extern int    (*canvas_kbd_proc) ();
  16. extern int    (*canvas_locmove_proc) ();
  17. extern int    (*canvas_leftbut_proc) ();
  18. extern int    (*canvas_middlebut_proc) ();
  19. extern int    (*canvas_middlebut_save) ();
  20. extern int    (*canvas_rightbut_proc) ();
  21. extern int    (*return_proc) ();
  22. extern int    null_proc();
  23. extern int    clip_xmin, clip_ymin, clip_xmax, clip_ymax;
  24. extern int    clip_width, clip_height;
  25. extern int    cur_x, cur_y;
  26.  
  27. extern String    local_translations;
  28.  
  29. /* macro which rounds coordinates depending on point positioning mode */
  30. #define        round_coords(x, y) \
  31.     if (cur_pointposn != P_ANY) \
  32.     if (!anypointposn) { \
  33.         int _txx; \
  34.         x = ((_txx = x%posn_rnd[cur_pointposn]) < posn_hlf[cur_pointposn]) \
  35.         ? x - _txx - 1 : x + posn_rnd[cur_pointposn] - _txx - 1; \
  36.         y = ((_txx = y%posn_rnd[cur_pointposn]) < posn_hlf[cur_pointposn]) \
  37.         ? y - _txx - 1 : y + posn_rnd[cur_pointposn] - _txx - 1; \
  38.     }
  39.  
  40.