home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 2001 December
/
pcwk12201b.iso
/
Reklamy
/
CAD-Projekt
/
MegaCAD-4_5
/
CC
/
MEGACAD.H_
/
MEGACAD.H
Wrap
Text File
|
1996-09-23
|
13KB
|
307 lines
/**********************************************************************/
/* MegaCAD colour values */
/**********************************************************************/
#define BLACK 0
#define BLUE 1
#define GREEN 2
#define CYAN 3
#define RED 4
#define MAGENTA 5
#define YELLOW 6
#define WHITE 7
#define BRIGHT_BLACK 8
#define BRIGHT_BLUE 9
#define BRIGHT_GREEN 10
#define BRIGHT_CYAN 11
#define BRIGHT_RED 12
#define BRIGHT_MAGENTA 13
#define BRIGHT_YELLOW 14
#define BRIGHT_WHITE 15
/**********************************************************************/
#define NIB(i,s) (((i) & 0xf)<<(s))
#define PIX_XOR 2
#define LMODE(s,p,c,w) ((ushort)(NIB(s,0) | NIB(p,4) | NIB(c,8) | NIB(w,12)))
// s = linestyle, p = pixelmode, c = colour, w = linewidth
// with 'DrawInv()' pixelmode must be 'PIX_XOR'
// other values may be constant or 0,
// if 0, current values are taken
// if you want a continuous line with width 1, you can call :
// DrawInv(E_LINE,&line,LMODE(1,PIX_XOR,WHITE,1),0);
// if you want the current settings of entity type 'type', you call :
// DrawInv(E_LINE,&line,LMODE(0,PIX_XOR,0,0),type);
#define HLP_INV(f,b,s) ((ushort)(NIB(f,0) | NIB(b,4) | ((s)<<15)))
// f = foreground colour, b = background colour, s = sound ?
// if you set both colours to 0, the default colours are taken
#define DO_SAVCNT (1<<7)
// calls 'savecount()' at the end of 'StoreMultiple()'
// if or'ed together with entity type
#if defined ( MEGATECH_C )
#define tCallBack void *
#else
typedef short (_far *tCallBack)(void _far *para);
#endif
#define CONTINUE_LOOP 0
#define CALL_SAVECOUNT 1
#define BREAK_LOOP 2
#define CALC_PERIM 0
#define CALC_AREA 1
#define CALC_GRAVITY 2
#define isLGBIT(a,i) ((a[(i)/8] >> ((i)%8))&1)
#define setLGBIT(a,i) a[(i)/8] |= (1<<((i)%8))
#define delLGBIT(a,i) a[(i)/8] &= ~(1<<((i)%8))
#define PART_ALL 1
#define PART_MAC 2
#define PART_ENT 4
#define InsertMac(f,c,p,e,s) InsertMacro(f,c,p,e,s,NULL)
/**********************************************************************/
/* MegaCAD function prototypes. */
/**********************************************************************/
EXT(201) short GetPntInv( // Get point and draw something with mouse move
double *pkt, // point to be filled in
short setinc, // incremental point to be set ?
tCallBack func, // callback function
void *para); // data pointer for callback function
EXT(202) void DrawInv( // draw and save a temporary object
ushort type, // type of entity to be drawn
void *ptr, // data of entity
ushort lmode, // line attributes (see LMODE)
ushort atype); // type to get attributes from
EXT(203) short DlgInput( // input some values by dialog
ushort num, // number of fields (1 - 10)
char *title, // title string
t_dlgdta *dta); // array of field descriptors
EXT(204) short GetFilename( // let the user select a filename
char *title, // title string
char *fname); // filename; must be initialized with path
EXT(205) void StoreMultiple( // store an entity (maybe multiple)
double *data, // entity data
ushort type); // entity type (may be or'ed with DO_SAVCNT)
EXT(206) void MegaCMD( // call MegaCAD command
char *cmd); // command string (+ arguments)
EXT(207) short Message( // message box
char *str1, // 1st line of text
char *str2, // 2nd line of text
char *but1, // 1st button (may be NULL)
char *but2, // 2nd button (may be NULL)
char *but3, // 3rd button
short defbut); // number of default button (1-3)
EXT(208) void MouseHelp( // help text for mouse buttons
char *str1, // help text for left mouse button
char *str2, // help text for right mouse button
ushort inv); // colour (beep) for 1st text (see HLP_INV)
EXT(209) short GetPnt( // Get point
double *pkt, // point to be filled in
short setinc); // incremental point to be set ?
EXT(210) void savecount( // End of operation
void ); // must be called after creation of entities
EXT(211) void SetFuncText( // set name of current function
char *text); // function text
EXT(212) ulong CreateEntity( // store an entity (not multiple), returns ID
ushort type, // entity type
t_attribs *attr, // entity attributes (may be NULL)
void *data); // entity data
EXT(213) void GetTextVal( // retrieve text attributes
ushort type, // line or block
ushort init, // initialize (or just calculate box)
t_text *txt); // text data
EXT(214) ushort ReadTxtFile( // read in a text file
char *fname, // filename
char *buf, // buffer to be filled in
uint bufsiz); // size of buffer
EXT(215) ushort AddPolylnPt( // add a polyline point
t_polyln *polyln, // polyline structure
double *mpd, // may be NULL
double px, // x-coordinate of point
double py); // y-coordinate of point
EXT(216) void EraseInv( // delete temporary objects
void );
EXT(217) void GetDimVal( // retrieve dimension attributes
ushort type, // type of dimension
ushort init, // initialize (or just calculate box)
t_dimension *dim); // dimension data
EXT(218) void PrintDimVal( // print dimension text
double value, // measured value
char *str, // string buffer to fill
char *tol1, // tolerance string 1
char *tol2); // tolerance string 2
EXT(219) short ClickEntity( // let the user click a single entity
ulong filter, // allowed entity types
double *pnt, // point where entity was clicked
t_entity *ent, // entity data to be filled in
void *edta, // data ptr of variable length entities
ushort esiz); // size of data buffer
EXT(220) ulong ExChangeEntity(// exchange an entity, returns new ID
t_entity *ent); // new entity data, old id
EXT(221) short Blink( // draw something blinking
tCallBack func, // callback function
void *para); // data pointer for callback function
EXT(222) void EntityLoop( // loop through all entities
ulong filter, // allowed entity types
tCallBack func, // callback function
void *para, // data pointer for callback function
void *edta, // data ptr of variable length entities
ushort esiz); // size of data buffer
EXT(223) void DrawEntities( // draw array of entity-id's
ulong *pid, // array of entity-id's
ushort num); // number of id's
EXT(224) short StringInput( // input a line of text
char *title, // title string
char *buf, // string buffer to be filled in
ushort buflen); // size of buffer
EXT(225) void SelectInit( // set select filter
ulong filter); // allowed entity types
EXT(226) void SelectLoop( // select entities
tCallBack func, // callback function
void *para, // data pointer for callback function
void *edta, // data ptr of variable length entities
ushort esiz); // size of data buffer
EXT(227) ushort InsertMacro( // insert macro-file
char *fname, // macro filename
tCallBack func, // callback function
void *para, // data pointer for callback function
void *edta, // data ptr of variable length entities
ushort esiz, // size of data buffer
t_placemac *pmac); // how (and where) to place the macro
EXT(228) ushort CalcPattern( // calc perimeter, area, pt. of gravity
ushort which, // PERIM, AREA, GRAVITY
ushort cnt, // cnt of polyline points
t_polypt *ppt, // maybe NULL
double *result); // value vs. point
EXT(229) ushort DeleteEntity( // delete an entity
ulong id); // ID of entity
EXT(230) ushort GetEntity( // get entity data
ulong id, // ID of entity
t_entity *ent, // entity
void *edta, // data ptr of variable length entities
ushort esiz); // size of data buffer
EXT(231) void SetIncPnt( // set incremental point
double *pnt); // new incremental point
EXT(232) void InfoLoop( // loop through all entity infos
tCallBack func, // callback function
t_entinfo *inf ); // info buffer
EXT(233) ushort GetInfo( // get entity info data
ushort iID, // info ID
t_entinfo *inf ); // info buffer
EXT(234) ushort StoreInfo( // store entity info
t_entinfo *inf ); // info buffer
EXT(235) ushort ExChangeInfo( // exchange entity info data
t_entinfo *inf ); // info buffer
EXT(236) void GetAttributes( // get attributes (stl,col...)
ushort type, // entity type
t_attribs *attr); // buffer to be filled in
EXT(237) void GetLayerBits( // retrieve active/inactive layers
uchar *bits); // buffer of 32 bytes (256 bits)
EXT(238) void GetGroupBits( // retrieve active/inactive groups
uchar *bits); // buffer of 32 bytes (256 bits)
EXT(239) void GetLayerNames( // retrieve layer names
t_laygrp *lg); // buffer of 256 * 64 bytes
EXT(240) void GetGroupNames( // retrieve group names
t_laygrp *lg); // buffer of 256 * 64 bytes
EXT(241) void GetGridSets( // retrieve grid settings
t_gridsets *grid); // buffer to be filled in
EXT(242) void SetAttributes( // alter attributes (stl,col...)
ushort type, // entity type
t_attribs *attr); // new attributes
EXT(243) void SetLayerBits( // set active/inactive layers
uchar *bits); // new bits (32 bytes/256 bits)
EXT(244) void SetGroupBits( // set active/inactive groups
uchar *bits); // new bits (32 bytes/256 bits)
EXT(245) void SetLayerNames( // set layer names
t_laygrp *lg); // buffer of 256 * 64 Bytes
EXT(246) void SetGroupNames( // set group names
t_laygrp *lg); // buffer of 256 * 64 Bytes
EXT(247) void SetGridSets( // alter grid settings
t_gridsets *grid); // new settings
EXT(248) short GetCurrentFile(// get name of currently loaded file
uchar *fname); // name buffer to be filled in
EXT(249) ulong CreateMacro( // create and insert a macro
t_macro *mac, // macro data
t_mkmacro *mkm, // entities to be created
ushort cnt, // number of entries
t_placemac *pmac); // how (and where) to place the macro
EXT(250) void MacroLoop( // loop through all macros
ulong filter, // allowed entity types
ulong start, // start ID (if 0L => all macros)
tCallBack func, // callback function
void *para, // data pointer for callback function
void *edta, // data ptr of variable length entities
ushort esiz); // size of data buffer
EXT(251) short ClickMacro( // let the user click a macro
double *pnt, // point where macro was clicked
t_entity *ent, // macro data to be filled in
void *edta, // data ptr of variable length entities
ushort esiz); // size of data buffer
EXT(252) short EntityLen( // retrieve the length of an entity
t_entity *ent, // entity to get length of
double *len); // resulting length
EXT(253) short PartList( // create a part list
uchar *fmt, // name of format file
uchar *out, // name of output file (maybe NULL)
uchar flags); // flags (PART_....)