home *** CD-ROM | disk | FTP | other *** search
/ vsiftp.vmssoftware.com / VSIPUBLIC@vsiftp.vmssoftware.com.tar / FREEWARE / FREEWARE40.ZIP / xpaint-247 / xpaint.h < prev    next >
C/C++ Source or Header  |  1996-10-29  |  3KB  |  98 lines

  1. /* +-------------------------------------------------------------------+ */
  2. /* | Copyright 1992, 1993, David Koblas (koblas@netcom.com)            | */
  3. /* | Copyright 1995, 1996 Torsten Martinsen (bullestock@dk-online.dk)  | */
  4. /* |                                                                   | */
  5. /* | Permission to use, copy, modify, and to distribute this software  | */
  6. /* | and its documentation for any purpose is hereby granted without   | */
  7. /* | fee, provided that the above copyright notice appear in all       | */
  8. /* | copies and that both that copyright notice and this permission    | */
  9. /* | notice appear in supporting documentation.  There is no           | */
  10. /* | representations about the suitability of this software for        | */
  11. /* | any purpose.  this software is provided "as is" without express   | */
  12. /* | or implied warranty.                                              | */
  13. /* |                                                                   | */
  14. /* +-------------------------------------------------------------------+ */
  15.  
  16. /* $Id: xpaint.h,v 1.7 1996/05/09 07:10:27 torsten Exp $ */
  17.  
  18. #if defined(HAVE_PARAM_H)
  19. #include <sys/param.h>
  20. #endif
  21.  
  22. #ifndef MIN
  23. #define MIN(a,b)    (((a) < (b)) ? (a) : (b))
  24. #endif
  25. #ifndef MAX
  26. #define MAX(a,b)    (((a) > (b)) ? (a) : (b))
  27. #endif
  28. #ifndef ABS
  29. #define ABS(a)        ((a > 0) ? (a) : 0 - (a))
  30. #endif
  31. #ifndef SIGN
  32. #define SIGN(a)        ((a > 0) ? 1 : -1)
  33. #endif
  34.  
  35. #ifdef __STDC__
  36. #define CONCAT(a,b)    a##b
  37. #else
  38. #define CONCAT(a,b)    a/**/b
  39. #endif
  40.  
  41. #ifdef AIXV3
  42. #ifdef NULL
  43. #undef NULL
  44. #endif                /* NULL */
  45. #define NULL 0
  46. #endif                /* AIXV3 */
  47.  
  48. extern struct Global_s {
  49.     struct {
  50.     void *image;
  51.     Colormap cmap;
  52.     int width, height;
  53.     Pixmap pix, mask;
  54.     } region;
  55.     Display *display;
  56.     XtAppContext appContext;
  57.     Boolean timeToDie;
  58.     Time currentTime;
  59. } Global;
  60.  
  61. typedef void *(*OperationFunc) (Widget,...);
  62.  
  63. typedef void *(*OperationAddProc) (Widget);
  64. typedef void (*OperationRemoveProc) (Widget, void *);
  65. typedef OperationFunc Operation_t;
  66. typedef struct {
  67.     OperationAddProc add;
  68.     OperationRemoveProc remove;
  69. } OperationPair;
  70.  
  71. #ifdef DEFINE_GLOBAL
  72. #define EXTERN(var, val)    var = val ;
  73. #else
  74. #define EXTERN(var, val)    extern var ;
  75. #endif
  76.  
  77. EXTERN(OperationPair * CurrentOp, NULL)
  78. #ifdef DEFINE_GLOBAL
  79. struct Global_s Global;
  80. #endif
  81.  
  82. #define DEFAULT_TITLE    "Untitled"
  83.  
  84. #define AllButtonsMask \
  85.     (Button1Mask|Button2Mask|Button3Mask|Button4Mask|Button5Mask)
  86.  
  87. /* gradient fill modes */
  88. #define TFILL_RADIAL 0
  89. #define TFILL_LINEAR 1
  90. #define TFILL_CONE   2
  91. #define TFILL_SQUARE 3
  92.  
  93. #define XYtoRECT(x1,y1,x2,y2,rect)                    \
  94.             (rect)->x = MIN(x1,x2);             \
  95.             (rect)->y = MIN(y1,y2);                \
  96.             (rect)->width = MAX(x1,x2) - (rect)->x + 1;    \
  97.             (rect)->height = MAX(y1,y2) - (rect)->y + 1;
  98.