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 text_object.h
21  *
22  *  \brief Functions operating on text drawing objects
23  */
24 
25 G_BEGIN_DECLS
26 
27 #define DEFAULT_TEXT_SIZE 10
28 #define MINIMUM_TEXT_SIZE 1
29 
30 /* construction, destruction */
31 
32 LeptonObject*
33 lepton_text_object_new (gint color,
34                         gint x,
35                         gint y,
36                         gint alignment,
37                         gint angle,
38                         const gchar *string,
39                         gint size,
40                         gint visibility,
41                         gint show_name_value);
42 LeptonObject*
43 lepton_text_object_copy (const LeptonObject *object);
44 
45 /* methods */
46 
47 gboolean
48 lepton_text_object_calculate_bounds (const LeptonObject *object,
49                                      gboolean include_hidden,
50                                      LeptonBounds *bounds);
51 gint
52 lepton_text_object_get_alignment (const LeptonObject *object);
53 
54 gint
55 lepton_text_object_get_angle (const LeptonObject *object);
56 
57 gboolean
58 lepton_text_object_get_position (const LeptonObject *object,
59                                  gint *x,
60                                  gint *y);
61 gint
62 lepton_text_object_get_size (const LeptonObject *object);
63 
64 gdouble
65 lepton_text_object_get_size_in_points (const LeptonObject *object);
66 
67 const gchar*
68 lepton_text_object_get_name (const LeptonObject *object);
69 
70 void
71 lepton_text_object_set_name (const LeptonObject *object,
72                              const char *name);
73 const gchar*
74 lepton_text_object_get_value (const LeptonObject *object);
75 
76 void
77 lepton_text_object_set_value (LeptonObject *object,
78                               const char *value);
79 const gchar*
80 lepton_text_object_get_string (const LeptonObject *object);
81 
82 gint
83 lepton_text_object_get_x (const LeptonObject *object);
84 
85 gint
86 lepton_text_object_get_y (const LeptonObject *object);
87 
88 gint
89 lepton_text_object_get_show (const LeptonObject *object);
90 
91 void
92 lepton_text_object_mirror (int world_centerx,
93                            int world_centery,
94                            LeptonObject *object);
95 void
96 lepton_text_object_rotate (int world_centerx,
97                            int world_centery,
98                            int angle,
99                            LeptonObject *object);
100 void
101 lepton_text_object_set_alignment (LeptonObject *object,
102                                   gint alignment);
103 void
104 lepton_text_object_set_angle (LeptonObject *object,
105                               gint angle);
106 void
107 lepton_text_object_set_size (LeptonObject *object,
108                              gint size);
109 void
110 lepton_text_object_set_x (LeptonObject *object,
111                           gint x);
112 void
113 lepton_text_object_set_y (LeptonObject *object,
114                           gint y);
115 void
116 lepton_text_object_set_show (LeptonObject *object,
117                              gint show);
118 double
119 lepton_text_object_shortest_distance (LeptonObject *object,
120                                       int x,
121                                       int y,
122                                       int force_soild,
123                                       gboolean include_hidden);
124 gchar*
125 lepton_text_object_to_buffer (const LeptonObject *object);
126 
127 void
128 lepton_text_object_translate (LeptonObject *object,
129                               int dx,
130                               int dy);
131 
132 /* older methods, need renaming */
133 
134 void
135 lepton_text_object_recreate (LeptonObject *o_current);
136 
137 void
138 lepton_text_object_set_string (LeptonObject *obj,
139                                const gchar *new_string);
140 LeptonObject*
141 lepton_text_object_read (const char *first_line,
142                          TextBuffer *tb,
143                          unsigned int release_ver,
144                          unsigned int fileformat_ver,
145                          GError **err);
146 gboolean
147 lepton_text_object_is_visible (const LeptonObject *object);
148 
149 void
150 lepton_text_object_set_visibility (LeptonObject *object,
151                                    int visibility);
152 gint
153 lepton_text_object_get_visibility (const LeptonObject *object);
154 
155 const char*
156 lepton_text_object_visible_string (const LeptonObject *object);
157 
158 const char*
159 lepton_text_object_alignment_to_string (gint alignment);
160 
161 gint
162 lepton_text_object_alignment_from_string (char *s);
163 
164 const char*
165 lepton_text_object_show_to_string (gint show);
166 
167 gint
168 lepton_text_object_show_from_string (char *s);
169 
170 G_END_DECLS
171