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     Last edit by hansen on Mon Jan 19 18:15:49 2009
19 ****************************************************************************/
20 #include "tkgate.h"
21 
22 static iconDimensions ground_iconDims[] = {
23   {0, 0, 11, 11, 5, 5},
24   {12, 0, 11, 11, 5, 5},
25   {12, 12, 11, 11, 5, 5},
26   {0, 12, 11, 11, 5, 5},
27 };
28 static int ground_iconBoldOffset = 24;
29 
30 GPadLoc ground_out_loc[] = {
31   {0, -6, 0, -6, D_UP},
32   {-6, 0, -6, 0, D_LEFT},
33   {0, 6, 0, 6, D_DOWN},
34   {6, 0, 6, 0, D_RIGHT},
35 };
36 
37 static char *psGround[] = {
38   "%",
39   "% x y r ground",
40   "%",
41   "/psground {",
42   "  startgate",
43   "  -4 6 moveto 4 6 lineto stroke",
44   "  -3 4 moveto 3 4 lineto stroke",
45   "  -2 2 moveto 2 2 lineto stroke",
46   "  -1 0 moveto 1 0 lineto stroke",
47   "  grestore",
48   "} def",
49   0
50 };
51 
52 GGateInfo gate_ground_info = {
53   0,
54   "GROUND",
55   "supply0",0x0,
56   "psground",psGround,
57   -1,-1,
58 
59   {{"g",	{"gm.signals",0},	{"gm.signals.ground",0,0,300},	"gat_make GROUND"},
60    {0}},
61 
62   ground_iconDims,
63 
64   1,{{"Z",OUT,1,1,ground_out_loc}},
65   {{5,15,LJ},{5,15,LJ},{5,15,LJ},{5,15,LJ}},
66   {1,1,1},
67 
68   {0},
69 
70   Generic_Make,
71   Nop_WriteCellDef,
72   Generic_Init,
73   Generic_Delete,
74   Generic_GetExtents,
75   Generic_HitDistance,
76   Generic_Draw,
77   Generic_Move,
78   Generic_Copy,
79   Err_AddInput,
80   Err_AddOutput,
81   Err_AddInOut,
82   Generic_Rotate,
83   Err_RemovePort,
84   Err_ChangePin,
85   Nop_SimInitFunc,
86   Nop_SimHitFunc,
87   Generic_PSWrite,
88   Generic_EditProps,
89   InOut_VerSave
90 };
91 
init_ground()92 void init_ground()
93 {
94   Pixmap P;
95 
96   P = Pixmap_registerFromFile("ground","ground.b");
97   gateinfo_iconInit(&gate_ground_info,P,ground_iconDims,ground_iconBoldOffset);
98   RegisterGate(&gate_ground_info);
99 }
100