home *** CD-ROM | disk | FTP | other *** search
/ Chip 1996 December / CHIP_CD_1996_12_PL.iso / software / trial / megacad.pl / cc / megacad.h_ / megacad.h
Encoding:
C/C++ Source or Header  |  1994-10-05  |  8.1 KB  |  190 lines

  1. /**********************************************************************/
  2. /* MegaCAD colour values                                              */
  3. /**********************************************************************/
  4.  
  5. #define BLACK          0
  6. #define BLUE           1
  7. #define GREEN          2
  8. #define CYAN           3
  9. #define RED            4
  10. #define MAGENTA        5
  11. #define YELLOW         6
  12. #define WHITE          7
  13. #define BRIGHT_BLACK   8
  14. #define BRIGHT_BLUE    9
  15. #define BRIGHT_GREEN   10
  16. #define BRIGHT_CYAN    11
  17. #define BRIGHT_RED     12
  18. #define BRIGHT_MAGENTA 13
  19. #define BRIGHT_YELLOW  14
  20. #define BRIGHT_WHITE   15
  21.  
  22. /**********************************************************************/
  23.  
  24. #define NIB(i,s)       (((i) & 0xf)<<(s))
  25.  
  26. #define PIX_XOR        2
  27. #define LMODE(s,p,c,w) ((ushort)(NIB(s,0) | NIB(p,4) | NIB(c,8) | NIB(w,12)))
  28. //      s = linestyle, p = pixelmode, c = colour, w = linewidth
  29. //      with 'DrawInv()' pixelmode must be 'PIX_XOR'
  30. //                       other values may be constant or 0,
  31. //                       if 0, current values are taken
  32. //      if you want a continuous line with width 1, you can call :
  33. //          DrawInv(E_LINE,&line,LMODE(1,PIX_XOR,WHITE,1),0);
  34. //      if you want the current settings of entity type 'type', you call :
  35. //          DrawInv(E_LINE,&line,LMODE(0,PIX_XOR,0,0),type);
  36.  
  37. #define HLP_INV(f,b,s) ((ushort)(NIB(f,0) | NIB(b,4) | ((s)<<15)))
  38. //      f = foreground colour, b = background colour, s = sound ?
  39. //      if you set both colours to 0, the default colours are taken
  40.  
  41. #define DO_SAVCNT      (1<<7)
  42. //      calls 'savecount()' at the end of 'StoreMultiple()'
  43. //      if or'ed together with entity type
  44.  
  45. #if defined ( MEGATECH_C )
  46.     #define tCallBack void *
  47. #else
  48.     typedef short (_far *tCallBack)(void _far *para);
  49. #endif
  50.  
  51. #define CONTINUE_LOOP  0
  52. #define CALL_SAVECOUNT 1
  53. #define BREAK_LOOP     2
  54.  
  55. /**********************************************************************/
  56. /* MegaCAD function prototypes.                                       */
  57. /**********************************************************************/
  58.  
  59. EXT(201) short GetPntInv(     // Get point and draw something with mouse move
  60.         double      *pkt,     // point to be filled in
  61.         short       setinc,   // incremental point to be set ?
  62.         tCallBack   func,     // callback function
  63.         void        *para);   // data pointer for callback function
  64.  
  65. EXT(202) void DrawInv(        // draw and save a temporary object
  66.         ushort      type,     // type of entity to be drawn
  67.         void        *ptr,     // data of entity
  68.         ushort      lmode,    // line attributes (see LMODE)
  69.         ushort      atype);   // type to get attributes from
  70.  
  71. EXT(203) short DlgInput(      // input some values by dialog
  72.         ushort      num,      // number of fields (1 - 10)
  73.         char        *title,   // title string
  74.         t_dlgdta    *dta);    // array of field descriptors
  75.  
  76. EXT(204) short GetFilename(   // let the user select a filename
  77.         char        *title,   // title string
  78.         char        *fname);  // filename; must be initialized with path
  79.  
  80. EXT(205) void StoreMultiple(  // store an entity (maybe multiple)
  81.         double      *data,    // entity data
  82.         ushort      type);    // entity type (may be or'ed with DO_SAVCNT)
  83.  
  84. EXT(206) void MegaCMD(        // call MegaCAD command
  85.         char        *cmd);    // command string (+ arguments)
  86.  
  87. EXT(207) short Message(       // message box
  88.         char        *str1,    // 1st line of text
  89.         char        *str2,    // 2nd line of text
  90.         char        *but1,    // 1st button (may be NULL)
  91.         char        *but2,    // 2nd button (may be NULL)
  92.         char        *but3,    // 3rd button
  93.         short       defbut);  // number of default button (1-3)
  94.  
  95. EXT(208) void MouseHelp(      // help text for mouse buttons
  96.         char        *str1,    // help text for left mouse button
  97.         char        *str2,    // help text for right mouse button
  98.         ushort      inv);     // colour (beep) for 1st text (see HLP_INV)
  99.  
  100. EXT(209) short GetPnt(        // Get point
  101.         double      *pkt,     // point to be filled in
  102.         short       setinc);  // incremental point to be set ?
  103.  
  104. EXT(210) void savecount(      // End of operation
  105.         void );               // must be called after creation of entities
  106.  
  107. EXT(211) void SetFuncText(    // set name of current function
  108.         char        *text);   // function text
  109.  
  110. EXT(212) ulong CreateEntity(  // store an entity (not multiple), returns ID
  111.         ushort      type,     // entity type
  112.         t_attribs   *attr,    // entity attributes (may be NULL)
  113.         void        *data);   // entity data
  114.  
  115. EXT(213) void GetTextVal(     // retrieve text attributes
  116.         ushort      type,     // line or block
  117.         ushort      init,     // initialize (or just calculate box)
  118.         t_text      *txt);    // text data
  119.  
  120. EXT(214) ushort ReadTxtFile(  // read in a text file
  121.         char        *fname,   // filename
  122.         char        *buf,     // buffer to be filled in
  123.         uint        bufsiz);  // size of buffer
  124.  
  125. EXT(215) ushort AddPolylnPt(  // add a polyline point
  126.         t_polyln    *polyln,  // polyline structure
  127.         double      *mpd,     // may be NULL
  128.         double      px,       // x-coordinate of point
  129.         double      py);      // y-coordinate of point
  130.  
  131. EXT(216) void EraseInv(       // delete temporary objects
  132.         void );
  133.  
  134. EXT(217) void GetDimVal(      // retrieve dimension attributes
  135.         ushort      type,     // type of dimension
  136.         ushort      init,     // initialize (or just calculate box)
  137.         t_dimension *dim);    // dimension data
  138.  
  139. EXT(218) void PrintDimVal(    // print dimension text
  140.         double      value,    // measured value
  141.         char        *str,     // string buffer to fill
  142.         char        *tol1,    // tolerance string 1
  143.         char        *tol2);   // tolerance string 2
  144.  
  145. EXT(219) short ClickEntity(   // let the user click a single entity
  146.         ulong       filter,   // allowed entity types
  147.         double      *pnt,     // point where entity was clicked
  148.         t_entity    *ent,     // entity data to be filled in
  149.         void        *edta,    // data ptr of variable length entities
  150.         ushort      esiz);    // size of data buffer
  151.  
  152. EXT(220) ulong ExChangeEntity(// exchange an entity, returns new ID
  153.         t_entity    *ent);    // new entity data, old id
  154.  
  155. EXT(221) short Blink(         // draw something blinking
  156.         tCallBack   func,     // callback function
  157.         void        *para);   // data pointer for callback function
  158.  
  159. EXT(222) void EntityLoop(     // loop through all entities
  160.         ulong       filter,   // allowed entity types
  161.         tCallBack   func,     // callback function
  162.         void        *para,    // data pointer for callback function
  163.         void        *edta,    // data ptr of variable length entities
  164.         ushort      esiz);    // size of data buffer
  165.  
  166. EXT(223) void DrawEntities(   // draw array of entity-id's
  167.         ulong       *pid,     // array of entity-id's
  168.         ushort      num);     // number of id's
  169.  
  170. EXT(224) short StringInput(   // input a line of text
  171.         char        *title,   // title string
  172.         char        *buf,     // string buffer to be filled in
  173.         ushort      buflen);  // size of buffer
  174.  
  175. EXT(225) void SelectInit(     // set select filter
  176.         ulong       filter);  // allowed entity types
  177.  
  178. EXT(226) void SelectLoop(     // select entities
  179.         tCallBack   func,     // callback function
  180.         void        *para,    // data pointer for callback function
  181.         void        *edta,    // data ptr of variable length entities
  182.         ushort      esiz);    // size of data buffer
  183.  
  184. EXT(227) ushort InsertMac(    // insert macro-file
  185.         char        *fname,   // macro filename
  186.         tCallBack   func,     // callback function
  187.         void        *para,    // data pointer for callback function
  188.         void        *edta,    // data ptr of variable length entities
  189.         ushort      esiz);    // size of data buffer
  190.