1 /**************************************************************************** 2 Copyright (C) 1987-2015 by Jeffery P. Hansen 3 4 This program is free software; you can redistribute it and/or modify 5 it under the terms of the GNU General Public License as published by 6 the Free Software Foundation; either version 2 of the License, or 7 (at your option) any later version. 8 9 This program is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 GNU General Public License for more details. 13 14 You should have received a copy of the GNU General Public License along 15 with this program; if not, write to the Free Software Foundation, Inc., 16 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 ****************************************************************************/ 18 #ifndef __modsym_h 19 #define __modsym_h 20 21 /* 22 * GModSymPort - Symbol port definition. This is a helping class for 23 * the GModSymbol class. 24 */ 25 typedef struct { 26 char *msp_name; /* Name of port */ 27 int msp_x,msp_y; /* Position of port */ 28 int msp_type; /* Type of port (IN, OUT, INOUT) */ 29 int msp_orient; /* Base orientation */ 30 int msp_size; /* Number of bits */ 31 GPadLoc msp_loc[NUMORIENTS]; /* Pad info for this port. */ 32 } GSymPort; 33 34 /* 35 * GMIconData - Data about an icon 36 */ 37 typedef struct { 38 char *data; /* Data for the icon */ 39 int x,y; /* Offset for edit window (and port offset) */ 40 unsigned w,h; /* Size of the icon */ 41 } GMIconData; 42 43 /* 44 * GModSymbol - Data structure for module symbols 45 */ 46 struct GModSymbol_str { 47 int ms_gid; /* MSS ID for icons */ 48 int ms_refCount; /* Reference count of this symbol */ 49 int ms_mark; /* Generic mark */ 50 GMIconData ms_normal; /* Data for normal icon */ 51 GMIconData ms_select; /* Data for select icon */ 52 int ms_basex,ms_basey; /* Base x/y point */ 53 int ms_cx,ms_cy; /* Center point */ 54 int ms_ix[2][4],ms_iy[2][4]; /* Icon offset by orientation and bold/normal */ 55 int ms_finalized; /* Symbol has been finalized */ 56 int ms_numPorts; /* Number of ports */ 57 GSymPort **ms_ports; /* Array of ports */ 58 }; 59 60 /* 61 * GSymPort methods 62 */ 63 GSymPort *new_GSymPort(const char *name,int x,int y,int t,int r,int s); 64 void delete_GSymPort(GSymPort*); 65 66 /* 67 * GModSymbol methods 68 */ 69 GModSymbol *new_GModSymbol(); /* Create a new module symbol */ 70 GModSymbol *copy_GModSymbol(GModSymbol *); /* Create a copy of a module symbol */ 71 void GModSymbol_attach(GModSymbol *ms); /* Attach this symbol to something */ 72 void GModSymbol_detach(GModSymbol *ms); /* Detach this symbol from somthing */ 73 void GModSymbol_setNormalIcon(GModSymbol *ms,const char*,int,int); 74 void GModSymbol_setSelectIcon(GModSymbol *ms,const char*,int,int); 75 const char *GModSymbol_getNormalIcon(GModSymbol *ms,int*,int*); 76 const char *GModSymbol_getSelectIcon(GModSymbol *ms,int*,int*); 77 void GModSymbol_addPort(GModSymbol *ms,GSymPort *p); 78 void GModSymbol_flushPorts(GModSymbol *ms); 79 void GModSymbol_draw(GModSymbol *ms,int x,int y,int r,int isBold); 80 int GModSymbol_numPorts(GModSymbol *ms); 81 void GModSymbol_getExtents(GModSymbol *ms,int r,int *minx,int *miny,int *maxx,int *maxy); 82 GSymPort *GModSymbol_getPort(GModSymbol *ms,int p); 83 84 HashElem *GModSymbol_first(); 85 HashElem *GModSymbol_next(HashElem*); 86 87 #endif 88