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 Skvortsov on Wed Jun 17 17:15:02 2015
19 ****************************************************************************/
20 #include "tkgate.h"
21
22 static iconDimensions pulldown_iconDims[] = {
23 {0, 0, 11, 39, 5, 5},
24 {12, 0, 39, 11, 5, 5},
25 {51, 0, 11, 39, 5, 32},
26 {63, 0, 39, 11, 33, 5},
27 };
28 static int pulldown_iconBoldOffset = 39;
29
30 GPadLoc pulldown_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 *psPulldown[] = {
38 "%",
39 "% x y r ground",
40 "%",
41 "/pspulldown {",
42 " startgate",
43 " 0 6 moveto 0 4 lineto",
44 " 5 2 lineto",
45 " -5 -2 lineto",
46 " 5 -6 lineto",
47 " -5 -10 lineto",
48 " 5 -14 lineto",
49 " -5 -18 lineto",
50 " 0 -20 lineto",
51 " 0 -24 lineto stroke",
52 " -5 -24 moveto 5 -24 lineto stroke",
53 " -3 -28 moveto 3 -28 lineto stroke",
54 " -1 -32 moveto 1 -32 lineto stroke",
55 " grestore",
56 "} def",
57 0
58 };
59
60 GGateInfo gate_pulldown_info = {
61 0,
62 "PULLDOWN",
63 "tri0",0x0,
64 "pspulldown",psPulldown,
65 -1,-1,
66
67 {{"g", {"gm.signals",0}, {"gm.signals.pulldown",0,0,300}, "gat_make PULLDOWN"},
68 {0}},
69
70 pulldown_iconDims,
71
72 1,{{"Z",OUT,1,1,pulldown_out_loc}},
73 {{5,15,LJ},{5,15,LJ},{5,15,LJ},{5,15,LJ}},
74 {1,1,1},
75
76 {0},
77
78 Generic_Make,
79 Nop_WriteCellDef,
80 Generic_Init,
81 Generic_Delete,
82 Generic_GetExtents,
83 Generic_HitDistance,
84 Generic_Draw,
85 Generic_Move,
86 Generic_Copy,
87 Err_AddInput,
88 Err_AddOutput,
89 Err_AddInOut,
90 Generic_Rotate,
91 Err_RemovePort,
92 Err_ChangePin,
93 Nop_SimInitFunc,
94 Nop_SimHitFunc,
95 Generic_PSWrite,
96 Generic_EditProps,
97 InOut_VerSave
98 };
99
init_pulldown()100 void init_pulldown()
101 {
102 Pixmap P;
103
104 P = Pixmap_registerFromFile("pulldown","pulldown.b");
105 gateinfo_iconInit(&gate_pulldown_info,P,pulldown_iconDims,pulldown_iconBoldOffset);
106 RegisterGate(&gate_pulldown_info);
107 }
108