1 /* Lepton EDA library
2  * Copyright (C) 1998-2010 Ales Hvezda
3  * Copyright (C) 1998-2016 gEDA Contributors
4  * Copyright (C) 2017-2021 Lepton EDA Contributors
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 /*! \file pin_object.h
21  *
22  *  \brief Functions operating on pin drawing objects
23  */
24 
25 G_BEGIN_DECLS
26 
27 /* construction, destruction */
28 
29 LeptonObject*
30 lepton_pin_object_new (int color,
31                        int x1,
32                        int y1,
33                        int x2,
34                        int y2,
35                        int pin_type,
36                        int whichend);
37 LeptonObject*
38 lepton_pin_object_new_net_pin (int color,
39                                int x1,
40                                int y1,
41                                int x2,
42                                int y2,
43                                int whichend);
44 LeptonObject*
45 lepton_pin_object_new_bus_pin (int color,
46                                int x1,
47                                int y1,
48                                int x2,
49                                int y2,
50                                int whichend);
51 LeptonObject*
52 lepton_pin_object_copy (LeptonObject *o_current);
53 
54 /* Helpers. */
55 gboolean
56 lepton_pin_object_is_bus_pin (const LeptonObject *object);
57 
58 gboolean
59 lepton_pin_object_is_net_pin (const LeptonObject *object);
60 
61 /* methods */
62 
63 void
64 lepton_pin_object_calculate_bounds (const LeptonObject *object,
65                                     LeptonBounds *bounds);
66 gboolean
67 lepton_pin_object_get_position (const LeptonObject *object,
68                                 gint *x,
69                                 gint *y);
70 gint
71 lepton_pin_object_get_width (const LeptonObject *object);
72 
73 gint
74 lepton_pin_object_get_x0 (const LeptonObject *object);
75 
76 gint
77 lepton_pin_object_get_x1 (const LeptonObject *object);
78 
79 gint
80 lepton_pin_object_get_y0 (const LeptonObject *object);
81 
82 gint
83 lepton_pin_object_get_y1 (const LeptonObject *object);
84 
85 void
86 lepton_pin_object_mirror (int world_centerx,
87                           int world_centery,
88                           LeptonObject *object);
89 void
90 lepton_pin_object_modify (LeptonObject *object,
91                           int x,
92                           int y,
93                           int whichone);
94 void
95 lepton_pin_object_rotate (int world_centerx,
96                           int world_centery,
97                           int angle,
98                           LeptonObject *object);
99 void
100 lepton_pin_object_set_type (LeptonObject *o_current,
101                             int pin_type);
102 void
103 lepton_pin_object_set_x0 (LeptonObject *object, gint x);
104 
105 void
106 lepton_pin_object_set_x1 (LeptonObject *object, gint x);
107 
108 void
109 lepton_pin_object_set_y0 (LeptonObject *object, gint y);
110 
111 void
112 lepton_pin_object_set_y1 (LeptonObject *object, gint y);
113 
114 gchar*
115 lepton_pin_object_to_buffer (const LeptonObject *object);
116 
117 void
118 lepton_pin_object_translate (LeptonObject *object,
119                              int dx,
120                              int dy);
121 void
122 lepton_pin_object_update_whichend (GList *object_list,
123                                    int num_pins);
124 LeptonObject*
125 lepton_pin_object_read (const char buf[],
126                         unsigned int release_ver,
127                         unsigned int fileformat_ver,
128                         GError **err);
129 
130 G_END_DECLS
131