Text Macro
Beside the usage of the integrated Text feature, own text can be created. This macro show how.
Download: text.layout
1 #!/usr/bin/layout
2 #name=add text
3 #help=Adds text into the layout, the starting point is given by a selected box;
4 /***
5 * written by Arun (arun@users.sf.net) 2006-04
6 * using layout version 2006-4-01 (cvs)
7 *
8 * this is just to show what macros can do...
9 * it worked for me, but your mileage may vary
10 *
11 * the font is similar to dotmatrix used by figlet (http://www.figlet.org)
12 *
13 * TODO: add nicer numbers
14 * TODO: antialias a bit.
15 *
16 * Changelog:
17 * 2008-04-09 Arun Persaud
18 * added missing letters,
19 * some better error messages
20 * some antialiasing
21 */
22
23 int main()
24 {
25 cellList *cells;
26 elementList *elements;
27 element *element;
28 cell *cell;
29
30 int selected = 0; /* was something selected */
31 int layernr;
32 int x,y;
33
34 /* check if something was selected at all */
35 for(cells = layout->drawing->firstCell; cells!=NULL; cells=cells->nextCell)
36 {
37 if(cells->thisCell!=NULL)
38 {
39 for(elements=cells->thisCell->firstElement; elements!=NULL; elements=elements->nextElement)
40 {
41 if(elements->thisElement!=NULL)
42 if(elements->thisElement->select)
43 {
44 selected++;
45 /* save cell and element for later */
46 element = elements->thisElement;
47 cell = cells->thisCell;
48 /* only change selected boxes */
49 if(element->isBox())
50 {
51 /* get layer number */
52 layernr = element->layerNum;
53
54 /* get coordinates */
55 pointArray pa = element->getPoints();
56
57 int x1,y1,x2,y2;
58 point p;
59
60 if(pa.size()==2) /* shouldn't be anything else */
61 {
62 p=pa.point(0);
63 x1=p.x();
64 y1=p.y();
65
66 p=pa.point(1);
67 x2=p.x();
68 y2=p.y();
69
70 /* always make x/y the lower left corner */
71 if(x1>x2)
72 x=x2;
73 else
74 x=x1;
75
76 if(y1>y2)
77 y=y2;
78 else
79 y=y1;
80 };
81 };
82 }; /* end if element selected */
83 };
84 };
85 };
86
87 if(selected == 0)
88 {
89 layout->showMessage("Macro Help",
90 "To use this macro select one box and the macro will add the user specified \n"+
91 "text \nstarting at the lower left corner of that box (and delete the box).\n");
92 }
93 else if(selected > 1)
94 {
95 layout->showMessage("Macro Help",
96 "To use this macro select one box and the macro will add the user specified \n"+
97 "text \nstarting at the lower left corner of that box (and delete the box).\n"+
98 "At the moment there are "+selected+" selected objects, but the macro needs exactly one selected item.\n");
99 }
100 else
101 {
102 int i;
103 int nonimplemented=0;
104
105 string s=layout->getText("Input",
106 "Please input the text you want to insert. At the moment\n"+
107 " only letters and numbers are implemented.");
108
109 double w = layout->getDouble("Input","Please input the line width \n(the font height will be max. nine times the line width):");
110
111 double user_unit = layout->drawing->userunits;
112
113 /* from user units to internal units */
114 w = w / user_unit;
115 for(i=0; i<s.length(); i++)
116 {
117 string letter;
118 letter = s.mid(i,1);
119 if(letter=="a" )
120 {
121 cell->addBox(x, y+w, w, w,layernr);
122 cell->addBox(x+w, y, 3*w, w,layernr);
123 cell->addBox(x+w, y+2*w, 3*w, w,layernr);
124 cell->addBox(x+w, y+4*w, 3*w, w,layernr);
125 cell->addBox(x+4*w, y+w, w, 3*w,layernr);
126 cell->addBox(x+5*w, y, w, w,layernr);
127 x=x+w*6;
128 }
129 else if(letter=="A" )
130 {
131 cell->addBox(x+w*0, y+w*0, 1*w,4*w,layernr);
132 cell->addBox(x+w*6, y+w*0, 1*w,4*w,layernr);
133 cell->addBox(x+w*1, y+w*2, 5*w,1*w,layernr);
134 cell->addBox(x+w*1, y+w*4, 1*w,1*w,layernr);
135 cell->addBox(x+w*2, y+w*5, 1*w,1*w,layernr);
136 cell->addBox(x+w*3, y+w*6, 1*w,1*w,layernr);
137 cell->addBox(x+w*4, y+w*5, 1*w,1*w,layernr);
138 cell->addBox(x+w*5, y+w*4, 1*w,1*w,layernr);
139 x=x+w*7;
140 }
141 else if(letter=="b" )
142 {
143 cell->addBox(x, y, w,7*w,layernr);
144 cell->addBox(x+w, y, 3*w, w,layernr);
145 cell->addBox(x+w, y+4*w, 3*w, w,layernr);
146 cell->addBox(x+4*w, y+w, w,3*w,layernr);
147 x=x+w*5;
148 }
149 else if(letter=="B" )
150 {
151 cell->addBox(x+w*0, y+w*0, 5*w,1*w,layernr);
152 cell->addBox(x+w*0, y+w*6, 5*w,1*w,layernr);
153 cell->addBox(x+w*1, y+w*1, 1*w,5*w,layernr);
154 cell->addBox(x+w*2, y+w*3, 3*w,1*w,layernr);
155 cell->addBox(x+w*5, y+w*1, 1*w,2*w,layernr);
156 cell->addBox(x+w*5, y+w*4, 1*w,2*w,layernr);
157 x=x+w*6;
158 }
159 else if(letter=="c" )
160 {
161 cell->addBox(x, y+w, w,3*w,layernr);
162 cell->addBox(x+w, y+4*w, 3*w, w,layernr);
163 cell->addBox(x+w, y, 3*w, w,layernr);
164 x=x+w*4;
165 }
166 else if(letter=="C" )
167 {
168 cell->addBox(x+w*0, y+w*1, 1*w,5*w,layernr);
169 cell->addBox(x+w*1, y+w*0, 3*w,1*w,layernr);
170 cell->addBox(x+w*1, y+w*6, 3*w,1*w,layernr);
171 cell->addBox(x+w*4, y+w*1, 1*w,1*w,layernr);
172 cell->addBox(x+w*4, y+w*5, 1*w,1*w,layernr);
173 x=x+w*5;
174 }
175 else if(letter=="d" )
176 {
177 cell->addBox(x, y+w, w,3*w,layernr);
178 cell->addBox(x+w, y+4*w, 3*w, w,layernr);
179 cell->addBox(x+w, y, 3*w, w,layernr);
180 cell->addBox(x+w*4, y, w,6*w,layernr);
181 x=x+w*5;
182 }
183 else if(letter=="D" )
184 {
185 cell->addBox(x+w*0, y+w*0, 4*w,1*w,layernr);
186 cell->addBox(x+w*0, y+w*6, 4*w,1*w,layernr);
187 cell->addBox(x+w*1, y+w*1, 1*w,5*w,layernr);
188 cell->addBox(x+w*4, y+w*1, 1*w,1*w,layernr);
189 cell->addBox(x+w*4, y+w*5, 1*w,1*w,layernr);
190 cell->addBox(x+w*5, y+w*2, 1*w,3*w,layernr);
191 x=x+w*6;
192 }
193 else if(letter=="e" )
194 {
195 cell->addBox(x, y+w, w,3*w,layernr);
196 cell->addBox(x+w, y, 4*w, w,layernr);
197 cell->addBox(x+w, y+2*w, 4*w, w,layernr);
198 cell->addBox(x+w, y+4*w, 4*w, w,layernr);
199 cell->addBox(x+w*4, y+w*3, w, w,layernr);
200 x=x+w*5;
201 }
202 else if(letter=="E" )
203 {
204 cell->addBox(x+w*0, y+w*0, 1*w,7*w,layernr);
205 cell->addBox(x+w*1, y+w*0, 4*w,1*w,layernr);
206 cell->addBox(x+w*1, y+w*3, 2*w,1*w,layernr);
207 cell->addBox(x+w*1, y+w*6, 4*w,1*w,layernr);
208 x=x+w*5;
209 }
210 else if(letter=="f" )
211 {
212 cell->addBox(x, y+4*w, 3*w, w,layernr);
213 cell->addBox(x+w, y, w,6*w,layernr);
214 cell->addBox(x+w*2, y+6*w, 2*w, w,layernr);
215 x=x+w*4;
216 }
217 else if(letter=="F" )
218 {
219 cell->addBox(x+w*0, y+w*0, 1*w,7*w,layernr);
220 cell->addBox(x+w*1, y+w*3, 2*w,1*w,layernr);
221 cell->addBox(x+w*1, y+w*6, 4*w,1*w,layernr);
222 x=x+w*5;
223 }
224 else if(letter=="g" )
225 {
226 cell->addBox(x, y+w, w,3*w,layernr);
227 cell->addBox(x+w, y, 3*w, w,layernr);
228 cell->addBox(x+w, y+4*w, 3*w, w,layernr);
229 cell->addBox(x+w, y-2*w, 3*w, w,layernr);
230 cell->addBox(x+w*4, y-w, w,6*w,layernr);
231 x=x+w*5;
232 }
233 else if(letter=="G" )
234 {
235 cell->addBox(x+w*0, y+w*1, 1*w,5*w,layernr);
236 cell->addBox(x+w*1, y+w*0, 4*w,1*w,layernr);
237 cell->addBox(x+w*1, y+w*6, 3*w,1*w,layernr);
238 cell->addBox(x+w*4, y+w*5, 1*w,1*w,layernr);
239 cell->addBox(x+w*4, y+w*1, 1*w,2*w,layernr);
240 cell->addBox(x+w*2, y+w*3, 3*w,1*w,layernr);
241 x=x+w*5;
242 }
243 else if(letter=="h" )
244 {
245 cell->addBox(x, y, w,7*w,layernr);
246 cell->addBox(x+w, y+4*w, 3*w, w,layernr);
247 cell->addBox(x+4*w, y, w,4*w,layernr);
248 x=x+w*5;
249 }
250 else if(letter=="H" )
251 {
252 cell->addBox(x+w*0, y+w*0, 1*w,7*w,layernr);
253 cell->addBox(x+w*1, y+w*3, 3*w,1*w,layernr);
254 cell->addBox(x+w*4, y+w*0, 1*w,7*w,layernr);
255 x=x+w*5;
256 }
257 else if(letter=="i" )
258 {
259 cell->addBox(x, y, 3*w, w,layernr);
260 cell->addBox(x+w, y+w, w,4*w,layernr);
261 cell->addBox(x+w, y+w*6, w, w,layernr);
262 cell->addBox(x+w, y+4*w, w, w,layernr);
263 x=x+w*3;
264 }
265 else if(letter=="I" )
266 {
267 cell->addBox(x+w*0, y+w*0, 3*w,1*w,layernr);
268 cell->addBox(x+w*1, y+w*1, 1*w,5*w,layernr);
269 cell->addBox(x+w*0, y+w*6, 3*w,1*w,layernr);
270 x=x+w*3;
271 }
272 else if(letter=="j" )
273 {
274 cell->addBox(x, y-w, w, w,layernr);
275 cell->addBox(x+w, y-2*w, 2*w, w,layernr);
276 cell->addBox(x+w*3, y-w, w, w,layernr);
277 cell->addBox(x+w*4, y, w,5*w,layernr);
278 cell->addBox(x+w*4, y+w*6, w, w,layernr);
279 cell->addBox(x+w*3, y+w*4, w, w,layernr);
280 x=x+w*5;
281 }
282 else if(letter=="J" )
283 {
284 cell->addBox(x+w*1, y+w*0, 3*w,1*w,layernr);
285 cell->addBox(x+w*0, y+w*1, 1*w,1*w,layernr);
286 cell->addBox(x+w*4, y+w*1, 1*w,5*w,layernr);
287 cell->addBox(x+w*3, y+w*6, 3*w,1*w,layernr);
288 x=x+w*6;
289 }
290 else if(letter=="k" )
291 {
292 cell->addBox(x, y, w,7*w,layernr);
293 cell->addBox(x+w, y+2*w, w, w,layernr);
294 cell->addBox(x+w*2, y+w, w, w,layernr);
295 cell->addBox(x+w*2, y+w*3, w, w,layernr);
296 cell->addBox(x+w*3, y, w, w,layernr);
297 cell->addBox(x+w*3, y+w*4, w, w,layernr);
298 x=x+w*4;
299 }
300 else if(letter=="K" )
301 {
302 cell->addBox(x, y, w,7*w,layernr);
303 cell->addBox(x+w, y+3*w, w, w,layernr);
304 cell->addBox(x+w*2, y+w*2, w, w,layernr);
305 cell->addBox(x+w*2, y+w*4, w, w,layernr);
306 cell->addBox(x+w*3, y+w*1, w, w,layernr);
307 cell->addBox(x+w*3, y+w*5, w, w,layernr);
308 cell->addBox(x+w*4, y+w*0, w, w,layernr);
309 cell->addBox(x+w*4, y+w*6, w, w,layernr);
310 x=x+w*5;
311 }
312 else if(letter=="l" )
313 {
314 cell->addBox(x, y, 3*w, w,layernr);
315 cell->addBox(x+w, y+w, w,6*w,layernr);
316 cell->addBox(x, y+6*w, w, w,layernr);
317 x=x+w*4;
318 }
319 else if(letter=="L" )
320 {
321 cell->addBox(x, y, 1*w, 7*w,layernr);
322 cell->addBox(x+w, y, 4*w, 1*w,layernr);
323 x=x+w*5;
324 }
325 else if(letter=="m" )
326 {
327 cell->addBox(x, y, w,4*w,layernr);
328 cell->addBox(x+w, y+4*w, 2*w, w,layernr);
329 cell->addBox(x+w*3, y, w,4*w,layernr);
330 cell->addBox(x+w*4, y+4*w, 2*w, w,layernr);
331 cell->addBox(x+w*6, y, w,4*w,layernr);
332 x=x+w*7;
333 }
334 else if(letter=="M" )
335 {
336 cell->addBox(x, y, w,7*w,layernr);
337 cell->addBox(x+w, y+w*5, w, w,layernr);
338 cell->addBox(x+w*2, y+w*4, w, w,layernr);
339 cell->addBox(x+w*3, y+w*3, w, w,layernr);
340 cell->addBox(x+w*4, y+w*4, w, w,layernr);
341 cell->addBox(x+w*5, y+w*5, w, w,layernr);
342 cell->addBox(x+w*6, y+w*0, w, 7*w,layernr);
343 x=x+w*7;
344 }
345 else if(letter=="n" )
346 {
347 cell->addBox(x, y, w,5*w,layernr);
348 cell->addBox(x+w, y+4*w, 3*w, w,layernr);
349 cell->addBox(x+4*w, y, w,4*w,layernr);
350 x=x+w*5;
351 }
352 else if(letter=="N" )
353 {
354 cell->addBox(x, y, w,7*w,layernr);
355 cell->addBox(x+w, y+w*5, w, w,layernr);
356 cell->addBox(x+w*2, y+w*4, w, w,layernr);
357 cell->addBox(x+w*3, y+w*3, w, w,layernr);
358 cell->addBox(x+w*4, y+w*2, w, w,layernr);
359 cell->addBox(x+w*5, y+w*1, w, w,layernr);
360 cell->addBox(x+w*6, y+w*0, w, 7*w,layernr);
361 x=x+w*7;
362 }
363 else if(letter=="o" )
364 {
365 cell->addBox(x, y+w, w,3*w,layernr);
366 cell->addBox(x+w, y, 3*w, w,layernr);
367 cell->addBox(x+w, y+4*w, 3*w, w,layernr);
368 cell->addBox(x+4*w, y+w, w,3*w,layernr);
369 x=x+w*5;
370 }
371 else if(letter=="O" )
372 {
373 cell->addBox(x, y+w*1, w,5*w,layernr);
374 cell->addBox(x+w, y+w*0, 4*w, w,layernr);
375 cell->addBox(x+w, y+w*6, 4*w, w,layernr);
376 cell->addBox(x+w*5, y+w*1, w, 5*w,layernr);
377 x=x+w*6;
378 }
379 else if(letter=="p" )
380 {
381 cell->addBox(x, y-2*w, w,7*w,layernr);
382 cell->addBox(x+w, y, 3*w, w,layernr);
383 cell->addBox(x+w, y+4*w, 3*w, w,layernr);
384 cell->addBox(x+4*w, y+w, w,3*w,layernr);
385 x=x+w*5;
386 }
387 else if(letter=="P" )
388 {
389 cell->addBox(x+w*0, y+w*0, 1*w,7*w,layernr);
390 cell->addBox(x+w*1, y+w*3, 3*w,1*w,layernr);
391 cell->addBox(x+w*1, y+w*6, 3*w,1*w,layernr);
392 cell->addBox(x+w*4, y+w*4, 1*w,2*w,layernr);
393 x=x+w*5;
394 }
395 else if(letter=="q" )
396 {
397 cell->addBox(x+w*0.00, y+w, w,3*w,layernr);
398 cell->addBox(x+w*0.75, y, 3.25*w, w,layernr);
399 cell->addBox(x+w*0.75, y+4*w, 3.25*w, w,layernr);
400 cell->addBox(x+w*4.00, y-2*w, w,6*w,layernr);
401 x=x+w*5;
402 }
403 else if(letter=="Q" )
404 {
405 cell->addBox(x, y+w*1, w,5*w,layernr);
406 cell->addBox(x+w, y+w*0, 3*w, w,layernr);
407 cell->addBox(x+w, y+w*6, 4*w, w,layernr);
408 cell->addBox(x+w*5, y+w*2, w, 4*w,layernr);
409 cell->addBox(x+w*3, y+w*2, w, w,layernr);
410 cell->addBox(x+w*4, y+w*1, w, w,layernr);
411 cell->addBox(x+w*5, y+w*0, w, w,layernr);
412 x=x+w*6;
413 }
414 else if(letter=="r" )
415 {
416 cell->addBox(x, y+w*4, w, w,layernr);
417 cell->addBox(x+w, y, w,4*w,layernr);
418 cell->addBox(x+w*2, y+3*w, w, w,layernr);
419 cell->addBox(x+3*w, y+4*w, 2*w, w,layernr);
420 x=x+w*5;
421 }
422 else if(letter=="R" )
423 {
424 cell->addBox(x+w*0, y+w*0, 1*w,7*w,layernr);
425 cell->addBox(x+w*1, y+w*6, 3*w,1*w,layernr);
426 cell->addBox(x+w*1, y+w*3, 3*w,1*w,layernr);
427 cell->addBox(x+w*4, y+w*4, 1*w,2*w,layernr);
428 cell->addBox(x+w*2, y+w*2, 1*w,1*w,layernr);
429 cell->addBox(x+w*3, y+w*1, 1*w,1*w,layernr);
430 cell->addBox(x+w*4, y+w*0, 1*w,1*w,layernr);
431 x=x+w*5;
432 }
433 else if(letter=="s" )
434 {
435 cell->addBox(x, y+3*w, w, w,layernr);
436 cell->addBox(x+w, y, 4*w, w,layernr);
437 cell->addBox(x+w, y+2*w, 4*w, w,layernr);
438 cell->addBox(x+w, y+4*w, 4*w, w,layernr);
439 cell->addBox(x+5*w, y+w, w, w,layernr);
440 x=x+w*6;
441 }
442 else if(letter=="S" )
443 {
444 cell->addBox(x+w*0, y+w*1, 1*w,1*w,layernr);
445 cell->addBox(x+w*0, y+w*4, 1*w,2*w,layernr);
446 cell->addBox(x+w*1, y+w*0, 4*w,1*w,layernr);
447 cell->addBox(x+w*1, y+w*3, 4*w,1*w,layernr);
448 cell->addBox(x+w*1, y+w*6, 4*w,1*w,layernr);
449 cell->addBox(x+w*5, y+w*1, 1*w,2*w,layernr);
450 cell->addBox(x+w*5, y+w*5, 1*w,1*w,layernr);
451 x=x+w*6;
452 }
453 else if(letter=="t" )
454 {
455 cell->addBox(x, y+w*3, 4*w, w,layernr);
456 cell->addBox(x+w, y+w, w,6*w,layernr);
457 cell->addBox(x+2*w, y, 2*w, w,layernr);
458 cell->addBox(x+4*w, y+w, w, w,layernr);
459 x=x+w*5;
460 }
461 else if(letter=="T" )
462 {
463 cell->addBox(x+w*0, y+w*6, 5*w,1*w,layernr);
464 cell->addBox(x+w*2, y+w*0, 1*w,6*w,layernr);
465 x=x+w*5;
466 }
467 else if(letter=="u" )
468 {
469 cell->addBox(x, y+w, w,4*w,layernr);
470 cell->addBox(x+w, y, 3*w, w,layernr);
471 cell->addBox(x+4*w, y+w, w,4*w,layernr);
472 cell->addBox(x+5*w, y, w, w,layernr);
473 x=x+w*6;
474 }
475 else if(letter=="U" )
476 {
477 cell->addBox(x+w*0, y+w*1, 1*w,6*w,layernr);
478 cell->addBox(x+w*1, y+w*0, 4*w,1*w,layernr);
479 cell->addBox(x+w*5, y+w*1, 1*w,6*w,layernr);
480 x=x+w*6;
481 }
482 else if(letter=="v" )
483 {
484 cell->addBox(x+w*0.00, y+w*4, w, w,layernr);
485 cell->addBox(x+w*0.75, y+w*3, w, w,layernr);
486 cell->addBox(x+w*1.50, y+w*2, w, w,layernr);
487 cell->addBox(x+w*2.25, y+w*1, w, w,layernr);
488 cell->addBox(x+w*3.00, y+w*0, w, w,layernr);
489 cell->addBox(x+w*3.75, y+w*1, w, w,layernr);
490 cell->addBox(x+w*4.50, y+w*2, w, w,layernr);
491 cell->addBox(x+w*5.25, y+w*3, w, w,layernr);
492 cell->addBox(x+w*6.00, y+w*4, w, w,layernr);
493 x=x+w*7;
494 }
495 else if(letter=="V" )
496 {
497 cell->addBox(x+w*0, y+w*4, 1*w,3*w,layernr);
498 cell->addBox(x+w*0.5, y+w*3, 1*w,1*w,layernr);
499 cell->addBox(x+w*1.5, y+w*2, 1*w,1*w,layernr);
500 cell->addBox(x+w*2.0, y+w*1, 2*w,1*w,layernr);
501 cell->addBox(x+w*2.5, y+w*0, 1*w,1*w,layernr);
502 cell->addBox(x+w*3.5, y+w*2, 1*w,1*w,layernr);
503 cell->addBox(x+w*4.5, y+w*3, 1*w,1*w,layernr);
504 cell->addBox(x+w*5, y+w*4, 1*w,3*w,layernr);
505 x=x+w*6;
506 }
507 else if(letter=="w" )
508 {
509 cell->addBox(x, y+w*2, w,3*w,layernr);
510 cell->addBox(x+w, y+w*1, w, w,layernr);
511 cell->addBox(x+w*2, y+w*0, w, w,layernr);
512 cell->addBox(x+w*3, y+w*1, w, w,layernr);
513 cell->addBox(x+w*4, y+w*2, w, w,layernr);
514 cell->addBox(x+w*5, y+w*1, w, w,layernr);
515 cell->addBox(x+w*6, y+w*0, w, w,layernr);
516 cell->addBox(x+w*7, y+w*1, w, w,layernr);
517 cell->addBox(x+w*8, y+w*2, w,3*w,layernr);
518 x=x+w*9;
519 }
520 else if(letter=="W" )
521 {
522 cell->addBox(x+w*0, y+w*1, 1*w,6*w,layernr);
523 cell->addBox(x+w*0.5, y+w*0, 1*w,1*w,layernr);
524 cell->addBox(x+w*1.0, y+w*1, 1*w,1*w,layernr);
525 cell->addBox(x+w*1.5, y+w*2, 1*w,1*w,layernr);
526 cell->addBox(x+w*2.0, y+w*3, 1*w,1*w,layernr);
527 cell->addBox(x+w*2.5, y+w*2, 1*w,1*w,layernr);
528 cell->addBox(x+w*3.0, y+w*1, 1*w,1*w,layernr);
529 cell->addBox(x+w*3.5, y+w*0, 1*w,1*w,layernr);
530 cell->addBox(x+w*4, y+w*1, 1*w,6*w,layernr);
531 x=x+w*5;
532 }
533 else if(letter=="x" )
534 {
535 cell->addBox(x, y+w*4, w, w,layernr);
536 cell->addBox(x+w, y+w*3, w, w,layernr);
537 cell->addBox(x+w*2, y+w*2, w, w,layernr);
538 cell->addBox(x+w*3, y+w*1, w, w,layernr);
539 cell->addBox(x+w*4, y+w*0, w, w,layernr);
540 cell->addBox(x, y+w*0, w, w,layernr);
541 cell->addBox(x+w, y+w*1, w, w,layernr);
542 cell->addBox(x+w*3, y+w*3, w, w,layernr);
543 cell->addBox(x+w*4, y+w*4, w, w,layernr);
544 x=x+w*5;
545 }
546 else if(letter=="X" )
547 {
548 cell->addBox(x+w*0, y+w*0, 1*w,1*w,layernr);
549 cell->addBox(x+w*1, y+w*1, 1*w,1*w,layernr);
550 cell->addBox(x+w*2, y+w*2, 1*w,1*w,layernr);
551 cell->addBox(x+w*3, y+w*3, 1*w,1*w,layernr);
552 cell->addBox(x+w*4, y+w*4, 1*w,1*w,layernr);
553 cell->addBox(x+w*5, y+w*5, 1*w,1*w,layernr);
554 cell->addBox(x+w*6, y+w*6, 1*w,1*w,layernr);
555 cell->addBox(x+w*0, y+w*6, 1*w,1*w,layernr);
556 cell->addBox(x+w*1, y+w*5, 1*w,1*w,layernr);
557 cell->addBox(x+w*2, y+w*4, 1*w,1*w,layernr);
558 cell->addBox(x+w*4, y+w*2, 1*w,1*w,layernr);
559 cell->addBox(x+w*5, y+w*1, 1*w,1*w,layernr);
560 cell->addBox(x+w*6, y+w*0, 1*w,1*w,layernr);
561 x=x+w*7;
562 }
563 else if(letter=="y" )
564 {
565 cell->addBox(x, y+w*4, w, w,layernr);
566 cell->addBox(x+w, y+w*3, w, w,layernr);
567 cell->addBox(x+w*2, y+w*2, w, w,layernr);
568 cell->addBox(x+w*3, y+w*1, w, w,layernr);
569 cell->addBox(x+w*4, y+w*0, w, w,layernr);
570 cell->addBox(x+w*5, y+w*1, w, w,layernr);
571 cell->addBox(x+w*6, y+w*2, w, w,layernr);
572 cell->addBox(x+w*7, y+w*3, w, w,layernr);
573 cell->addBox(x+w*8, y+w*4, w, w,layernr);
574 cell->addBox(x+w, y-w*2, 2*w, w,layernr);
575 cell->addBox(x+w*3, y-w*1, w, w,layernr);
576 x=x+w*9;
577 }
578 else if(letter=="Y" )
579 {
580 cell->addBox(x+w*3, y+w*0, 1*w,4*w,layernr);
581 cell->addBox(x+w*4, y+w*4, 1*w,1*w,layernr);
582 cell->addBox(x+w*5, y+w*5, 1*w,1*w,layernr);
583 cell->addBox(x+w*6, y+w*6, 1*w,1*w,layernr);
584 cell->addBox(x+w*0, y+w*6, 1*w,1*w,layernr);
585 cell->addBox(x+w*1, y+w*5, 1*w,1*w,layernr);
586 cell->addBox(x+w*2, y+w*4, 1*w,1*w,layernr);
587 x=x+w*7;
588 }
589 else if(letter=="z" )
590 {
591 cell->addBox(x, y+w*0, 4*w, w,layernr);
592 cell->addBox(x+w, y+w*1, w, w,layernr);
593 cell->addBox(x+w*2, y+w*2, w, w,layernr);
594 cell->addBox(x+w*3, y+w*3, w, w,layernr);
595 cell->addBox(x, y+w*4, 4*w, w,layernr);
596 x=x+w*4;
597 }
598 else if(letter=="Z" )
599 {
600 cell->addBox(x+w*0, y+w*0, 6*w,1*w,layernr);
601 cell->addBox(x+w*1, y+w*1, 1*w,1*w,layernr);
602 cell->addBox(x+w*2, y+w*2, 1*w,1*w,layernr);
603 cell->addBox(x+w*3, y+w*3, 1*w,1*w,layernr);
604 cell->addBox(x+w*4, y+w*4, 1*w,1*w,layernr);
605 cell->addBox(x+w*5, y+w*5, 1*w,1*w,layernr);
606 cell->addBox(x+w*0, y+w*6, 6*w,1*w,layernr);
607 x=x+w*6;
608 }
609 else if(letter=="1")
610 {
611 cell->addBox(x, y , 3*w, w,layernr);
612 cell->addBox(x+w, y+w*1, w,6*w,layernr);
613 cell->addBox(x, y+w*5, w, w,layernr);
614 x=x+w*3;
615 }
616 else if(letter=="2")
617 {
618 cell->addBox(x, y+w*0, 5*w, w,layernr);
619 cell->addBox(x+w, y+w*1, w, w,layernr);
620 cell->addBox(x+w*2, y+w*2, w, w,layernr);
621 cell->addBox(x+w*3, y+w*3, w, w,layernr);
622 cell->addBox(x+w*4, y+w*4, w,2*w,layernr);
623 cell->addBox(x, y+w*5, w, w,layernr);
624 cell->addBox(x+w, y+w*6, 3*w, w,layernr);
625 x=x+w*5;
626 }
627 else if(letter=="3")
628 {
629 cell->addBox(x+w*0, y+w*1, 1*w, w,layernr);
630 cell->addBox(x+w*0, y+w*5, 1*w, w,layernr);
631 cell->addBox(x+w, y+w*0, 4*w, w,layernr);
632 cell->addBox(x+w, y+w*6, 4*w, w,layernr);
633 cell->addBox(x+w*3, y+w*3, 2*w, w,layernr);
634 cell->addBox(x+w*5, y+w*1, 1*w,2*w,layernr);
635 cell->addBox(x+w*5, y+w*4, 1*w,2*w,layernr);
636 x=x+w*6;
637 }
638 else if(letter=="4")
639 {
640 cell->addBox(x+w*0, y+w*2, 5*w,1*w,layernr);
641 cell->addBox(x+w*0, y+w*3, w,1*w,layernr);
642 cell->addBox(x+w*1, y+w*4, w,1*w,layernr);
643 cell->addBox(x+w*2, y+w*5, w,1*w,layernr);
644 cell->addBox(x+w*3, y+w*0, w,7*w,layernr);
645 x=x+w*5;
646 }
647 else if(letter=="5")
648 {
649 cell->addBox(x+w*0, y+w*1, 1*w,1*w,layernr);
650 cell->addBox(x+w*0, y+w*4, 1*w,3*w,layernr);
651 cell->addBox(x+w*1, y+w*0, 3*w,1*w,layernr);
652 cell->addBox(x+w*1, y+w*4, 3*w,1*w,layernr);
653 cell->addBox(x+w*1, y+w*6, 4*w,1*w,layernr);
654 cell->addBox(x+w*4, y+w*1, 1*w,3*w,layernr);
655 x=x+w*5;
656 }
657 else if(letter=="6")
658 {
659 cell->addBox(x+w*0, y+w*1, 1*w,4*w,layernr);
660 cell->addBox(x+w*1, y+w*0, 3*w,1*w,layernr);
661 cell->addBox(x+w*1, y+w*3, 3*w,1*w,layernr);
662 cell->addBox(x+w*1, y+w*5, 1*w,1*w,layernr);
663 cell->addBox(x+w*2, y+w*6, 3*w,1*w,layernr);
664 cell->addBox(x+w*4, y+w*1, 1*w,2*w,layernr);
665 x=x+w*5;
666 }
667 else if(letter=="7")
668 {
669 cell->addBox(x+w*0, y+w*6, 6*w,1*w,layernr);
670 cell->addBox(x+w*0, y+w*0, 1*w,1*w,layernr);
671 cell->addBox(x+w*1, y+w*1, 1*w,1*w,layernr);
672 cell->addBox(x+w*2, y+w*2, 1*w,1*w,layernr);
673 cell->addBox(x+w*3, y+w*3, 1*w,1*w,layernr);
674 cell->addBox(x+w*4, y+w*4, 1*w,1*w,layernr);
675 cell->addBox(x+w*5, y+w*5, 1*w,1*w,layernr);
676 x=x+w*6;
677 }
678 else if(letter=="8")
679 {
680 cell->addBox(x+w*0, y+w*1, 1*w,2*w,layernr);
681 cell->addBox(x+w*0, y+w*4, 1*w,2*w,layernr);
682 cell->addBox(x+w*1, y+w*0, 4*w,1*w,layernr);
683 cell->addBox(x+w*1, y+w*3, 4*w,1*w,layernr);
684 cell->addBox(x+w*1, y+w*6, 4*w,1*w,layernr);
685 cell->addBox(x+w*5, y+w*1, 1*w,2*w,layernr);
686 cell->addBox(x+w*5, y+w*4, 1*w,2*w,layernr);
687 x=x+w*6;
688 }
689 else if(letter=="9")
690 {
691 cell->addBox(x+w*0, y+w*0, 3*w,1*w,layernr);
692 cell->addBox(x+w*0, y+w*4, 1*w,2*w,layernr);
693 cell->addBox(x+w*1, y+w*3, 3*w,1*w,layernr);
694 cell->addBox(x+w*1, y+w*6, 3*w,1*w,layernr);
695 cell->addBox(x+w*3, y+w*1, 1*w,1*w,layernr);
696 cell->addBox(x+w*4, y+w*2, 1*w,4*w,layernr);
697 x=x+w*5;
698 }
699 else if(letter=="0")
700 {
701 cell->addBox(x+w*0, y+w*2, 1*w,3*w,layernr);
702 cell->addBox(x+w*1, y+w*1, 1*w,1*w,layernr);
703 cell->addBox(x+w*1, y+w*5, 1*w,1*w,layernr);
704 cell->addBox(x+w*2, y+w*0, 2*w,1*w,layernr);
705 cell->addBox(x+w*2, y+w*6, 2*w,1*w,layernr);
706 cell->addBox(x+w*4, y+w*1, 1*w,1*w,layernr);
707 cell->addBox(x+w*4, y+w*5, 1*w,1*w,layernr);
708 cell->addBox(x+w*5, y+w*2, 1*w,3*w,layernr);
709 x=x+w*6;
710 }
711 else if(letter=="@")
712 {
713 cell->addBox(x+w*0, y+w*2, 1*w,3*w,layernr);
714 cell->addBox(x+w*1, y+w*1, 1*w,1*w,layernr);
715 cell->addBox(x+w*1, y+w*5, 1*w,1*w,layernr);
716 cell->addBox(x+w*2, y+w*0, 4*w,1*w,layernr);
717 cell->addBox(x+w*2, y+w*6, 3*w,1*w,layernr);
718 cell->addBox(x+w*5, y+w*2, 1*w,4*w,layernr);
719 cell->addBox(x+w*3, y+w*2, 2*w,1*w,layernr);
720 cell->addBox(x+w*3, y+w*4, 2*w,1*w,layernr);
721 cell->addBox(x+w*2, y+w*3, 1*w,1*w,layernr);
722 x=x+w*6;
723 }
724 else if(letter=="*")
725 {
726 cell->addBox(x+w*0, y+w*3, 7*w,1*w,layernr);
727 cell->addBox(x+w*1, y+w*1, 1*w,1*w,layernr);
728 cell->addBox(x+w*1, y+w*5, 1*w,1*w,layernr);
729 cell->addBox(x+w*2, y+w*2, 1*w,1*w,layernr);
730 cell->addBox(x+w*2, y+w*4, 1*w,1*w,layernr);
731 cell->addBox(x+w*4, y+w*2, 1*w,1*w,layernr);
732 cell->addBox(x+w*4, y+w*4, 1*w,1*w,layernr);
733 cell->addBox(x+w*5, y+w*1, 1*w,1*w,layernr);
734 cell->addBox(x+w*5, y+w*5, 1*w,1*w,layernr);
735 x=x+w*7;
736 }
737 else if(letter=="-")
738 {
739 cell->addBox(x+w*0, y+w*3, 5*w,1*w,layernr);
740 x=x+w*5;
741 }
742 else if(letter=="+")
743 {
744 cell->addBox(x+w*0, y+w*3, 5*w,1*w,layernr);
745 cell->addBox(x+w*2, y+w*1, 1*w,5*w,layernr);
746 x=x+w*5;
747 }
748 else if(letter==".")
749 {
750 cell->addBox(x+w*0, y+w*0, 1*w,1*w,layernr);
751 x=x+w*1;
752 }
753 else if(letter==" ")
754 {
755 x=x+w*3;
756 }
757 else
758 {
759 cell->addBox(x,y,w,w,layernr);
760 x=x+w*2;
761 nonimplemented=1;
762 }
763 x = x+w;
764 };
765
766 cell->deleteElement(element);
767 if(nonimplemented)
768 layout->showMessage("Warning",
769 "You used some characters that are not implemented yet.\nIt is relatively easy to modify and add other symbols to \n"+
770 "this macro, either modify the source or email the author of this macro for help.");
771
772
773 }; /* end if selected */
774 };
775 /* Local Variables: */
776 /* mode: c */
777 /* End: */