home *** CD-ROM | disk | FTP | other *** search
/ ProfitPress Mega CDROM2 …eeware (MSDOS)(1992)(Eng) / ProfitPress-MegaCDROM2.B6I / GRAPHICS / MISC / EEDRW23S.ZIP / PROGRAM.H < prev    next >
Encoding:
C/C++ Source or Header  |  1991-11-02  |  6.4 KB  |  203 lines

  1. /*****************************************************************************
  2. * Definitions for the EEDRAW program:                         *
  3. *****************************************************************************/
  4.  
  5. #ifndef PROGRAM_H
  6. #define PROGRAM_H
  7.  
  8. #define EEDRAW_VERSION    "Version 2.2"
  9.  
  10. #define PROGRAM_NAME    "EEdraw"
  11.  
  12. #include "intr_lib.h"
  13. #include "intr_gr.h"
  14.  
  15. typedef int        BooleanType;
  16. typedef unsigned char    ByteType;
  17.  
  18. #if !defined(FLOAT) && !defined(DOUBLE)
  19. #define DOUBLE
  20. typedef    double        RealType;
  21. #endif /* !FLOAT && !DOUBLE */
  22.  
  23. #ifdef VoidPtr
  24. #undef VoidPtr
  25. #endif /* VoidPtr */
  26.  
  27. #ifdef NO_VOID_PTR
  28. #define VoidPtr        char *
  29. #else
  30. #define VoidPtr        void *
  31. #endif /* NO_VOID_PTR */
  32.  
  33. #ifndef    NULL
  34. #define    NULL    0
  35. #endif
  36.  
  37. #ifndef    TRUE
  38. #define    TRUE    1
  39. #define    FALSE    0
  40. #endif
  41.  
  42. #ifndef LINE_LEN
  43. #define LINE_LEN_LONG    1024
  44. #define LINE_LEN    255
  45. #define LINE_LEN_SHORT    81
  46. #define FULL_PATH_LEN    81
  47. #define FILE_NAME_LEN    14
  48. #define MAX_PIN_INFO    10
  49. #endif
  50.  
  51. #define EE_ERASE_COLOR  (IntrAllocColor(EEActvWndwBackColor, INTR_INTENSITY_HIGH))
  52. #define EE_DRAW_COLOR  (IntrAllocColor(EEActvWndwForeColor, INTR_INTENSITY_VHIGH))
  53. #define EE_HIGHLIGHT_COLOR  (IntrAllocColor(EEHighLightColor, INTR_INTENSITY_VHIGH))
  54.  
  55. #define SIGN(x)        ((x) > 0 ? 1 : ((x) < 0 ? -1 : 0))
  56. #define ABS(y)        ((y) > 0 ? (y) : (-(y)))
  57. #define SQR(y)        ((y) * (y))
  58. #define SGN(x)        ((x) > 0 ? 1 : ((x) == 0 ? 0 : -1))
  59. #define MIN(x, y)    ((x) > (y) ? (y) : (x))
  60. #define MAX(x, y)    ((x) > (y) ? (x) : (y))
  61. #define BOUND(x, Min, Max) (MIN(MAX((x), (Min)), (Max)))
  62. #define GEN_COPY(Dest, Src, Size)       memcpy(Dest, Src, Size)
  63.  
  64. #define INFINITY    1e6
  65. #define EPSILON        1e-6
  66.  
  67. #define DEG2RAD(Deg)    ((Deg) * M_PI / 180.0)
  68. #define RAD2DEG(Rad)    ((Rad) * 180.0 / M_PI)
  69.  
  70. #define BSPACE    8
  71. #define TAB    9
  72. #define LF    10
  73. #define CR    13
  74. #define ESC    27
  75.  
  76. #define PAGE_A4_XSIZE    1000         /* Regular page size (8" Epson printer) */
  77. #define PAGE_A4_YSIZE    640
  78.  
  79. /* Note the snap distance is also the scaler for libraries loaded in. */
  80. #define DEFAULT_SNAP_DISTANCE    16        /* Distance to snap a point. */
  81.  
  82. #define DEFAULT_ZOOM_FACTOR    -2             /* Zoom out by factor of 4. */
  83. #define DEFAULT_ZOOM(v)        ((v) >> 2)
  84. #define DEFAULT_INV_ZOOM(v)    ((v) << 2)
  85.  
  86. /* Macros to control coordinate to gird snapping in drawing space. */
  87. #define EE_SNAP(x)        (((x + EESnapDistance / 2) / EESnapDistance) \
  88.                                * EESnapDistance)
  89.  
  90. #define BOUNDARY_WIDTH        30
  91.  
  92. typedef enum {
  93.     DRAW_POLYLINE_STRUCT_TYPE,
  94.     DRAW_CONNECTION_STRUCT_TYPE,
  95.     DRAW_TEXT_STRUCT_TYPE,
  96.     DRAW_LIB_ITEM_STRUCT_TYPE,
  97.     DRAW_PICK_ITEM_STRUCT_TYPE
  98. } DrawStructureType;
  99.  
  100. typedef enum {
  101.     TEXT_ORIENT_NON = -1,
  102.     TEXT_ORIENT_HORIZ = GR_HORIZ_DIR,
  103.     TEXT_ORIENT_VERT = GR_VERT_DIR
  104. } TextOrientationType;
  105.  
  106. typedef struct DrawGenericStruct {
  107.     DrawStructureType StructType;
  108.     struct DrawGenericStruct *Pnext;
  109. } DrawGenericStruct;
  110.  
  111. typedef struct DrawPolylineStruct {
  112.     DrawStructureType StructType;
  113.     struct DrawGenericStruct *Pnext;
  114.     int Flags;
  115.     int Width;
  116.     int NumOfPoints;              /* Number of XY pairs in Points array. */
  117.     int *Points;            /* XY pairs that forms the polyline. */
  118. } DrawPolylineStruct;
  119.  
  120. typedef struct DrawConnectionStruct {
  121.     DrawStructureType StructType;
  122.     struct DrawGenericStruct *Pnext;
  123.     int PosX, PosY;                /* XY coordinates of connection. */
  124. } DrawConnectionStruct;
  125.  
  126. typedef struct DrawTextStruct {
  127.     DrawStructureType StructType;
  128.     struct DrawGenericStruct *Pnext;
  129.     int PosX, PosY, Scale;            /* XY coordinates of connection. */
  130.     TextOrientationType Orient;
  131.     char *Text;
  132. } DrawTextStruct;
  133.  
  134. typedef struct DrawLibItemStruct {
  135.     DrawStructureType StructType;
  136.     struct DrawGenericStruct *Pnext;
  137.     TextOrientationType PartNameOrient, ChipNameOrient;
  138.     char *PartName;      /* Name of part, i.e. "Op. Amp. 21". Not Chip Name. */
  139.     char *ChipName;       /* Key to look for in the library, i.e. "74LS00". */
  140.     int PartNameX, PartNameY;            /* Where PartName should be put. */
  141.     int ChipNameX, ChipNameY;            /* Where ChipName should be put. */
  142.     int Multi;             /* In multi unit chip - which unit to draw. */
  143.     int Transform[2][2];       /* The rotation/mirror transformation matrix. */
  144.     int PosX, PosY;                  /* Exact position of part. */
  145.     int BBoxMinX, BBoxMaxX, BBoxMinY, BBoxMaxY;     /* BBox around the part. */
  146. } DrawLibItemStruct;
  147.  
  148. typedef struct DrawPickedStruct { /* Holds structures picked by pick events. */
  149.     DrawStructureType StructType;
  150.     struct DrawPickedStruct *Pnext;
  151.     DrawGenericStruct *PickedStruct;
  152. } DrawPickedStruct;
  153.  
  154. typedef struct EEWindowStruct {
  155.     int IntrLibWindowID;
  156.     int PageXSize, PageYSize;
  157.     BooleanType Modified;
  158.     BooleanType IsFullSize;
  159.     char FileName[FULL_PATH_LEN + FILE_NAME_LEN];
  160.     IntrBBoxStruct BBox;
  161.     DrawGenericStruct *EEDrawList;       /* All objects of this file/window. */
  162.     struct EEWindowStruct *Pnext;
  163. } EEWindowStruct;
  164.  
  165. typedef struct NetListStruct {
  166.     char Pin[LINE_LEN_SHORT];
  167.     struct NetListStruct *Pnext;
  168. } NetListStruct;
  169.  
  170. extern int EEPageSizeX, EEPageSizeY; /* Clipping boundaries of current page. */
  171. extern int EESnapDistance;       /* Distance to snap a point to current one. */
  172. extern int EETextScale;          /* Scaling factor for text string drawing. */
  173. extern int EEWindowsFrameWidth;               /* Width of all drawings. */
  174. extern int EEListNumDisplayed;
  175. extern int EERootWindowID;        /* Intr_lib ID of the back ground color. */
  176. extern int EERootWndwFrameColor;
  177. extern int EERootWndwForeColor;
  178. extern int EERootWndwBackColor;
  179. extern int EERootWndwXorColor;
  180. extern int EEPopUpFrameColor;         /* Color for the pop up menus/queries. */
  181. extern int EEPopUpBackColor;
  182. extern int EEPopUpForeColor;
  183. extern int EEPopUpXorColor;
  184. extern int EEActvWndwFrameColor;
  185. extern int EEActvWndwForeColor;
  186. extern int EEActvWndwBackColor;
  187. extern int EEPsvWndwFrameColor;
  188. extern int EEPsvWndwForeColor;
  189. extern int EEPsvWndwBackColor;
  190. extern int EEHighLightColor;
  191. extern BooleanType EEAutoPan; /* Control auto panning in creation/placement. */
  192. extern BooleanType EEHVLineDrawing;  /* Draw only horizontal/vertical lines. */
  193. extern EEWindowStruct *EEActiveWindow, *EEWindowsList;
  194. extern IntrBBoxStruct *EEActiveBBox;
  195.  
  196. void PutCursorInActiveWindow(void);
  197. VoidPtr MyMalloc(unsigned size);
  198. void MyFree(VoidPtr);
  199. void MyExit(int ExitCode);
  200. void FatalError(char *ErrMsg);
  201.  
  202. #endif PROGRAM_H
  203.