1 /*
2   shapes.h
3 
4   For Tux Paint
5   List of available shapes.
6 
7   Copyright (c) 2002-2020 by Bill Kendrick and others
8   bill@newbreedsoftware.com
9   http://www.tuxpaint.org/
10 
11   This program is free software; you can redistribute it and/or modify
12   it under the terms of the GNU General Public License as published by
13   the Free Software Foundation; either version 2 of the License, or
14   (at your option) any later version.
15 
16   This program is distributed in the hope that it will be useful,
17   but WITHOUT ANY WARRANTY; without even the implied warranty of
18   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19   GNU General Public License for more details.
20 
21   You should have received a copy of the GNU General Public License
22   along with this program; if not, write to the Free Software
23   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
24   (See COPYING.txt)
25 
26   June 14, 2002 - August 15, 2020
27   $Id$
28 */
29 
30 
31 
32 /* What shapes are available: */
33 
34 enum
35 {
36   SHAPE_SQUARE,
37   SHAPE_SQUARE_FILL,
38   SHAPE_RECTANGLE,
39   SHAPE_RECTANGLE_FILL,
40   SHAPE_CIRCLE,
41   SHAPE_CIRCLE_FILL,
42   SHAPE_ELLIPSE,
43   SHAPE_ELLIPSE_FILL,
44   SHAPE_TRIANGLE,
45   SHAPE_TRIANGLE_FILL,
46   SHAPE_PENTAGON,
47   SHAPE_PENTAGON_FILL,
48   SHAPE_RHOMBUS,
49   SHAPE_RHOMBUS_FILL,
50   SHAPE_OCTAGON,
51   SHAPE_OCTAGON_FILL,
52   SHAPE_TRIANGLE_STAR,
53   SHAPE_TRIANGLE_STAR_FILL,
54   SHAPE_RHOMBUS_STAR,
55   SHAPE_RHOMBUS_STAR_FILL,
56   SHAPE_PENTAGON_STAR,
57   SHAPE_PENTAGON_STAR_FILL,
58   NUM_SHAPES
59 };
60 
61 
62 /* How many sides do they have? */
63 
64 const int shape_sides[NUM_SHAPES] = {
65   4,                            /* Square */
66   4,                            /* Square */
67   4,                            /* Rectangle */
68   4,                            /* Rectangle */
69   72,                           /* Circle */
70   72,                           /* Circle */
71   72,                           /* Ellipse */
72   72,                           /* Ellipse */
73   3,                            /* Triangle */
74   3,                            /* Triangle */
75   5,                            /* Pentagon */
76   5,                            /* Pentagon */
77   4,                            /* Rhombus */
78   4,                            /* Rhombus */
79   8,                            /* Octagon */
80   8,                            /* Octagon */
81   3,                            /* 3 points star */
82   3,                            /* 3 points star */
83   4,                            /* 4 points star */
84   4,                            /* 4 points star */
85   5,                            /* 5 points star */
86   5                             /* 5 points star */
87 };
88 
89 
90 /* Which shapes are 1:1 aspect? */
91 
92 const int shape_locked[NUM_SHAPES] = {
93   1,                            /* Square */
94   1,                            /* Square */
95   0,                            /* Rectangle */
96   0,                            /* Rectangle */
97   1,                            /* Circle */
98   1,                            /* Circle */
99   0,                            /* Ellipse */
100   0,                            /* Ellipse */
101   0,                            /* Triangle */
102   0,                            /* Triangle */
103   0,                            /* Pentagon */
104   0,                            /* Pentagon */
105   0,                            /* Rhombus */
106   0,                            /* Rhombus */
107   1,                            /* Octagon */
108   1,                            /* Octagon */
109   0,                            /* 3 points star */
110   0,                            /* 3 points star */
111   0,                            /* 4 points star */
112   0,                            /* 4 points star */
113   0,                            /* 5 points star */
114   0                             /* 5 points star */
115 };
116 
117 
118 /* Which shapes are filled? */
119 
120 const int shape_filled[NUM_SHAPES] = {
121   0,                            /* Square */
122   1,                            /* Square */
123   0,                            /* Rectangle */
124   1,                            /* Rectangle */
125   0,                            /* Circle */
126   1,                            /* Circle */
127   0,                            /* Ellipse */
128   1,                            /* Ellipse */
129   0,                            /* Triangle */
130   1,                            /* Triangle */
131   0,                            /* Pentagon */
132   1,                            /* Pentagon */
133   0,                            /* Rhombus */
134   1,                            /* Rhombus */
135   0,                            /* Octagon */
136   1,                            /* Octagon */
137   0,                            /* 3 points star */
138   1,                            /* 3 points star */
139   0,                            /* 4 points star */
140   1,                            /* 4 points star */
141   0,                            /* 5 points star */
142   1                             /* 5 points star */
143 };
144 
145 
146 
147 /* Initial angles for shapes: */
148 
149 const int shape_init_ang[NUM_SHAPES] = {
150   45,                           /* Square */
151   45,                           /* Square */
152   45,                           /* Rectangle */
153   45,                           /* Rectangle */
154   0,                            /* Circle */
155   0,                            /* Circle */
156   0,                            /* Ellipse */
157   0,                            /* Ellipse */
158   210,                          /* Triangle */
159   210,                          /* Triangle */
160   162,                          /* Pentagon */
161   162,                          /* Pentagon */
162   0,                            /* Rhombus */
163   0,                            /* Rhombus */
164   22,                           /* Octagon */
165   22,                           /* Octagon */
166   210,                          /* 3 points star */
167   210,                          /* 3 points star */
168   0,                            /* 4 points star */
169   0,                            /* 4 points star */
170   162,                          /* 5 points star */
171   162                           /* 5 points star */
172 };
173 
174 
175 /* Shapes that don't make sense rotating (e.g., circles): */
176 
177 const int shape_no_rotate[NUM_SHAPES] = {
178   0,                            /* Square */
179   0,                            /* Square */
180   0,                            /* Rectangle */
181   0,                            /* Rectangle */
182   1,                            /* Circle */
183   1,                            /* Circle */
184   0,                            /* Ellipse */
185   0,                            /* Ellipse */
186   0,                            /* Triangle */
187   0,                            /* Triangle */
188   0,                            /* Pentagon */
189   0,                            /* Pentagon */
190   0,                            /* Rhombus */
191   0,                            /* Rhombus */
192   0,                            /* Octagon */
193   0,                            /* Octagon */
194   0,                            /* 3 points star */
195   0,                            /* 3 points star */
196   0,                            /* 4 points star */
197   0,                            /* 4 points star */
198   0,                            /* 5 points star */
199   0                             /* 5 points star */
200 };
201 
202 /* Valley of stars in percent of size */
203 
204 const int shape_valley[NUM_SHAPES] = {
205   100,                          /* Square */
206   100,                          /* Square */
207   100,                          /* Rectangle */
208   100,                          /* Rectangle */
209   100,                          /* Circle */
210   100,                          /* Circle */
211   100,                          /* Ellipse */
212   100,                          /* Ellipse */
213   100,                          /* Triangle */
214   100,                          /* Triangle */
215   100,                          /* Pentagon */
216   100,                          /* Pentagon */
217   100,                          /* Rhombus */
218   100,                          /* Rhombus */
219   100,                          /* Octagon */
220   100,                          /* Octagon */
221   20,                           /* 3 points star */
222   20,                           /* 3 points star */
223   30,                           /* 4 points star */
224   30,                           /* 4 points star */
225   35,                           /* 5 points star */
226   35                            /* 5 points star */
227 };
228 
229 
230 /* Shape names: */
231 
232 const char *const shape_names[NUM_SHAPES] = {
233   // Square shape tool (4 equally-lengthed sides at right angles)
234   gettext_noop("Square"),
235   gettext_noop("Square"),
236 
237   // Rectangle shape tool (4 sides at right angles)
238   gettext_noop("Rectangle"),
239   gettext_noop("Rectangle"),
240 
241   // Circle shape tool (X radius and Y radius are the same)
242   gettext_noop("Circle"),
243   gettext_noop("Circle"),
244 
245   // Ellipse shape tool (X radius and Y radius may differ)
246   gettext_noop("Ellipse"),
247   gettext_noop("Ellipse"),
248 
249   // Triangle shape tool (3 sides)
250   gettext_noop("Triangle"),
251   gettext_noop("Triangle"),
252 
253   // Pentagone shape tool (5 sides)
254   gettext_noop("Pentagon"),
255   gettext_noop("Pentagon"),
256 
257   // Rhombus shape tool (4 sides, not at right angles)
258   gettext_noop("Rhombus"),
259   gettext_noop("Rhombus"),
260 
261   // Octagon shape tool (8 sides)
262   gettext_noop("Octagon"),
263   gettext_noop("Octagon"),
264 
265   // Triangle star (3 points star)
266   gettext_noop("Star"),
267 
268   // Triangle star (3 points star)
269   gettext_noop("Star"),
270 
271   // Rhombus star (4 points star)
272   gettext_noop("Star"),
273 
274   // Rhombus star (4 points star)
275   gettext_noop("Star"),
276 
277   // Pentagone star (5 points star)
278   gettext_noop("Star"),
279 
280   // Pentagone star (5 points star)
281   gettext_noop("Star")
282 };
283 
284 
285 /* Some text to write when each shape is selected: */
286 
287 const char *const shape_tips[NUM_SHAPES] = {
288   // Description of a square
289   gettext_noop("A square is a rectangle with four equal sides."),
290   gettext_noop("A square is a rectangle with four equal sides."),
291 
292   // Description of a rectangle
293   gettext_noop("A rectangle has four sides and four right angles."),
294   gettext_noop("A rectangle has four sides and four right angles."),
295 
296   // Description of a circle
297   gettext_noop("A circle is a curve where all points have the same distance from the center."),
298   gettext_noop("A circle is a curve where all points have the same distance from the center."),
299 
300   // Description of an ellipse
301   gettext_noop("An ellipse is a stretched circle."),
302   gettext_noop("An ellipse is a stretched circle."),
303 
304   // Description of a triangle
305   gettext_noop("A triangle has three sides."),
306   gettext_noop("A triangle has three sides."),
307 
308   // Description of a pentagon
309   gettext_noop("A pentagon has five sides."),
310   gettext_noop("A pentagon has five sides."),
311 
312   // Description of a rhombus
313   gettext_noop("A rhombus has four equal sides, and opposite sides are parallel."),
314   gettext_noop("A rhombus has four equal sides, and opposite sides are parallel."),
315 
316   // Description of an octagon
317   gettext_noop("An octagon has eight equal sides."),
318   gettext_noop("An octagon has eight equal sides."),
319 
320   gettext_noop("A star with 3 points."),
321   gettext_noop("A star with 3 points."),
322   gettext_noop("A star with 4 points."),
323   gettext_noop("A star with 4 points."),
324   gettext_noop("A star with 5 points."),
325   gettext_noop("A star with 5 points.")
326 };
327 
328 
329 /* Shape icon filenames: */
330 
331 const char *const shape_img_fnames[NUM_SHAPES] = {
332   DATA_PREFIX "images/shapes/square.png",
333   DATA_PREFIX "images/shapes/square_f.png",
334   DATA_PREFIX "images/shapes/rectangle.png",
335   DATA_PREFIX "images/shapes/rectangle_f.png",
336   DATA_PREFIX "images/shapes/circle.png",
337   DATA_PREFIX "images/shapes/circle_f.png",
338   DATA_PREFIX "images/shapes/oval.png",
339   DATA_PREFIX "images/shapes/oval_f.png",
340   DATA_PREFIX "images/shapes/triangle.png",
341   DATA_PREFIX "images/shapes/triangle_f.png",
342   DATA_PREFIX "images/shapes/pentagon.png",
343   DATA_PREFIX "images/shapes/pentagon_f.png",
344   DATA_PREFIX "images/shapes/diamond.png",
345   DATA_PREFIX "images/shapes/diamond_f.png",
346   DATA_PREFIX "images/shapes/octagon.png",
347   DATA_PREFIX "images/shapes/octagon_f.png",
348   DATA_PREFIX "images/shapes/star3p.png",
349   DATA_PREFIX "images/shapes/star3p_f.png",
350   DATA_PREFIX "images/shapes/star4p.png",
351   DATA_PREFIX "images/shapes/star4p_f.png",
352   DATA_PREFIX "images/shapes/star5p.png",
353   DATA_PREFIX "images/shapes/star5p_f.png"
354 };
355 
356 
357 /* Shape controls */
358 
359 enum
360 {
361   SHAPEMODE_CENTER,
362   SHAPEMODE_CORNER,
363   NUM_SHAPEMODES
364 };
365 
366 const char *const shapemode_img_fnames[NUM_SHAPEMODES] = {
367   DATA_PREFIX "images/ui/shapes_center.png",
368   DATA_PREFIX "images/ui/shapes_corner.png"
369 };
370 
371 const char *const shapemode_tips[NUM_SHAPES] = {
372   gettext_noop("Draw shapes from the center."),
373   gettext_noop("Draw shapes from a corner."),
374 };
375