2002-06-23 Hans Breuer <hans@breuer.org>
[dia.git] / objects / EML / process.c
bloba5118c95de5a3fa28e5908a7218c52d322bd1ac5
1 /* Dia -- an diagram creation/manipulation program
2 * Copyright (C) 1998 Alexander Larsson
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 #include <assert.h>
19 #include <gtk/gtk.h>
20 #include <math.h>
21 #include <string.h>
23 #include "config.h"
24 #include "intl.h"
25 #include "render.h"
26 #include "attributes.h"
28 #include "process.h"
30 #include "pixmaps/emlprocess.xpm"
32 #define EMLPROCESS_BORDER 0.1
33 #define EMLPROCESS_SECTIONWIDTH 0.05
34 #define EMLPROCESS_UNDERLINEWIDTH 0.0
36 static real emlprocess_distance_from(EMLProcess *emlprocess, Point *point);
37 static void emlprocess_select(EMLProcess *emlprocess, Point *clicked_point,
38 Renderer *interactive_renderer);
39 static void emlprocess_move_handle(EMLProcess *emlprocess, Handle *handle,
40 Point *to, HandleMoveReason reason, ModifierKeys modifiers);
41 static void emlprocess_move(EMLProcess *emlprocess, Point *to);
42 static void emlprocess_draw(EMLProcess *emlprocess, Renderer *renderer);
43 static Object *emlprocess_create(Point *startpoint,
44 void *user_data,
45 Handle **handle1,
46 Handle **handle2);
47 static void emlprocess_destroy(EMLProcess *emlprocess);
48 static Object *emlprocess_copy(EMLProcess *emlprocess);
50 static void emlprocess_save(EMLProcess *emlprocess, ObjectNode obj_node,
51 const char *filename);
52 static Object *emlprocess_load(ObjectNode obj_node, int version,
53 const char *filename);
55 static ObjectTypeOps emlprocess_type_ops =
57 (CreateFunc) emlprocess_create,
58 (LoadFunc) emlprocess_load,
59 (SaveFunc) emlprocess_save
62 ObjectType emlprocess_type =
64 "EML - Process", /* name */
65 0, /* version */
66 (char **) emlprocess_xpm, /* pixmap */
68 &emlprocess_type_ops /* ops */
71 static ObjectOps emlprocess_ops = {
72 (DestroyFunc) emlprocess_destroy,
73 (DrawFunc) emlprocess_draw,
74 (DistanceFunc) emlprocess_distance_from,
75 (SelectFunc) emlprocess_select,
76 (CopyFunc) emlprocess_copy,
77 (MoveFunc) emlprocess_move,
78 (MoveHandleFunc) emlprocess_move_handle,
79 (GetPropertiesFunc) emlprocess_get_properties,
80 (ApplyPropertiesFunc) emlprocess_apply_properties,
81 (ObjectMenuFunc) NULL
85 static real
86 emlprocess_distance_from(EMLProcess *emlprocess, Point *point)
88 Object *obj = &emlprocess->element.object;
89 return distance_rectangle_point(&obj->bounding_box, point);
92 static void
93 emlprocess_select(EMLProcess *emlprocess, Point *clicked_point,
94 Renderer *interactive_renderer)
96 element_update_handles(&emlprocess->element);
99 static void
100 emlprocess_move_handle(EMLProcess *emlprocess, Handle *handle,
101 Point *to, HandleMoveReason reason, ModifierKeys modifiers)
103 assert(emlprocess!=NULL);
104 assert(handle!=NULL);
105 assert(to!=NULL);
107 assert(handle->id < 8);
110 static void
111 emlprocess_move(EMLProcess *emlprocess, Point *to)
113 emlprocess->element.corner = *to;
114 emlprocess_calculate_connections(emlprocess);
115 emlprocess_update_data(emlprocess);
118 static void
119 emlprocess_draw(EMLProcess *emlprocess, Renderer *renderer)
121 EMLBox *namebox;
122 Point point;
123 assert(emlprocess != NULL);
124 assert(renderer != NULL);
126 namebox = emlprocess->name_box;
127 g_free(namebox->els->data);
128 namebox->els->data = g_strdup(emlprocess->name);
129 point.x = namebox->right_connection->pos.x - 0.2;
130 point.y = namebox->right_connection->pos.y
131 + namebox->font_height / 2.0;
133 emlbox_draw(emlprocess->box, renderer, &emlprocess->element);
135 renderer->ops->set_font(renderer, namebox->font, namebox->font_height);
136 renderer->ops->draw_string(renderer, emlprocess->refname, &point,
137 ALIGN_RIGHT, &color_black);
140 void
141 emlprocess_calculate_connections(EMLProcess *emlprocess)
143 real height, width;
144 ConnectionPoint *connection;
145 real x, y;
147 Element *elem = &emlprocess->element;
149 g_list_free(emlprocess->box_connections);
150 emlprocess->box_connections = NULL;
152 connection = &emlprocess->proc_connections[4];
153 x = elem->corner.x;
154 y = elem->corner.y;
156 width = elem->width;
157 height = emlbox_calc_connections(emlprocess->box, &elem->corner,
158 &emlprocess->box_connections, width);
160 emlprocess->box_connections =
161 g_list_prepend(emlprocess->box_connections, connection);
162 connection->pos.x = x;
163 connection->pos.y = y;
164 connection++;
166 emlprocess->box_connections =
167 g_list_prepend(emlprocess->box_connections, connection);
168 connection->pos.x = x + width / 2.0;
169 connection->pos.y = y;
170 connection++;
172 emlprocess->box_connections =
173 g_list_prepend(emlprocess->box_connections, connection);
174 connection->pos.x = x + width;
175 connection->pos.y = y;
176 connection++;
178 emlprocess->box_connections =
179 g_list_prepend(emlprocess->box_connections, connection);
180 connection->pos.x = x;
181 connection->pos.y = y + height;
182 connection++;
184 emlprocess->box_connections = g_list_prepend(emlprocess->box_connections, connection);
185 connection->pos.x = x + width / 2.0;
186 connection->pos.y = y + height;
187 connection++;
189 emlprocess->box_connections =
190 g_list_prepend(emlprocess->box_connections, connection);
191 connection->pos.x = x + width;
192 connection->pos.y = y + height;
195 void
196 emlprocess_update_data(EMLProcess *emlprocess)
198 Element *elem = &emlprocess->element;
199 Object *obj = (Object *)emlprocess;
201 element_update_boundingbox(elem);
202 /* fix boundingemlprocess for line_width: */
203 obj->bounding_box.top -= EMLPROCESS_BORDER/2.0;
204 obj->bounding_box.left -= EMLPROCESS_BORDER/2.0;
205 obj->bounding_box.bottom += EMLPROCESS_BORDER/2.0;
206 obj->bounding_box.right += EMLPROCESS_BORDER/2.0;
208 obj->position = elem->corner;
210 element_update_handles(elem);
214 void
215 emlprocess_calculate_data(EMLProcess *emlprocess)
217 emlprocess->element.width = 0;
218 emlprocess->element.height = 0;
220 emlbox_calc_geometry(emlprocess->box,
221 &emlprocess->element.width,
222 &emlprocess->element.height);
224 emlprocess->element.width += 2 * 0.2;
227 static
228 GList*
229 parameters_get_relations(GList *params)
231 EMLParameter *param;
232 GList *retlist;
233 GList *list;
235 retlist = NULL;
236 list = params;
237 while (list != NULL) {
238 param = (EMLParameter *) list->data;
239 if (param->type == EML_RELATION)
240 retlist = g_list_append(retlist, param);
242 list = g_list_next(list);
245 return retlist;
248 static
249 EMLBox*
250 create_startup_box(EMLProcess *emlprocess)
252 EMLBox *topbox;
253 EMLBox *childbox;
254 EMLBox *textbox;
255 EMLParameter *param;
256 gchar *text;
257 GList *list;
259 topbox = EMLListBox.new(0, NULL,
260 ALIGN_LEFT,
261 EMLPROCESS_BORDER,
262 EMLPROCESS_SECTIONWIDTH,
263 LINESTYLE_SOLID,
264 NULL, NULL);
266 textbox = EMLTextBox.new(emlprocess->startupfun_font_height,
267 emlprocess->startupfun_font,
268 ALIGN_LEFT,
269 EMLPROCESS_BORDER,
270 EMLPROCESS_SECTIONWIDTH,
271 LINESTYLE_SOLID,
272 emlprocess->startupfun->left_connection,
273 emlprocess->startupfun->right_connection);
275 if (strlen(emlprocess->startupfun->name) == 0
276 && strlen(emlprocess->startupfun->module) == 0
277 && emlprocess->startupfun->parameters == NULL)
278 text = g_strdup(" ");
279 else
280 text = eml_get_function_string(emlprocess->startupfun);
281 emlbox_add_el(textbox, text);
282 emlbox_add_el(topbox, textbox);
284 /* relations */
285 list = parameters_get_relations(emlprocess->startupfun->parameters);
286 if (list != NULL) {
287 childbox = EMLListBox.new(0, NULL,
288 ALIGN_LEFT,
289 EMLPROCESS_BORDER,
290 EMLPROCESS_UNDERLINEWIDTH,
291 LINESTYLE_SOLID,
292 NULL, NULL);
293 emlbox_add_el(topbox, childbox);
295 while (list != NULL) {
296 param = (EMLParameter*) list->data;
297 if (param->type == EML_RELATION) {
298 textbox = EMLTextBox.new(emlprocess->startupparams_height,
299 emlprocess->startupparams_font,
300 ALIGN_LEFT,
301 EMLPROCESS_BORDER,
302 EMLPROCESS_UNDERLINEWIDTH,
303 LINESTYLE_SOLID,
304 param->left_connection,
305 param->right_connection);
306 text = eml_get_parameter_string(param);
307 emlbox_add_el(textbox, text);
308 emlbox_add_el(childbox, textbox);
311 list = g_list_next(list);
313 g_list_free(list);
316 return topbox;
319 static
320 EMLBox*
321 create_interfaces_box(EMLProcess *emlprocess)
323 EMLBox *topbox;
324 EMLBox *childbox;
325 EMLBox *childbox2;
326 EMLBox *textbox;
327 EMLInterface *iface;
328 EMLFunction *fun;
329 EMLParameter *param;
330 GList *list, *child_list;
332 list = emlprocess->interfaces;
333 if (list == NULL)
334 return NULL;
336 topbox = EMLListBox.new(0, NULL,
337 ALIGN_LEFT,
338 EMLPROCESS_BORDER,
339 EMLPROCESS_SECTIONWIDTH,
340 LINESTYLE_SOLID,
341 NULL, NULL);
343 while (list != NULL) {
344 childbox = EMLListBox.new(0, NULL,
345 ALIGN_LEFT,
346 EMLPROCESS_BORDER,
347 EMLPROCESS_SECTIONWIDTH,
348 LINESTYLE_DOTTED,
349 NULL, NULL);
350 emlbox_add_el(topbox, childbox);
352 iface = (EMLInterface*) list->data;
354 child_list = iface->functions;
355 if (child_list != NULL) {
356 childbox2 = EMLListBox.new(0, NULL,
357 ALIGN_LEFT,
358 EMLPROCESS_BORDER,
359 EMLPROCESS_UNDERLINEWIDTH,
360 LINESTYLE_SOLID,
361 NULL, NULL);
362 emlbox_add_el(childbox, childbox2);
364 while (child_list != NULL) {
365 fun = (EMLFunction*) child_list->data;
366 textbox = EMLTextBox.new(emlprocess->interface_font_height,
367 emlprocess->interface_font,
368 ALIGN_LEFT,
369 EMLPROCESS_BORDER,
370 EMLPROCESS_UNDERLINEWIDTH,
371 LINESTYLE_SOLID,
372 fun->left_connection,
373 fun->right_connection);
374 emlbox_add_el(textbox, eml_get_iffunction_string(fun));
375 emlbox_add_el(childbox2, textbox);
376 child_list = g_list_next(child_list);
380 child_list = iface->messages;
381 if (child_list != NULL) {
382 childbox2 = EMLListBox.new(0, NULL,
383 ALIGN_LEFT,
384 EMLPROCESS_BORDER,
385 EMLPROCESS_UNDERLINEWIDTH,
386 LINESTYLE_SOLID,
387 NULL, NULL);
388 emlbox_add_el(childbox, childbox2);
390 while (child_list != NULL) {
391 param = (EMLParameter*) child_list->data;
392 textbox = EMLTextBox.new(emlprocess->interface_font_height,
393 emlprocess->interface_font,
394 ALIGN_LEFT,
395 EMLPROCESS_BORDER,
396 EMLPROCESS_UNDERLINEWIDTH,
397 LINESTYLE_SOLID,
398 param->left_connection,
399 param->right_connection);
401 emlbox_add_el(textbox, eml_get_ifmessage_string(param));
402 emlbox_add_el(childbox2, textbox);
403 child_list = g_list_next(child_list);
406 list = g_list_next(list);
409 return topbox;
412 static
413 void
414 box_add_separator(EMLBox *box)
416 emlbox_add_el(box,
417 EMLListBox.new(0, NULL,
418 ALIGN_LEFT,
419 EMLPROCESS_BORDER,
420 EMLPROCESS_SECTIONWIDTH,
421 LINESTYLE_SOLID,
422 NULL, NULL));
425 void
426 emlprocess_create_box(EMLProcess *emlprocess)
428 ConnectionPoint *proc_connections;
429 EMLBox *topbox, *childbox, *textbox;
431 proc_connections = emlprocess->proc_connections;
433 topbox = EMLListBox.new(0, NULL,
434 ALIGN_LEFT,
435 EMLPROCESS_BORDER,
436 EMLPROCESS_SECTIONWIDTH,
437 LINESTYLE_SOLID,
438 NULL, NULL);
440 /*name section*/
441 textbox = EMLTextBox.new(emlprocess->name_font_height,
442 emlprocess->name_font,
443 ALIGN_LEFT,
444 EMLPROCESS_BORDER,
445 EMLPROCESS_SECTIONWIDTH,
446 LINESTYLE_SOLID,
447 &proc_connections[0],
448 &proc_connections[1]);
449 emlprocess->name_box = textbox;
450 emlbox_add_el(textbox, g_strjoin(" ", emlprocess->name, emlprocess->refname, NULL));
451 emlbox_add_el(topbox, textbox);
453 box_add_separator(topbox);
455 childbox = create_startup_box(emlprocess);
456 if (childbox != NULL)
457 emlbox_add_el(topbox, childbox);
459 box_add_separator(topbox);
461 /* proclife section */
462 textbox = EMLTextBox.new(emlprocess->proclife_font_height,
463 emlprocess->proclife_font,
464 ALIGN_CENTER,
465 EMLPROCESS_BORDER,
466 EMLPROCESS_SECTIONWIDTH,
467 LINESTYLE_SOLID,
468 &proc_connections[2],
469 &proc_connections[3]);
470 emlbox_add_el(textbox, g_strdup(emlprocess->proclife));
471 emlbox_add_el(topbox, textbox);
473 box_add_separator(topbox);
475 childbox = create_interfaces_box(emlprocess);
476 if (childbox != NULL)
477 emlbox_add_el(topbox, childbox);
479 emlprocess->box = topbox;
482 void
483 emlprocess_destroy_box(EMLProcess *emlprocess)
485 emlbox_destroy(emlprocess->box);
488 static
489 void
490 emlprocess_dialog_init(EMLProcess *emlprocess)
492 emlprocess->dialog_state.name = NULL;
493 emlprocess->dialog_state.refname = NULL;
494 emlprocess->dialog_state.proclife = NULL;
495 emlprocess->dialog_state.startupfun = NULL;
496 emlprocess->dialog_state.interfaces = NULL;
499 static
500 void
501 fill_in_fontdata(EMLProcess *emlprocess)
503 emlprocess->name_font_height = 0.8;
504 emlprocess->startupfun_font_height = 0.8;
505 emlprocess->startupparams_height = 0.8;
506 emlprocess->proclife_font_height = 0.8;
507 emlprocess->interface_font_height = 0.8;
509 /* choose default font name for your locale. see also font_data structure
510 in lib/font.c. if "Courier" works for you, it would be better. */
511 emlprocess->name_font = g_strdup(_("Courier"));
512 /* choose default font name for your locale. see also font_data structure
513 in lib/font.c. */
514 emlprocess->startupfun_font = g_strdup(_("Helvetica"));
515 emlprocess->startupparams_font = g_strdup(_("Helvetica"));
516 emlprocess->proclife_font = g_strdup(_("Helvetica"));
517 emlprocess->interface_font = g_strdup(_("Helvetica"));
521 static
522 Object *
523 emlprocess_create(Point *startpoint,
524 void *user_data,
525 Handle **handle1,
526 Handle **handle2)
528 EMLProcess *emlprocess;
529 Element *elem;
530 Object *obj;
531 GList *list;
532 int i;
533 ConnectionPoint *connection;
535 emlprocess = g_new0(EMLProcess, 1);
536 elem = &emlprocess->element;
537 obj = (Object *) emlprocess;
539 obj->type = &emlprocess_type;
541 obj->ops = &emlprocess_ops;
543 elem->corner = *startpoint;
545 emlprocess->properties_dialog = NULL;
546 emlprocess->box_connections = NULL;
547 emlprocess->box = NULL;
548 emlprocess->name = g_strdup("X");
549 emlprocess->refname = g_strdup("process");
550 emlprocess->proclife = g_strdup("inf");
552 emlprocess->startupfun = eml_function_new();
553 function_connections_new(emlprocess->startupfun);
555 emlprocess->interfaces = NULL;
557 fill_in_fontdata(emlprocess);
559 emlprocess_dialog_init(emlprocess);
561 emlprocess_create_box(emlprocess);
562 emlprocess_calculate_data(emlprocess);
563 emlprocess_calculate_connections(emlprocess);
564 element_init(elem, 8, g_list_length(emlprocess->box_connections));
566 list = emlprocess->box_connections;
568 for (i=0;list != NULL;i++) {
569 connection = (ConnectionPoint*) list->data;
570 obj->connections[i] = connection;
571 connection->object = obj;
572 connection->connected = NULL;
573 list = g_list_next(list);
576 emlprocess_update_data(emlprocess);
578 for (i=0;i<8;i++) {
579 obj->handles[i]->type = HANDLE_NON_MOVABLE;
582 *handle1 = NULL;
583 *handle2 = NULL;
584 return (Object *)emlprocess;
588 static void
589 emlprocess_destroy(EMLProcess *emlprocess)
591 element_destroy(&emlprocess->element);
593 g_free(emlprocess->name);
594 g_free(emlprocess->refname);
595 g_free(emlprocess->proclife);
596 function_connections_destroy(emlprocess->startupfun);
597 eml_function_destroy(emlprocess->startupfun);
598 g_list_foreach(emlprocess->interfaces, list_free_foreach,
599 emlprocess_interface_destroy);
600 g_list_free(emlprocess->interfaces);
602 g_list_free(emlprocess->box_connections);
604 emlprocess_destroy_box(emlprocess);
606 if (emlprocess->properties_dialog != NULL)
607 emlprocess_dialog_destroy(emlprocess);
609 g_free(emlprocess->name_font );
610 g_free(emlprocess->startupfun_font);
611 g_free(emlprocess->startupparams_font );
612 g_free(emlprocess->proclife_font );
613 g_free(emlprocess->interface_font );
617 static Object *
618 emlprocess_copy(EMLProcess *emlprocess)
620 EMLProcess *newemlprocess;
621 Element *elem, *newelem;
622 Object *newobj;
623 GList *list;
624 ConnectionPoint *connection;
625 int i;
627 elem = &emlprocess->element;
629 newemlprocess = g_new0(EMLProcess, 1);
630 newelem = &newemlprocess->element;
631 newobj = (Object *) newemlprocess;
633 element_copy(elem, newelem);
635 newemlprocess->properties_dialog = NULL;
636 newemlprocess->box_connections = NULL;
637 newemlprocess->box = NULL;
638 newemlprocess->interfaces = NULL;
640 newemlprocess->dialog_state.name = NULL;
641 newemlprocess->dialog_state.refname = NULL;
642 newemlprocess->dialog_state.proclife = NULL;
643 newemlprocess->dialog_state.startupfun = NULL;
644 newemlprocess->dialog_state.interfaces = NULL;
646 newemlprocess->name = g_strdup(emlprocess->name);
647 newemlprocess->refname = g_strdup(emlprocess->refname);
648 newemlprocess->proclife = g_strdup(emlprocess->proclife);
649 newemlprocess->startupfun = eml_function_copy(emlprocess->startupfun);
650 newemlprocess->interfaces = list_map(emlprocess->interfaces,
651 (MapFun) emlprocess_interface_copy);
653 function_connections_new(newemlprocess->startupfun);
654 g_list_foreach(newemlprocess->interfaces,
655 list_foreach_fun, interface_connections_new);
657 newemlprocess->name_font = g_strdup(emlprocess->name_font );
658 newemlprocess->startupfun_font = g_strdup(emlprocess->startupfun_font);
659 newemlprocess->startupparams_font =
660 g_strdup(emlprocess->startupparams_font );
661 newemlprocess->proclife_font = g_strdup(emlprocess->proclife_font );
662 newemlprocess->interface_font = g_strdup(emlprocess->interface_font );
664 newemlprocess->name_font_height = emlprocess->name_font_height ;
665 newemlprocess->startupfun_font_height = emlprocess->startupfun_font_height;
666 newemlprocess->startupparams_height = emlprocess->startupparams_height ;
667 newemlprocess->proclife_font_height = emlprocess->proclife_font_height ;
668 newemlprocess->interface_font_height = emlprocess->interface_font_height ;
670 emlprocess_dialog_init(newemlprocess);
672 emlprocess_create_box(newemlprocess);
673 emlprocess_calculate_data(newemlprocess);
674 emlprocess_calculate_connections(newemlprocess);
676 list = newemlprocess->box_connections;
677 for (i = 0; list != NULL; i++) {
678 connection = (ConnectionPoint*) list->data;
679 newobj->connections[i] = connection;
680 connection->connected = NULL;
681 connection->object = newobj;
682 connection->last_pos =
683 ((ConnectionPoint*)
684 g_list_nth_data(emlprocess->box_connections, i))->last_pos;
685 list = g_list_next(list);
688 emlprocess_update_data(newemlprocess);
690 return (Object *)newemlprocess;
695 static void
696 emlprocess_save(EMLProcess *emlprocess, ObjectNode obj_node,
697 const char *filename)
699 GList *list;
700 AttributeNode attr_node;
701 EMLInterface *iface;
703 element_save(&emlprocess->element, obj_node);
705 data_add_string(new_attribute(obj_node, "name"),
706 emlprocess->name);
707 data_add_string(new_attribute(obj_node, "refname"),
708 emlprocess->refname);
709 data_add_string(new_attribute(obj_node, "proclife"),
710 emlprocess->proclife);
712 attr_node = new_attribute(obj_node, "startupfun");
713 eml_function_write(attr_node, emlprocess->startupfun);
715 attr_node = new_attribute(obj_node, "interfaces");
717 list = emlprocess->interfaces;
718 while (list != NULL) {
719 iface = (EMLInterface*) list->data;
720 eml_interface_write(attr_node, iface);
721 list = g_list_next(list);
726 static Object *emlprocess_load(ObjectNode obj_node, int version,
727 const char *filename)
729 EMLProcess *emlprocess;
730 Element *elem;
731 Object *obj;
732 AttributeNode attr_node;
733 DataNode composite;
734 EMLInterface *iface;
735 GList *list;
736 ConnectionPoint *connection;
737 int i;
738 int num;
740 emlprocess = g_new0(EMLProcess, 1);
741 elem = &emlprocess->element;
742 obj = (Object *) emlprocess;
744 obj->type = &emlprocess_type;
745 obj->ops = &emlprocess_ops;
747 element_load(elem, obj_node);
749 fill_in_fontdata(emlprocess);
751 emlprocess->name = NULL;
752 attr_node = object_find_attribute(obj_node, "name");
753 if (attr_node != NULL)
754 emlprocess->name = data_string(attribute_first_data(attr_node));
756 emlprocess->refname = NULL;
757 attr_node = object_find_attribute(obj_node, "refname");
758 if (attr_node != NULL)
759 emlprocess->refname = data_string(attribute_first_data(attr_node));
761 emlprocess->proclife = NULL;
762 attr_node = object_find_attribute(obj_node, "proclife");
763 if (attr_node != NULL)
764 emlprocess->proclife = data_string(attribute_first_data(attr_node));
766 attr_node = object_find_attribute(obj_node, "startupfun");
767 composite = attribute_first_data(attr_node);
768 emlprocess->startupfun = eml_function_read(composite);
769 function_connections_new(emlprocess->startupfun);
770 /* Interfaces: */
771 attr_node = object_find_attribute(obj_node, "interfaces");
772 num = attribute_num_data(attr_node);
773 composite = attribute_first_data(attr_node);
774 emlprocess->interfaces = NULL;
775 for (i=0;i<num;i++) {
776 iface = eml_interface_read(composite);
777 interface_connections_new(iface);
778 emlprocess->interfaces = g_list_append(emlprocess->interfaces, iface);
779 composite = data_next(composite);
782 emlprocess->properties_dialog = NULL;
783 emlprocess->box = NULL;
784 emlprocess->box_connections = NULL;
786 emlprocess_create_box(emlprocess);
787 emlprocess_calculate_connections(emlprocess);
788 element_init(elem, 8, g_list_length(emlprocess->box_connections));
790 list = emlprocess->box_connections;
792 for (i=0;list != NULL;i++) {
793 connection = (ConnectionPoint*) list->data;
794 obj->connections[i] = connection;
795 connection->object = obj;
796 connection->connected = NULL;
797 list = g_list_next(list);
800 emlprocess_update_data(emlprocess);
802 for (i=0;i<8;i++) {
803 obj->handles[i]->type = HANDLE_NON_MOVABLE;
806 emlprocess_dialog_init(emlprocess);
808 return (Object *)emlprocess;