"Fossies" - the Fresh Open Source Software Archive 
Member "gamgi0.17.5x/src/expat/gamgi_expat_export_config.c" (23 Feb 2022, 41630 Bytes) of package /linux/misc/gamgi-all-0.17.5x.tar.gz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
For more information about "gamgi_expat_export_config.c" see the
Fossies "Dox" file reference documentation and the latest
Fossies "Diffs" side-by-side code changes report:
0.17.4x_vs_0.17.5x.
1 /************************************************
2 *
3 * $GAMGI/src/expat/gamgi_expat_export_config.c
4 *
5 * Copyright (C) 2004 Carlos Pereira
6 *
7 * Distributed under the terms of the GNU
8 * General Public License: $GAMGI/LICENSE
9 *
10 */
11
12 #include "gamgi_engine.h"
13 #include "gamgi_gtk.h"
14 #include "gamgi_mesa.h"
15 #include "gamgi_math.h"
16 #include "gamgi_chem.h"
17 #include "gamgi_phys.h"
18 #include "gamgi_expat.h"
19 #include "gamgi_io.h"
20 #include "gamgi_global.h"
21
22 #include "gamgi_mesa_bond.h"
23 #include "gamgi_mesa_atom.h"
24 #include "gamgi_chem_atom.h"
25 #include "gamgi_chem_property.h"
26 #include "gamgi_expat_export.h"
27
28 void gamgi_expat_export_config_help (gamgi_window *window, FILE *fp,
29 int depth_parent, int *depth_last, gamgi_bool *output, gamgi_bool *error)
30 {
31 gamgi_help_class *help_class = gamgi->help;
32 char string[GAMGI_ENGINE_TOKEN + GAMGI_IO_FULLNAME];
33 char *name;
34 int column;
35
36 /************************
37 * source: local,remote *
38 ************************/
39
40 /***********************************************************
41 * remote source is non-default only when local is defined *
42 ***********************************************************/
43
44 if (help_class->source_in == FALSE && help_class->local != NULL)
45 {
46 sprintf (string, "source=\"remote\"");
47 gamgi_expat_export_element (fp, "<help", string,
48 depth_parent, depth_last, &column, output, error);
49 }
50
51 /************************
52 * agent: gamgi,browser *
53 ************************/
54
55 if (help_class->agent_in == FALSE)
56 {
57 sprintf (string, "agent=\"browser\"");
58 gamgi_expat_export_element (fp, "<help", string,
59 depth_parent, depth_last, &column, output, error);
60 }
61
62 /*******************************
63 * paths: local,remote,browser *
64 *******************************/
65
66 /***************************************
67 * export only if the configuration *
68 * path is different from the path *
69 * defined by the environment variable *
70 ***************************************/
71
72 name = getenv ("GAMGI_HELP");
73 if (help_class->local != NULL &&
74 (name == NULL || strcmp (help_class->local, name) != 0))
75 {
76 sprintf (string, "local=\"%s\"", help_class->local);
77 gamgi_expat_export_element (fp, "<help", string,
78 depth_parent, depth_last, &column, output, error);
79 }
80
81 if (help_class->remote != NULL &&
82 strcmp (help_class->remote, GAMGI_IO_WEBSITE) != 0)
83 {
84 sprintf (string, "remote=\"%s\"", help_class->remote);
85 gamgi_expat_export_element (fp, "<help", string,
86 depth_parent, depth_last, &column, output, error);
87 }
88
89 /***************************************
90 * export only if the configuration *
91 * path is different from the path *
92 * defined by the environment variable *
93 ***************************************/
94
95 name = getenv ("BROWSER");
96 if (help_class->browser != NULL &&
97 (name == NULL || strcmp (help_class->browser, name) != 0))
98 {
99 sprintf (string, "browser=\"%s\"", help_class->browser);
100 gamgi_expat_export_element (fp, "<help", string,
101 depth_parent, depth_last, &column, output, error);
102 }
103 }
104
105 void gamgi_expat_export_config_text (gamgi_window *window, FILE *fp,
106 int depth_parent, int *depth_last, gamgi_bool *output, gamgi_bool *error)
107 {
108 gamgi_text_class *text_class = gamgi->text;
109 char string[GAMGI_ENGINE_STRING];
110 int column;
111
112 /***********************
113 * style: wired, solid *
114 ***********************/
115
116 if (text_class->style != GAMGI_MESA_TEXT_STYLE)
117 {
118 if (text_class->style == GAMGI_MESA_WIRED)
119 sprintf (string, "style=\"wired\"");
120 if (text_class->style == GAMGI_MESA_SOLID)
121 sprintf (string, "style=\"solid\"");
122 gamgi_expat_export_element (fp, "<text", string,
123 depth_parent, depth_last, &column, output, error);
124 }
125
126 /**************
127 * wired font: *
128 **************/
129
130 if (text_class->wired != GAMGI_IO_TEXT_WIRED)
131 {
132 if (text_class->wired == GAMGI_IO_SUN_ROMAN)
133 sprintf (string, "wired=\"roman\"");
134 else if (text_class->wired == GAMGI_IO_SUN_ROMAN_MONO)
135 sprintf (string, "wired=\"roman_mono\"");
136 else if (text_class->wired == GAMGI_IO_HERSHEY_SANS)
137 sprintf (string, "wired=\"sans\"");
138 else if (text_class->wired == GAMGI_IO_HERSHEY_SANS_BOLD)
139 sprintf (string, "wired=\"sans_bold\"");
140 else if (text_class->wired == GAMGI_IO_HERSHEY_SERIF)
141 sprintf (string, "wired=\"serif\"");
142 else if (text_class->wired == GAMGI_IO_HERSHEY_SERIF_BOLD)
143 sprintf (string, "wired=\"serif_bold\"");
144 else if (text_class->wired == GAMGI_IO_HERSHEY_SCRIPT)
145 sprintf (string, "wired=\"script\"");
146 else if (text_class->wired == GAMGI_IO_HERSHEY_SCRIPT_BOLD)
147 sprintf (string, "wired=\"script_bold\"");
148 else if (text_class->wired == GAMGI_IO_HERSHEY_GOTHIC_ENGLISH)
149 sprintf (string, "wired=\"gothic_english\"");
150 else if (text_class->wired == GAMGI_IO_HERSHEY_GOTHIC_GERMAN)
151 sprintf (string, "wired=\"gothic_german\"");
152 else if (text_class->wired == GAMGI_IO_HERSHEY_GOTHIC_ITALIAN)
153 sprintf (string, "wired=\"gothic_italian\"");
154 else if (text_class->wired == GAMGI_IO_HERSHEY_SYMBOL_SANS)
155 sprintf (string, "wired=\"symbol_sans\"");
156 else if (text_class->wired == GAMGI_IO_HERSHEY_SYMBOL_SERIF)
157 sprintf (string, "wired=\"symbol_serif\"");
158 else if (text_class->wired == GAMGI_IO_HERSHEY_SYMBOL_SERIF_BOLD)
159 sprintf (string, "wired=\"symbol_serif_bold\"");
160
161 gamgi_expat_export_element (fp, "<text", string,
162 depth_parent, depth_last, &column, output, error);
163 }
164
165 /**************
166 * solid font *
167 **************/
168
169 if (text_class->solid != GAMGI_IO_TEXT_SOLID)
170 {
171 if (text_class->solid == GAMGI_IO_DEJAVU_SANS)
172 sprintf (string, "solid=\"sans\"");
173 else if (text_class->solid == GAMGI_IO_DEJAVU_SANS_BOLD)
174 sprintf (string, "solid=\"sans_bold\"");
175 else if (text_class->solid == GAMGI_IO_DEJAVU_SANS_ITALIC)
176 sprintf (string, "solid=\"sans_italic\"");
177 else if (text_class->solid == GAMGI_IO_DEJAVU_SANS_BOLD_ITALIC)
178 sprintf (string, "solid=\"sans_bold_italic\"");
179 else if (text_class->solid == GAMGI_IO_DEJAVU_SERIF)
180 sprintf (string, "solid=\"serif\"");
181 else if (text_class->solid == GAMGI_IO_DEJAVU_SERIF_BOLD)
182 sprintf (string, "solid=\"serif_bold\"");
183 else if (text_class->solid == GAMGI_IO_DEJAVU_SERIF_ITALIC)
184 sprintf (string, "solid=\"serif_italic\"");
185 else if (text_class->solid == GAMGI_IO_DEJAVU_SERIF_BOLD_ITALIC)
186 sprintf (string, "solid=\"serif_bold_italic\"");
187 else if (text_class->solid == GAMGI_IO_DEJAVU_MONO)
188 sprintf (string, "solid=\"mono\"");
189 else if (text_class->solid == GAMGI_IO_DEJAVU_MONO_BOLD)
190 sprintf (string, "solid=\"mono_bold\"");
191 else if (text_class->solid == GAMGI_IO_DEJAVU_MONO_ITALIC)
192 sprintf (string, "solid=\"mono_italic\"");
193 else if (text_class->solid == GAMGI_IO_DEJAVU_MONO_BOLD_ITALIC)
194 sprintf (string, "solid=\"mono_bold_italic\"");
195
196 gamgi_expat_export_element (fp, "<text", string,
197 depth_parent, depth_last, &column, output, error);
198 }
199
200 /****************************
201 * red,green,blue (coupled) *
202 ****************************/
203
204 if (fabs (text_class->red - GAMGI_MESA_TEXT_R) > GAMGI_MATH_TOLERANCE
205 || fabs (text_class->green - GAMGI_MESA_TEXT_G) > GAMGI_MATH_TOLERANCE
206 || fabs (text_class->blue - GAMGI_MESA_TEXT_B) > GAMGI_MATH_TOLERANCE)
207 {
208 sprintf (string, "red=\"%.*f\"",
209 GAMGI_MATH_DECIMAL_COLOR, text_class->red);
210 gamgi_expat_export_element (fp, "<text", string,
211 depth_parent, depth_last, &column, output, error);
212
213 sprintf (string, "green=\"%.*f\"",
214 GAMGI_MATH_DECIMAL_COLOR, text_class->green);
215 gamgi_expat_export_element (fp, "<text", string,
216 depth_parent, depth_last, &column, output, error);
217
218 sprintf (string, "blue=\"%.*f\"",
219 GAMGI_MATH_DECIMAL_COLOR, text_class->blue);
220 gamgi_expat_export_element (fp, "<text", string,
221 depth_parent, depth_last, &column, output, error);
222 }
223
224 }
225
226 void gamgi_expat_export_config_orbital (gamgi_window *window, FILE *fp,
227 int depth_parent, int *depth_last, gamgi_bool *output, gamgi_bool *error)
228 {
229 }
230
231 void gamgi_expat_export_config_bond_global (gamgi_window *window, FILE *fp,
232 int depth_parent, int *depth_last, gamgi_bool *output, gamgi_bool *error)
233 {
234 gamgi_bond_class *bond_class = gamgi->bond;
235 char string[GAMGI_ENGINE_STRING];
236 int column;
237
238 /***********************
239 * style: wired, solid *
240 ***********************/
241
242 if (bond_class->draw != GAMGI_MESA_BOND_DRAW)
243 {
244 if (bond_class->draw == gamgi_mesa_bond_draw_line)
245 sprintf (string, "style=\"wired\"");
246 else if (bond_class->draw == gamgi_mesa_bond_draw_cylinder)
247 sprintf (string, "style=\"solid\"");
248 gamgi_expat_export_element (fp, "<bond", string,
249 depth_parent, depth_last, &column, output, error);
250 }
251
252 /************************************
253 * global bond limits: lower, upper *
254 ************************************/
255
256 if (fabs (bond_class->lower - GAMGI_CHEM_BOND_LOWER) > GAMGI_MATH_TOLERANCE)
257 {
258 sprintf (string, "lower=\"%.*f\"", gamgi->gamgi->length, bond_class->lower);
259 gamgi_expat_export_element (fp, "<bond", string,
260 depth_parent, depth_last, &column, output, error);
261 }
262
263 if (fabs (bond_class->upper - GAMGI_CHEM_BOND_UPPER) > GAMGI_MATH_TOLERANCE)
264 {
265 sprintf (string, "upper=\"%.*f\"", gamgi->gamgi->length, bond_class->upper);
266 gamgi_expat_export_element (fp, "<bond", string,
267 depth_parent, depth_last, &column, output, error);
268 }
269
270 /********
271 * size *
272 ********/
273
274 if (fabs (bond_class->size - GAMGI_CHEM_BOND_SIZE) > GAMGI_MATH_TOLERANCE)
275 {
276 sprintf (string, "size=\"%.*f\"", GAMGI_MATH_DECIMAL_SIZE, bond_class->size);
277 gamgi_expat_export_element (fp, "<bond", string,
278 depth_parent, depth_last, &column, output, error);
279 }
280
281 /**************
282 * color flag *
283 **************/
284
285 if (bond_class->color != GAMGI_MESA_BOND_COLOR)
286 {
287 if (bond_class->color == TRUE)
288 sprintf (string, "color=\"yes\"");
289 else
290 sprintf (string, "color=\"no\"");
291 gamgi_expat_export_element (fp, "<bond", string,
292 depth_parent, depth_last, &column, output, error);
293 }
294
295 /****************************
296 * red,green,blue (coupled) *
297 ****************************/
298
299 if (fabs (bond_class->red - GAMGI_MESA_BOND_R) > GAMGI_MATH_TOLERANCE
300 || fabs (bond_class->green - GAMGI_MESA_BOND_G) > GAMGI_MATH_TOLERANCE
301 || fabs (bond_class->blue - GAMGI_MESA_BOND_B) > GAMGI_MATH_TOLERANCE)
302 {
303 sprintf (string, "red=\"%.*f\"",
304 GAMGI_MATH_DECIMAL_COLOR, bond_class->red);
305 gamgi_expat_export_element (fp, "<bond", string,
306 depth_parent, depth_last, &column, output, error);
307
308 sprintf (string, "green=\"%.*f\"",
309 GAMGI_MATH_DECIMAL_COLOR, bond_class->green);
310 gamgi_expat_export_element (fp, "<bond", string,
311 depth_parent, depth_last, &column, output, error);
312
313 sprintf (string, "blue=\"%.*f\"",
314 GAMGI_MATH_DECIMAL_COLOR, bond_class->blue);
315 gamgi_expat_export_element (fp, "<bond", string,
316 depth_parent, depth_last, &column, output, error);
317 }
318
319 }
320
321 void gamgi_expat_export_config_bond_local (gamgi_window *window, FILE *fp,
322 int depth_parent, int *depth_last, gamgi_bool *output, gamgi_bool *error,
323 int element1, int element2, double min, double max)
324 {
325 char string[GAMGI_ENGINE_LINE / 2];
326 char name1[GAMGI_ENGINE_TOKEN];
327 char name2[GAMGI_ENGINE_TOKEN];
328 int column;
329
330 gamgi_chem_atom_name (element1, name1);
331 gamgi_chem_atom_name (element2, name2);
332
333 /*******************************************************
334 * write first the higher element: element1 > element2 *
335 *******************************************************/
336
337 sprintf (string, "element1=\"%s\" element2=\"%s\""
338 " min=\"%.*f\" max=\"%.*f\"", name1, name2,
339 gamgi->gamgi->length, min, gamgi->gamgi->length, max);
340
341 gamgi_expat_export_element (fp, "<bond", string,
342 depth_parent, depth_last, &column, output, error);
343 }
344
345 void gamgi_expat_export_config_atom_global (gamgi_window *window, FILE *fp,
346 int depth_parent, int *depth_last, gamgi_bool *output, gamgi_bool *error)
347 {
348 gamgi_atom_class *atom_class = gamgi->atom;
349 char string[GAMGI_ENGINE_STRING];
350 int column;
351
352 /***************
353 * temperature *
354 ***************/
355
356 if (fabs (atom_class->temperature - GAMGI_CHEM_ATOM_TEMPERATURE) > GAMGI_MATH_TOLERANCE)
357 {
358 sprintf (string, "temperature=\"%.*f\"",
359 GAMGI_MATH_DECIMAL_OCCUPANCY, atom_class->temperature);
360 gamgi_expat_export_element (fp, "<atom", string,
361 depth_parent, depth_last, &column, output, error);
362 }
363
364 /*************************
365 * style, size, variancy *
366 *************************/
367
368 if (atom_class->draw != GAMGI_MESA_ATOM_DRAW)
369 {
370 if (atom_class->draw == gamgi_mesa_atom_draw_cross)
371 sprintf (string, "style=\"wired\"");
372 else if (atom_class->draw == gamgi_mesa_atom_draw_sphere)
373 sprintf (string, "style=\"solid\"");
374 gamgi_expat_export_element (fp, "<atom", string,
375 depth_parent, depth_last, &column, output, error);
376 }
377
378 if (fabs (atom_class->size - GAMGI_CHEM_ATOM_SIZE) > GAMGI_MATH_TOLERANCE)
379 {
380 sprintf (string, "size=\"%.*f\"", GAMGI_MATH_DECIMAL_SIZE, atom_class->size);
381 gamgi_expat_export_element (fp, "<atom", string,
382 depth_parent, depth_last, &column, output, error);
383 }
384
385 if (fabs (atom_class->variancy - GAMGI_CHEM_ATOM_VARIANCY) > GAMGI_MATH_TOLERANCE)
386 {
387 sprintf (string, "variancy=\"%.*f\"", GAMGI_MATH_DECIMAL_VARIANCY, atom_class->variancy);
388 gamgi_expat_export_element (fp, "<atom", string,
389 depth_parent, depth_last, &column, output, error);
390 }
391
392 /*********************************************
393 * minimum radius, curved slices, line width *
394 *********************************************/
395
396 if (fabs (atom_class->min -
397 gamgi_chem_property_radius[GAMGI_CHEM_RADIUS_DEFAULT]) > GAMGI_MATH_TOLERANCE)
398 {
399 sprintf (string, "min=\"%.*f\"", gamgi->gamgi->length, atom_class->min);
400 gamgi_expat_export_element (fp, "<atom", string,
401 depth_parent, depth_last, &column, output, error);
402 }
403
404 if (atom_class->slices != GAMGI_MESA_ATOM_SLICES)
405 {
406 sprintf (string, "slices=\"%d\"", atom_class->slices);
407 gamgi_expat_export_element (fp, "<atom", string,
408 depth_parent, depth_last, &column, output, error);
409 }
410
411 if (atom_class->width != GAMGI_MESA_ATOM_WIDTH)
412 {
413 sprintf (string, "width=\"%d\"", atom_class->width);
414 gamgi_expat_export_element (fp, "<atom", string,
415 depth_parent, depth_last, &column, output, error);
416 }
417
418 }
419
420 void gamgi_expat_export_config_atom_local (gamgi_window *window, FILE *fp,
421 int depth_parent, int *depth_last, gamgi_bool *output, gamgi_bool *error,
422 int element, double mass, double radius, float red, float green, float blue)
423 {
424 gamgi_atom_class *atom_class = gamgi->atom;
425 char string_element[GAMGI_ENGINE_STRING];
426 char string_attribute[GAMGI_ENGINE_STRING];
427 char token[GAMGI_ENGINE_TOKEN];
428 int column;
429
430 gamgi_chem_atom_name (element, token);
431 sprintf (string_element, "<atom element=\"%s\"", token);
432
433 if (fabs (atom_class->mass[element] - mass) > GAMGI_MATH_TOLERANCE)
434 {
435 sprintf (string_attribute, "mass=\"%.*f\"",
436 gamgi->gamgi->mass, atom_class->mass[element]);
437 gamgi_expat_export_element (fp, string_element, string_attribute,
438 depth_parent, depth_last, &column, output, error);
439 }
440
441 if (fabs (atom_class->radius[element] - radius) > GAMGI_MATH_TOLERANCE)
442 {
443 sprintf (string_attribute, "radius=\"%.*f\"",
444 gamgi->gamgi->length, atom_class->radius[element]);
445 gamgi_expat_export_element (fp, string_element, string_attribute,
446 depth_parent, depth_last, &column, output, error);
447 }
448
449 if (fabs (atom_class->red[element] - red) > GAMGI_MATH_TOLERANCE
450 || fabs (atom_class->green[element] - green) > GAMGI_MATH_TOLERANCE
451 || fabs (atom_class->blue[element] - blue) > GAMGI_MATH_TOLERANCE)
452 {
453 sprintf (string_attribute, "red=\"%.*f\"",
454 GAMGI_MATH_DECIMAL_COLOR, atom_class->red[element]);
455 gamgi_expat_export_element (fp, string_element, string_attribute,
456 depth_parent, depth_last, &column, output, error);
457
458 sprintf (string_attribute, "green=\"%.*f\"",
459 GAMGI_MATH_DECIMAL_COLOR, atom_class->green[element]);
460 gamgi_expat_export_element (fp, string_element, string_attribute,
461 depth_parent, depth_last, &column, output, error);
462
463 sprintf (string_attribute, "blue=\"%.*f\"",
464 GAMGI_MATH_DECIMAL_COLOR, atom_class->blue[element]);
465 gamgi_expat_export_element (fp, string_element, string_attribute,
466 depth_parent, depth_last, &column, output, error);
467 }
468 }
469
470 void gamgi_expat_export_config_direction (gamgi_window *window, FILE *fp,
471 int depth_parent, int *depth_last, gamgi_bool *output, gamgi_bool *error)
472 {
473 gamgi_direction_class *direction_class = gamgi->direction;
474 char string[GAMGI_ENGINE_STRING];
475 int column;
476
477 /****************************
478 * red,green,blue (coupled) *
479 ****************************/
480
481 if (fabs (direction_class->red - GAMGI_MESA_DIRECTION_R) > GAMGI_MATH_TOLERANCE
482 || fabs (direction_class->green - GAMGI_MESA_DIRECTION_G) > GAMGI_MATH_TOLERANCE
483 || fabs (direction_class->blue - GAMGI_MESA_DIRECTION_B) > GAMGI_MATH_TOLERANCE)
484 {
485 sprintf (string, "red=\"%.*f\"",
486 GAMGI_MATH_DECIMAL_COLOR, direction_class->red);
487 gamgi_expat_export_element (fp, "<direction", string,
488 depth_parent, depth_last, &column, output, error);
489
490 sprintf (string, "green=\"%.*f\"",
491 GAMGI_MATH_DECIMAL_COLOR, direction_class->green);
492 gamgi_expat_export_element (fp, "<direction", string,
493 depth_parent, depth_last, &column, output, error);
494
495 sprintf (string, "blue=\"%.*f\"",
496 GAMGI_MATH_DECIMAL_COLOR, direction_class->blue);
497 gamgi_expat_export_element (fp, "<direction", string,
498 depth_parent, depth_last, &column, output, error);
499 }
500
501 }
502
503 void gamgi_expat_export_config_plane (gamgi_window *window, FILE *fp,
504 int depth_parent, int *depth_last, gamgi_bool *output, gamgi_bool *error)
505 {
506 gamgi_plane_class *plane_class = gamgi->plane;
507 char string[GAMGI_ENGINE_STRING];
508 int column;
509
510 /****************************
511 * red,green,blue (coupled) *
512 ****************************/
513
514 if (fabs (plane_class->red - GAMGI_MESA_PLANE_R) > GAMGI_MATH_TOLERANCE
515 || fabs (plane_class->green - GAMGI_MESA_PLANE_G) > GAMGI_MATH_TOLERANCE
516 || fabs (plane_class->blue - GAMGI_MESA_PLANE_B) > GAMGI_MATH_TOLERANCE)
517 {
518 sprintf (string, "red=\"%.*f\"",
519 GAMGI_MATH_DECIMAL_COLOR, plane_class->red);
520 gamgi_expat_export_element (fp, "<plane", string,
521 depth_parent, depth_last, &column, output, error);
522
523 sprintf (string, "green=\"%.*f\"",
524 GAMGI_MATH_DECIMAL_COLOR, plane_class->green);
525 gamgi_expat_export_element (fp, "<plane", string,
526 depth_parent, depth_last, &column, output, error);
527
528 sprintf (string, "blue=\"%.*f\"",
529 GAMGI_MATH_DECIMAL_COLOR, plane_class->blue);
530 gamgi_expat_export_element (fp, "<plane", string,
531 depth_parent, depth_last, &column, output, error);
532 }
533
534 }
535
536 void gamgi_expat_export_config_group (gamgi_window *window, FILE *fp,
537 int depth_parent, int *depth_last, gamgi_bool *output, gamgi_bool *error)
538 {
539 }
540
541 void gamgi_expat_export_config_molecule (gamgi_window *window, FILE *fp,
542 int depth_parent, int *depth_last, gamgi_bool *output, gamgi_bool *error)
543 {
544 }
545
546 void gamgi_expat_export_config_cluster (gamgi_window *window, FILE *fp,
547 int depth_parent, int *depth_last, gamgi_bool *output, gamgi_bool *error)
548 {
549 }
550
551 void gamgi_expat_export_config_cell (gamgi_window *window, FILE *fp,
552 int depth_parent, int *depth_last, gamgi_bool *output, gamgi_bool *error)
553 {
554 gamgi_cell_class *cell_class = gamgi->cell;
555 char string[GAMGI_ENGINE_STRING];
556 int column;
557
558 /***************
559 * model, axes *
560 ***************/
561
562 if (cell_class->model != GAMGI_PHYS_CELL_MODEL)
563 {
564 if (cell_class->model == GAMGI_PHYS_CONVENTIONAL)
565 sprintf (string, "model=\"conventional\"");
566 else if (cell_class->model == GAMGI_PHYS_PRIMITIVE)
567 sprintf (string, "model=\"primitive\"");
568 else if (cell_class->model == GAMGI_PHYS_WIGNER)
569 sprintf (string, "model=\"wigner\"");
570 else if (cell_class->model == GAMGI_PHYS_PARALLELEPIPED)
571 sprintf (string, "model=\"parallelepiped\"");
572 else if (cell_class->model == GAMGI_PHYS_SPHERE)
573 sprintf (string, "model=\"sphere\"");
574 else if (cell_class->model == GAMGI_PHYS_PROJECTION)
575 sprintf (string, "model=\"projection\"");
576
577 gamgi_expat_export_element (fp, "<cell", string,
578 depth_parent, depth_last, &column, output, error);
579 }
580
581 if (cell_class->axes != GAMGI_PHYS_CELL_AXES)
582 {
583 if (cell_class->axes == TRUE)
584 sprintf (string, "axes=\"yes\"");
585 else
586 sprintf (string, "axes=\"no\"");
587
588 gamgi_expat_export_element (fp, "<cell", string,
589 depth_parent, depth_last, &column, output, error);
590 }
591
592 /*************************
593 * borders, faces, nodes *
594 *************************/
595
596 if (cell_class->borders != GAMGI_PHYS_CELL_BORDERS)
597 {
598 if (cell_class->borders == GAMGI_PHYS_ALL)
599 sprintf (string, "borders=\"all\"");
600 else if (cell_class->borders == GAMGI_PHYS_FACES)
601 sprintf (string, "borders=\"faces\"");
602 else if (cell_class->borders == GAMGI_PHYS_EDGES)
603 sprintf (string, "borders=\"edges\"");
604 else if (cell_class->borders == GAMGI_PHYS_NONE)
605 sprintf (string, "borders=\"none\"");
606
607 gamgi_expat_export_element (fp, "<cell", string,
608 depth_parent, depth_last, &column, output, error);
609 }
610
611 if (cell_class->faces != GAMGI_PHYS_CELL_FACES)
612 {
613 if (cell_class->faces == TRUE)
614 sprintf (string, "faces=\"yes\"");
615 else
616 sprintf (string, "faces=\"no\"");
617
618 gamgi_expat_export_element (fp, "<cell", string,
619 depth_parent, depth_last, &column, output, error);
620 }
621
622 if (cell_class->nodes != GAMGI_PHYS_CELL_NODES)
623 {
624 if (cell_class->nodes == TRUE)
625 sprintf (string, "nodes=\"yes\"");
626 else
627 sprintf (string, "nodes=\"no\"");
628
629 gamgi_expat_export_element (fp, "<cell", string,
630 depth_parent, depth_last, &column, output, error);
631 }
632
633 /****************************
634 * red,green,blue (coupled) *
635 ****************************/
636
637 if (fabs (cell_class->red - GAMGI_MESA_CELL_R) > GAMGI_MATH_TOLERANCE
638 || fabs (cell_class->green - GAMGI_MESA_CELL_G) > GAMGI_MATH_TOLERANCE
639 || fabs (cell_class->blue - GAMGI_MESA_CELL_B) > GAMGI_MATH_TOLERANCE)
640 {
641 sprintf (string, "red=\"%.*f\"",
642 GAMGI_MATH_DECIMAL_COLOR, cell_class->red);
643 gamgi_expat_export_element (fp, "<cell", string,
644 depth_parent, depth_last, &column, output, error);
645
646 sprintf (string, "green=\"%.*f\"",
647 GAMGI_MATH_DECIMAL_COLOR, cell_class->green);
648 gamgi_expat_export_element (fp, "<cell", string,
649 depth_parent, depth_last, &column, output, error);
650
651 sprintf (string, "blue=\"%.*f\"",
652 GAMGI_MATH_DECIMAL_COLOR, cell_class->blue);
653 gamgi_expat_export_element (fp, "<cell", string,
654 depth_parent, depth_last, &column, output, error);
655 }
656
657 /************************************************************
658 * Global parameters: axes sise, borders width, nodes width *
659 ************************************************************/
660
661 if (fabs (cell_class->axes_size - GAMGI_MESA_AXES_SIZE) > GAMGI_MATH_TOLERANCE)
662 {
663 sprintf (string, "axes_size=\"%.*f\"",
664 GAMGI_MATH_DECIMAL_SIZE, cell_class->axes_size);
665 gamgi_expat_export_element (fp, "<cell", string,
666 depth_parent, depth_last, &column, output, error);
667 }
668
669 if (cell_class->borders_width != GAMGI_MESA_CELL_LINE)
670 {
671 sprintf (string, "borders_width=\"%d\"", cell_class->borders_width);
672 gamgi_expat_export_element (fp, "<cell", string,
673 depth_parent, depth_last, &column, output, error);
674 }
675
676 if (cell_class->nodes_width != GAMGI_MESA_CELL_POINT)
677 {
678 sprintf (string, "nodes_width=\"%d\"", cell_class->nodes_width);
679 gamgi_expat_export_element (fp, "<cell", string,
680 depth_parent, depth_last, &column, output, error);
681 }
682
683 }
684
685 void gamgi_expat_export_config_arrow (gamgi_window *window, FILE *fp,
686 int depth_parent, int *depth_last, gamgi_bool *output, gamgi_bool *error)
687 {
688 }
689
690 void gamgi_expat_export_config_shape (gamgi_window *window, FILE *fp,
691 int depth_parent, int *depth_last, gamgi_bool *output, gamgi_bool *error)
692 {
693 }
694
695 void gamgi_expat_export_config_graph (gamgi_window *window, FILE *fp,
696 int depth_parent, int *depth_last, gamgi_bool *output, gamgi_bool *error)
697 {
698 }
699
700 void gamgi_expat_export_config_assembly (gamgi_window *window, FILE *fp,
701 int depth_parent, int *depth_last, gamgi_bool *output, gamgi_bool *error)
702 {
703 }
704
705 void gamgi_expat_export_config_light (gamgi_window *window, FILE *fp,
706 int depth_parent, int *depth_last, gamgi_bool *output, gamgi_bool *error)
707 {
708 gamgi_light_class *light_class = gamgi->light;
709 char string[GAMGI_ENGINE_STRING];
710 int column;
711
712 /*************
713 * shininess *
714 *************/
715
716 if (fabs (light_class->shininess - GAMGI_MESA_LIGHT_SHININESS) > GAMGI_MATH_TOLERANCE)
717 {
718 sprintf (string, "shininess=\"%.*f\"",
719 GAMGI_MATH_DECIMAL_SHININESS, light_class->shininess);
720 gamgi_expat_export_element (fp, "<light", string,
721 depth_parent, depth_last, &column, output, error);
722 }
723
724 /*********************
725 * ambient component *
726 *********************/
727
728 if (fabs (light_class->ambient[0] - GAMGI_MESA_LIGHT_AMBIENT_R) > GAMGI_MATH_TOLERANCE
729 || fabs (light_class->ambient[1] - GAMGI_MESA_LIGHT_AMBIENT_G) > GAMGI_MATH_TOLERANCE
730 || fabs (light_class->ambient[2] - GAMGI_MESA_LIGHT_AMBIENT_B) > GAMGI_MATH_TOLERANCE)
731 {
732 sprintf (string, "ambient_r=\"%.*f\"",
733 GAMGI_MATH_DECIMAL_COLOR, light_class->ambient[0]);
734 gamgi_expat_export_element (fp, "<light", string,
735 depth_parent, depth_last, &column, output, error);
736
737 sprintf (string, "ambient_g=\"%.*f\"",
738 GAMGI_MATH_DECIMAL_COLOR, light_class->ambient[1]);
739 gamgi_expat_export_element (fp, "<light", string,
740 depth_parent, depth_last, &column, output, error);
741
742 sprintf (string, "ambient_b=\"%.*f\"",
743 GAMGI_MATH_DECIMAL_COLOR, light_class->ambient[2]);
744 gamgi_expat_export_element (fp, "<light", string,
745 depth_parent, depth_last, &column, output, error);
746 }
747
748 /*********************
749 * diffuse component *
750 *********************/
751
752 if (fabs (light_class->diffuse[0] - GAMGI_MESA_LIGHT_DIFFUSE_R) > GAMGI_MATH_TOLERANCE
753 || fabs (light_class->diffuse[1] - GAMGI_MESA_LIGHT_DIFFUSE_G) > GAMGI_MATH_TOLERANCE
754 || fabs (light_class->diffuse[2] - GAMGI_MESA_LIGHT_DIFFUSE_B) > GAMGI_MATH_TOLERANCE)
755 {
756 sprintf (string, "diffuse_r=\"%.*f\"",
757 GAMGI_MATH_DECIMAL_COLOR, light_class->diffuse[0]);
758 gamgi_expat_export_element (fp, "<light", string,
759 depth_parent, depth_last, &column, output, error);
760
761 sprintf (string, "diffuse_g=\"%.*f\"",
762 GAMGI_MATH_DECIMAL_COLOR, light_class->diffuse[1]);
763 gamgi_expat_export_element (fp, "<light", string,
764 depth_parent, depth_last, &column, output, error);
765
766 sprintf (string, "diffuse_b=\"%.*f\"",
767 GAMGI_MATH_DECIMAL_COLOR, light_class->diffuse[2]);
768 gamgi_expat_export_element (fp, "<light", string,
769 depth_parent, depth_last, &column, output, error);
770 }
771
772 /**********************
773 * specular component *
774 **********************/
775
776 if (fabs (light_class->specular[0] - GAMGI_MESA_LIGHT_SPECULAR_R) > GAMGI_MATH_TOLERANCE
777 || fabs (light_class->specular[1] - GAMGI_MESA_LIGHT_SPECULAR_G) > GAMGI_MATH_TOLERANCE
778 || fabs (light_class->specular[2] - GAMGI_MESA_LIGHT_SPECULAR_B) > GAMGI_MATH_TOLERANCE)
779 {
780 sprintf (string, "specular_r=\"%.*f\"",
781 GAMGI_MATH_DECIMAL_COLOR, light_class->specular[0]);
782 gamgi_expat_export_element (fp, "<light", string,
783 depth_parent, depth_last, &column, output, error);
784
785 sprintf (string, "specular_g=\"%.*f\"",
786 GAMGI_MATH_DECIMAL_COLOR, light_class->specular[1]);
787 gamgi_expat_export_element (fp, "<light", string,
788 depth_parent, depth_last, &column, output, error);
789
790 sprintf (string, "specular_b=\"%.*f\"",
791 GAMGI_MATH_DECIMAL_COLOR, light_class->specular[2]);
792 gamgi_expat_export_element (fp, "<light", string,
793 depth_parent, depth_last, &column, output, error);
794 }
795
796 }
797
798 void gamgi_expat_export_config_layer (gamgi_window *window, FILE *fp,
799 int depth_parent, int *depth_last, gamgi_bool *output, gamgi_bool *error)
800 {
801 gamgi_layer_class *layer_class = gamgi->layer;
802 char string[GAMGI_ENGINE_STRING];
803 int column;
804
805 /**************
806 * undo, save *
807 **************/
808
809 if (layer_class->undo != GAMGI_ENGINE_UNDO)
810 {
811 sprintf (string, "undo=\"%d\"", layer_class->undo);
812 gamgi_expat_export_element (fp, "<layer", string,
813 depth_parent, depth_last, &column, output, error);
814 }
815
816 if (layer_class->save != GAMGI_ENGINE_SAVE)
817 {
818 sprintf (string, "save=\"%d\"", layer_class->save);
819 gamgi_expat_export_element (fp, "<layer", string,
820 depth_parent, depth_last, &column, output, error);
821 }
822
823 /*******************************
824 * projection parameters: *
825 * perspective, top, near, far *
826 *******************************/
827
828 if (layer_class->perspective != GAMGI_MESA_LAYER_PERSPECTIVE)
829 {
830 if (layer_class->perspective == TRUE)
831 sprintf (string, "perspective=\"yes\"");
832 else
833 sprintf (string, "perspective=\"no\"");
834 gamgi_expat_export_element (fp, "<layer", string,
835 depth_parent, depth_last, &column, output, error);
836 }
837
838 if (fabs (layer_class->top - GAMGI_MESA_LAYER_TOP) > GAMGI_MATH_TOLERANCE)
839 {
840 sprintf (string, "top=\"%.*f\"",
841 gamgi->gamgi->length, layer_class->top);
842 gamgi_expat_export_element (fp, "<layer", string,
843 depth_parent, depth_last, &column, output, error);
844 }
845
846 if (fabs (layer_class->near - GAMGI_MESA_LAYER_NEAR) > GAMGI_MATH_TOLERANCE)
847 {
848 sprintf (string, "near=\"%.*f\"",
849 gamgi->gamgi->length, layer_class->near);
850 gamgi_expat_export_element (fp, "<layer", string,
851 depth_parent, depth_last, &column, output, error);
852 }
853
854 if (fabs (layer_class->far - GAMGI_MESA_LAYER_FAR) > GAMGI_MATH_TOLERANCE)
855 {
856 sprintf (string, "far=\"%.*f\"",
857 gamgi->gamgi->length, layer_class->far);
858 gamgi_expat_export_element (fp, "<layer", string,
859 depth_parent, depth_last, &column, output, error);
860 }
861
862 /*******************************************************
863 * modelview parameters: eye_x, eye_y, eye_z (coupled) *
864 *******************************************************/
865
866 if (fabs (layer_class->eye[0] - GAMGI_MESA_LAYER_EYEX) > GAMGI_MATH_TOLERANCE
867 || fabs (layer_class->eye[1] - GAMGI_MESA_LAYER_EYEY) > GAMGI_MATH_TOLERANCE
868 || fabs (layer_class->eye[2] - GAMGI_MESA_LAYER_EYEZ) > GAMGI_MATH_TOLERANCE)
869 {
870 sprintf (string, "eye_x=\"%.*f\"",
871 gamgi->gamgi->length, layer_class->eye[0]);
872 gamgi_expat_export_element (fp, "<layer", string,
873 depth_parent, depth_last, &column, output, error);
874
875 sprintf (string, "eye_y=\"%.*f\"",
876 gamgi->gamgi->length, layer_class->eye[1]);
877 gamgi_expat_export_element (fp, "<layer", string,
878 depth_parent, depth_last, &column, output, error);
879
880 sprintf (string, "eye_z=\"%.*f\"",
881 gamgi->gamgi->length, layer_class->eye[2]);
882 gamgi_expat_export_element (fp, "<gamgi", string,
883 depth_parent, depth_last, &column, output, error);
884 }
885
886 /****************************************************************
887 * modelview parameters: center_x, center_y, center_z (coupled) *
888 ****************************************************************/
889
890 if (fabs (layer_class->center[0] - GAMGI_MESA_LAYER_CENTERX) > GAMGI_MATH_TOLERANCE
891 || fabs (layer_class->center[1] - GAMGI_MESA_LAYER_CENTERY) > GAMGI_MATH_TOLERANCE
892 || fabs (layer_class->center[2] - GAMGI_MESA_LAYER_CENTERZ) > GAMGI_MATH_TOLERANCE)
893 {
894 sprintf (string, "center_x=\"%.*f\"",
895 gamgi->gamgi->length, layer_class->center[0]);
896 gamgi_expat_export_element (fp, "<layer", string,
897 depth_parent, depth_last, &column, output, error);
898
899 sprintf (string, "center_y=\"%.*f\"",
900 gamgi->gamgi->length, layer_class->center[1]);
901 gamgi_expat_export_element (fp, "<layer", string,
902 depth_parent, depth_last, &column, output, error);
903
904 sprintf (string, "center_z=\"%.*f\"",
905 gamgi->gamgi->length, layer_class->center[2]);
906 gamgi_expat_export_element (fp, "<gamgi", string,
907 depth_parent, depth_last, &column, output, error);
908 }
909
910 /****************************************************
911 * modelview parameters: up_x, up_y, up_z (coupled) *
912 ****************************************************/
913
914 if (fabs (layer_class->up[0] - GAMGI_MESA_LAYER_UPX) > GAMGI_MATH_TOLERANCE
915 || fabs (layer_class->up[1] - GAMGI_MESA_LAYER_UPY) > GAMGI_MATH_TOLERANCE
916 || fabs (layer_class->up[2] - GAMGI_MESA_LAYER_UPZ) > GAMGI_MATH_TOLERANCE)
917 {
918 sprintf (string, "up_x=\"%.*f\"",
919 gamgi->gamgi->length, layer_class->up[0]);
920 gamgi_expat_export_element (fp, "<layer", string,
921 depth_parent, depth_last, &column, output, error);
922
923 sprintf (string, "up_y=\"%.*f\"",
924 gamgi->gamgi->length, layer_class->up[1]);
925 gamgi_expat_export_element (fp, "<layer", string,
926 depth_parent, depth_last, &column, output, error);
927
928 sprintf (string, "up_z=\"%.*f\"",
929 gamgi->gamgi->length, layer_class->up[2]);
930 gamgi_expat_export_element (fp, "<gamgi", string,
931 depth_parent, depth_last, &column, output, error);
932 }
933 }
934
935 void gamgi_expat_export_config_window (gamgi_window *window, FILE *fp,
936 int depth_parent, int *depth_last, gamgi_bool *output, gamgi_bool *error)
937 {
938 gamgi_window_class *window_class = gamgi->window;
939 char string[GAMGI_ENGINE_STRING];
940 int column;
941
942 /********************
943 * ruler parameters *
944 ********************/
945
946 /**********
947 * rotate *
948 **********/
949
950 if (fabs (window_class->rotate_max - GAMGI_GTK_ROTATE_MAX) > GAMGI_MATH_TOLERANCE)
951 {
952 sprintf (string, "rotate_max=\"%.*f\"",
953 gamgi->gamgi->angle, window_class->rotate_max);
954 gamgi_expat_export_element (fp, "<window", string,
955 depth_parent, depth_last, &column, output, error);
956 }
957
958 if (fabs (window_class->rotate_step - GAMGI_GTK_ROTATE_STEP) > GAMGI_MATH_TOLERANCE)
959 {
960 sprintf (string, "rotate_step=\"%.*f\"",
961 gamgi->gamgi->angle, window_class->rotate_step);
962 gamgi_expat_export_element (fp, "<window", string,
963 depth_parent, depth_last, &column, output, error);
964 }
965
966 /********
967 * move *
968 ********/
969
970 if (fabs (window_class->move_max - GAMGI_GTK_MOVE_MAX) > GAMGI_MATH_TOLERANCE)
971 {
972 sprintf (string, "move_max=\"%.*f\"",
973 gamgi->gamgi->angle, window_class->move_max);
974 gamgi_expat_export_element (fp, "<window", string,
975 depth_parent, depth_last, &column, output, error);
976 }
977
978 if (fabs (window_class->move_step - GAMGI_GTK_MOVE_STEP) > GAMGI_MATH_TOLERANCE)
979 {
980 sprintf (string, "move_step=\"%.*f\"",
981 gamgi->gamgi->angle, window_class->move_step);
982 gamgi_expat_export_element (fp, "<window", string,
983 depth_parent, depth_last, &column, output, error);
984 }
985
986 /*********
987 * scale *
988 *********/
989
990 if (fabs (window_class->scale_max - GAMGI_GTK_SCALE_MAX) > GAMGI_MATH_TOLERANCE)
991 {
992 sprintf (string, "scale_max=\"%.*f\"",
993 gamgi->gamgi->angle, window_class->scale_max);
994 gamgi_expat_export_element (fp, "<window", string,
995 depth_parent, depth_last, &column, output, error);
996 }
997
998 if (fabs (window_class->scale_step - GAMGI_GTK_SCALE_STEP) > GAMGI_MATH_TOLERANCE)
999 {
1000 sprintf (string, "scale_step=\"%.*f\"",
1001 gamgi->gamgi->angle, window_class->scale_step);
1002 gamgi_expat_export_element (fp, "<window", string,
1003 depth_parent, depth_last, &column, output, error);
1004 }
1005
1006 }
1007
1008 void gamgi_expat_export_config_gamgi (gamgi_window *window, FILE *fp,
1009 int depth_parent, int *depth_last, gamgi_bool *output, gamgi_bool *error)
1010 {
1011 gamgi_gamgi_class *gamgi_class = gamgi->gamgi;
1012 char string[GAMGI_ENGINE_STRING];
1013 int column;
1014
1015 /**************
1016 * beep sound *
1017 **************/
1018
1019 if (gamgi_class->beep != GAMGI_GTK_BEEP)
1020 {
1021 if (gamgi_class->beep == TRUE)
1022 sprintf (string, "sound=\"yes\"");
1023 else
1024 sprintf (string, "sound=\"no\"");
1025 gamgi_expat_export_element (fp, "<gamgi", string,
1026 depth_parent, depth_last, &column, output, error);
1027 }
1028
1029 /******************
1030 * pick tolerance *
1031 ******************/
1032
1033 if (gamgi_class->tolerance != GAMGI_MESA_PICK_TOLERANCE)
1034 {
1035 sprintf (string, "tolerance=\"%d\"", gamgi_class->tolerance);
1036 gamgi_expat_export_element (fp, "<gamgi", string,
1037 depth_parent, depth_last, &column, output, error);
1038 }
1039
1040 /***************************
1041 * mouse buttons (coupled) *
1042 ***************************/
1043
1044 if (gamgi_class->button1 != GDK_BUTTON1_MASK
1045 || gamgi_class->button2 != GDK_BUTTON2_MASK
1046 || gamgi_class->button3 != GDK_BUTTON3_MASK)
1047 {
1048 sprintf (string, "button1=\"%d\"", gamgi_class->button1);
1049 gamgi_expat_export_element (fp, "<gamgi", string,
1050 depth_parent, depth_last, &column, output, error);
1051
1052 sprintf (string, "button2=\"%d\"", gamgi_class->button2);
1053 gamgi_expat_export_element (fp, "<gamgi", string,
1054 depth_parent, depth_last, &column, output, error);
1055
1056 sprintf (string, "button1=\"%d\"", gamgi_class->button3);
1057 gamgi_expat_export_element (fp, "<gamgi", string,
1058 depth_parent, depth_last, &column, output, error);
1059 }
1060
1061 /**********************************************************
1062 * number of decimal figures: length, angle, charge, mass *
1063 **********************************************************/
1064
1065 if (gamgi_class->length != GAMGI_MATH_DECIMAL_LENGTH)
1066 {
1067 sprintf (string, "length=\"%d\"", gamgi_class->length);
1068 gamgi_expat_export_element (fp, "<gamgi", string,
1069 depth_parent, depth_last, &column, output, error);
1070 }
1071
1072 if (gamgi_class->angle != GAMGI_MATH_DECIMAL_ANGLE)
1073 {
1074 sprintf (string, "angle=\"%d\"", gamgi_class->angle);
1075 gamgi_expat_export_element (fp, "<gamgi", string,
1076 depth_parent, depth_last, &column, output, error);
1077 }
1078
1079 if (gamgi_class->charge != GAMGI_MATH_DECIMAL_CHARGE)
1080 {
1081 sprintf (string, "charge=\"%d\"", gamgi_class->charge);
1082 gamgi_expat_export_element (fp, "<gamgi", string,
1083 depth_parent, depth_last, &column, output, error);
1084 }
1085
1086 if (gamgi_class->mass != GAMGI_MATH_DECIMAL_MASS)
1087 {
1088 sprintf (string, "mass=\"%d\"", gamgi_class->mass);
1089 gamgi_expat_export_element (fp, "<gamgi", string,
1090 depth_parent, depth_last, &column, output, error);
1091 }
1092
1093 /**************************************
1094 * background GtkText color (coupled) *
1095 **************************************/
1096
1097 if (fabs (gamgi_class->background[0] - GAMGI_GTK_BACKGROUND_R) > GAMGI_MATH_TOLERANCE
1098 || fabs (gamgi_class->background[1] - GAMGI_GTK_BACKGROUND_G) > GAMGI_MATH_TOLERANCE
1099 || fabs (gamgi_class->background[2] - GAMGI_GTK_BACKGROUND_B) > GAMGI_MATH_TOLERANCE)
1100 {
1101 sprintf (string, "base_r=\"%.*f\"",
1102 GAMGI_MATH_DECIMAL_COLOR, gamgi_class->background[0]);
1103 gamgi_expat_export_element (fp, "<gamgi", string,
1104 depth_parent, depth_last, &column, output, error);
1105
1106 sprintf (string, "base_g=\"%.*f\"",
1107 GAMGI_MATH_DECIMAL_COLOR, gamgi_class->background[1]);
1108 gamgi_expat_export_element (fp, "<gamgi", string,
1109 depth_parent, depth_last, &column, output, error);
1110
1111 sprintf (string, "base_b=\"%.*f\"",
1112 GAMGI_MATH_DECIMAL_COLOR, gamgi_class->background[2]);
1113 gamgi_expat_export_element (fp, "<gamgi", string,
1114 depth_parent, depth_last, &column, output, error);
1115 }
1116
1117 /**************************************
1118 * foreground GtkText color (coupled) *
1119 **************************************/
1120
1121 if (fabs (gamgi_class->foreground[0] - GAMGI_GTK_FOREGROUND_R) > GAMGI_MATH_TOLERANCE
1122 || fabs (gamgi_class->foreground[1] - GAMGI_GTK_FOREGROUND_G) > GAMGI_MATH_TOLERANCE
1123 || fabs (gamgi_class->foreground[2] - GAMGI_GTK_FOREGROUND_B) > GAMGI_MATH_TOLERANCE)
1124 {
1125 sprintf (string, "text_r=\"%.*f\"",
1126 GAMGI_MATH_DECIMAL_COLOR, gamgi_class->foreground[0]);
1127 gamgi_expat_export_element (fp, "<gamgi", string,
1128 depth_parent, depth_last, &column, output, error);
1129
1130 sprintf (string, "text_g=\"%.*f\"",
1131 GAMGI_MATH_DECIMAL_COLOR, gamgi_class->foreground[1]);
1132 gamgi_expat_export_element (fp, "<gamgi", string,
1133 depth_parent, depth_last, &column, output, error);
1134
1135 sprintf (string, "text_b=\"%.*f\"",
1136 GAMGI_MATH_DECIMAL_COLOR, gamgi_class->foreground[2]);
1137 gamgi_expat_export_element (fp, "<gamgi", string,
1138 depth_parent, depth_last, &column, output, error);
1139 }
1140
1141 /*********************************
1142 * title GtkText color (coupled) *
1143 *********************************/
1144
1145 if (fabs (gamgi_class->title[0] - GAMGI_GTK_TITLE_R) > GAMGI_MATH_TOLERANCE
1146 || fabs (gamgi_class->title[1] - GAMGI_GTK_TITLE_G) > GAMGI_MATH_TOLERANCE
1147 || fabs (gamgi_class->title[2] - GAMGI_GTK_TITLE_B) > GAMGI_MATH_TOLERANCE)
1148 {
1149 sprintf (string, "title_r=\"%.*f\"",
1150 GAMGI_MATH_DECIMAL_COLOR, gamgi_class->title[0]);
1151 gamgi_expat_export_element (fp, "<gamgi", string,
1152 depth_parent, depth_last, &column, output, error);
1153
1154 sprintf (string, "title_g=\"%.*f\"",
1155 GAMGI_MATH_DECIMAL_COLOR, gamgi_class->title[1]);
1156 gamgi_expat_export_element (fp, "<gamgi", string,
1157 depth_parent, depth_last, &column, output, error);
1158
1159 sprintf (string, "title_b=\"%.*f\"",
1160 GAMGI_MATH_DECIMAL_COLOR, gamgi_class->title[2]);
1161 gamgi_expat_export_element (fp, "<gamgi", string,
1162 depth_parent, depth_last, &column, output, error);
1163 }
1164
1165 /********************************
1166 * bold GtkText color (coupled) *
1167 ********************************/
1168
1169 if (fabs (gamgi_class->bold[0] - GAMGI_GTK_BOLD_R) > GAMGI_MATH_TOLERANCE
1170 || fabs (gamgi_class->bold[1] - GAMGI_GTK_BOLD_G) > GAMGI_MATH_TOLERANCE
1171 || fabs (gamgi_class->bold[2] - GAMGI_GTK_BOLD_B) > GAMGI_MATH_TOLERANCE)
1172 {
1173 sprintf (string, "bold_r=\"%.*f\"",
1174 GAMGI_MATH_DECIMAL_COLOR, gamgi_class->bold[0]);
1175 gamgi_expat_export_element (fp, "<gamgi", string,
1176 depth_parent, depth_last, &column, output, error);
1177
1178 sprintf (string, "bold_g=\"%.*f\"",
1179 GAMGI_MATH_DECIMAL_COLOR, gamgi_class->bold[1]);
1180 gamgi_expat_export_element (fp, "<gamgi", string,
1181 depth_parent, depth_last, &column, output, error);
1182
1183 sprintf (string, "bold_b=\"%.*f\"",
1184 GAMGI_MATH_DECIMAL_COLOR, gamgi_class->bold[2]);
1185 gamgi_expat_export_element (fp, "<gamgi", string,
1186 depth_parent, depth_last, &column, output, error);
1187 }
1188
1189 /********************************
1190 * link GtkText color (coupled) *
1191 ********************************/
1192
1193 if (fabs (gamgi_class->link[0] - GAMGI_GTK_LINK_R) > GAMGI_MATH_TOLERANCE
1194 || fabs (gamgi_class->link[1] - GAMGI_GTK_LINK_G) > GAMGI_MATH_TOLERANCE
1195 || fabs (gamgi_class->link[2] - GAMGI_GTK_LINK_B) > GAMGI_MATH_TOLERANCE)
1196 {
1197 sprintf (string, "link_r=\"%.*f\"",
1198 GAMGI_MATH_DECIMAL_COLOR, gamgi_class->link[0]);
1199 gamgi_expat_export_element (fp, "<gamgi", string,
1200 depth_parent, depth_last, &column, output, error);
1201
1202 sprintf (string, "link_g=\"%.*f\"",
1203 GAMGI_MATH_DECIMAL_COLOR, gamgi_class->link[1]);
1204 gamgi_expat_export_element (fp, "<gamgi", string,
1205 depth_parent, depth_last, &column, output, error);
1206
1207 sprintf (string, "link_b=\"%.*f\"",
1208 GAMGI_MATH_DECIMAL_COLOR, gamgi_class->link[2]);
1209 gamgi_expat_export_element (fp, "<gamgi", string,
1210 depth_parent, depth_last, &column, output, error);
1211 }
1212
1213 }