2006-12-05 David Lodge <dave@cirt.net>
[dia.git] / objects / AADL / aadlthreadgroup.c
blob5d98124c8abd45961cbca26b827377f13ed8f769
1 /* AADL plugin for DIA
3 * Copyright (C) 2005 Laboratoire d'Informatique de Paris 6
4 * Author: Pierre Duquesne
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 #include "aadl.h"
23 #include "pixmaps/aadlthreadgroup.xpm"
25 /***********************************************
26 ** AADL THREADGROUP **
27 ***********************************************/
30 #define AADL_THREADGROUP_CORNER_SIZE 2
31 #define AADL_THREADGROUP_CORNER_SIZE_FACTOR 0.25
34 static void aadlthreadgroup_draw_borders(Aadlbox *aadlbox, DiaRenderer *renderer)
36 aadlbox_draw_rounded_box(aadlbox, renderer, LINESTYLE_DASHED);
39 static Aadlbox_specific aadlthreadgroup_specific =
41 (AadlProjectionFunc) aadldata_project_point_on_nearest_border,
42 (AadlTextPosFunc) aadldata_text_position,
43 (AadlSizeFunc) aadldata_minsize
47 static void aadlthreadgroup_draw(Aadlbox *aadlbox, DiaRenderer *renderer)
49 aadlthreadgroup_draw_borders(aadlbox, renderer);
50 aadlbox_draw(aadlbox, renderer);
53 ObjectTypeOps aadlthreadgroup_type_ops;
55 DiaObjectType aadlthreadgroup_type =
57 "AADL - Thread Group", /* name */
58 0, /* version */
59 (char **) aadlthreadgroup_xpm, /* pixmap */
60 &aadlthreadgroup_type_ops, /* ops */
61 NULL,
62 &aadlthreadgroup_specific /* user data */
66 static ObjectOps aadlthreadgroup_ops =
68 (DestroyFunc) aadlbox_destroy,
69 (DrawFunc) aadlthreadgroup_draw, /* redefined */
70 (DistanceFunc) aadlbox_distance_from,
71 (SelectFunc) aadlbox_select,
72 (CopyFunc) aadlbox_copy,
73 (MoveFunc) aadlbox_move,
74 (MoveHandleFunc) aadlbox_move_handle,
75 (GetPropertiesFunc) object_create_props_dialog,
76 (ApplyPropertiesFunc) object_apply_props_from_dialog,
77 (ObjectMenuFunc) aadlbox_get_object_menu,
78 (DescribePropsFunc) aadlbox_describe_props,
79 (GetPropsFunc) aadlbox_get_props,
80 (SetPropsFunc) aadlbox_set_props
85 static DiaObject *aadlthreadgroup_create(Point *startpoint, void *user_data, Handle **handle1, Handle **handle2)
87 DiaObject *obj = aadlbox_create(startpoint, user_data, handle1, handle2);
89 obj->type = &aadlthreadgroup_type;
90 obj->ops = &aadlthreadgroup_ops;
92 return obj;
95 static DiaObject *aadlthreadgroup_load(ObjectNode obj_node, int version, const char *filename)
97 DiaObject *obj;
98 Point startpoint = {0.0,0.0};
99 Handle *handle1,*handle2;
101 obj = aadlthreadgroup_create(&startpoint, &aadlthreadgroup_specific,
102 &handle1,&handle2);
103 aadlbox_load(obj_node, version, filename, (Aadlbox *) obj);
104 return obj;
108 ObjectTypeOps aadlthreadgroup_type_ops =
110 (CreateFunc) aadlthreadgroup_create,
111 (LoadFunc) aadlthreadgroup_load,/*using_properties*/ /* load */
112 (SaveFunc) aadlbox_save, /* save */
113 (GetDefaultsFunc) NULL,
114 (ApplyDefaultsFunc) NULL